Skip to content

Commit

Permalink
rename quality to modality
Browse files Browse the repository at this point in the history
  • Loading branch information
hoishing committed Nov 16, 2024
1 parent b83a14d commit 04a4991
Show file tree
Hide file tree
Showing 17 changed files with 167 additions and 142 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
- timezone, latitude and longitude database from [GeoNames]
- auto aware of daylight saving for a given time and location
- natal chart data statistics
- element, quality, and polarity counts
- element, modality, and polarity counts
- planets in each houses
- quadrant and hemisphere distribution
- aspect pair counts
Expand Down Expand Up @@ -120,7 +120,7 @@ sun.sign.color # earth
sun.sign.ruler # venus
sun.sign.classic_ruler # venus
sun.sign.element # earth
sun.sign.quality # fixed
sun.sign.modality # fixed
sun.sign.polarity # negative

# Aspect object
Expand Down Expand Up @@ -170,9 +170,9 @@ print(stats.full_report(kind="markdown"))
| air | 3 | venus ♊, pluto ♎, mc ♊ |


# Quality Distribution (MiMi)
# Modality Distribution (MiMi)

| quality | count | bodies |
| modality | count | bodies |
|-----------|---------|------------------------------------------------------------|
| fixed | 4 | sun ♉, mars ♌, uranus ♏, asc_node ♌ |
| cardinal | 3 | moon ♋, mercury ♈, pluto ♎ |
Expand Down
188 changes: 93 additions & 95 deletions demo.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/classes.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
::: natal.classes
::: natal.classes
2 changes: 1 addition & 1 deletion docs/data.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
::: natal.data
::: natal.data
2 changes: 1 addition & 1 deletion docs/report.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
::: natal.report
::: natal.report
2 changes: 1 addition & 1 deletion docs/stats.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
::: natal.stats
::: natal.stats
2 changes: 1 addition & 1 deletion docs/utils.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
::: natal.utils
::: natal.utils
2 changes: 1 addition & 1 deletion natal/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def rx(self) -> str:
@property
def sign(self) -> SignMember:
"""
Return sign name, symbol, element, quality, and polarity.
Return sign name, symbol, element, modality, and polarity.
Returns:
SignMember: The sign member.
Expand Down
47 changes: 36 additions & 11 deletions natal/const.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

"""
Constants and utility functions for the natal package.
"""
Expand Down Expand Up @@ -44,9 +43,9 @@ class ElementMember(Body):
...


class QualityMember(Body):
class ModalityMember(Body):
"""
Represents a quality in raw data.
Represents a modality in raw data.
(cardinal, fixed, mutable)
"""

Expand Down Expand Up @@ -98,7 +97,7 @@ class SignMember(Body):
fall: str
classic_ruler: str
classic_detriment: str
quality: str
modality: str
element: str
polarity: str

Expand Down Expand Up @@ -141,7 +140,7 @@ def get_members(raw_data: dict) -> list[DotDict]:
PLANET_NAMES = ["sun", "moon", "mercury", "venus", "mars", "jupiter", "saturn", "uranus", "neptune", "pluto"]
EXTRA_NAMES = ["asc_node", "chiron", "ceres", "pallas", "juno", "vesta"]
ELEMENT_NAMES = ["fire", "earth", "air", "water"]
QUALITY_NAMES = ["cardinal", "fixed", "mutable"]
MODALITY_NAMES = ["cardinal", "fixed", "mutable"]
POLARITY_NAMES = ["positive", "negative"]
SIGN_NAMES = ["aries", "taurus", "gemini", "cancer", "leo", "virgo", "libra", "scorpio", "sagittarius", "capricorn", "aquarius", "pisces"]
HOUSE_NAMES = ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve"]
Expand Down Expand Up @@ -170,8 +169,8 @@ def get_members(raw_data: dict) -> list[DotDict]:
color=["fire", "earth", "air", "water"],
)

QUALITY = dict(
name=QUALITY_NAMES,
MODALITY = dict(
name=MODALITY_NAMES,
symbol="⟑⊟𛰣",
value=[0, 1, 2],
color=["fire", "earth", "air"],
Expand All @@ -191,11 +190,37 @@ def get_members(raw_data: dict) -> list[DotDict]:
color=["fire", "earth", "air", "water"] * 3,
ruler="mars venus mercury moon sun mercury venus pluto jupiter saturn uranus neptune".split(),
detriment="venus pluto jupiter saturn uranus neptune mars venus mercury moon sun mercury".split(),
exaltation=['sun', 'moon', '', 'jupiter', '', 'mercury', 'saturn', '', '', 'mars', '', 'venus'],
fall=['saturn', '', '', 'mars', '', 'venus', 'sun', 'moon', '', 'jupiter', '', 'mercury'],
exaltation=[
"sun",
"moon",
"",
"jupiter",
"",
"mercury",
"saturn",
"",
"",
"mars",
"",
"venus",
],
fall=[
"saturn",
"",
"",
"mars",
"",
"venus",
"sun",
"moon",
"",
"jupiter",
"",
"mercury",
],
classic_ruler="mars venus mercury moon sun mercury venus mars jupiter saturn saturn jupiter".split(),
classic_detriment="venus mars jupiter saturn saturn jupiter mars venus mercury moon sun mercury".split(),
quality=list(QUALITY["name"]) * 4,
modality=list(MODALITY["name"]) * 4,
element=list(ELEMENTS["name"]) * 3,
polarity=list(POLARITY["name"]) * 6,
)
Expand Down Expand Up @@ -226,7 +251,7 @@ def get_members(raw_data: dict) -> list[DotDict]:
PLANET_MEMBERS = get_members(PLANETS)
ASPECT_MEMBERS = get_members(ASPECTS)
ELEMENT_MEMBERS = get_members(ELEMENTS)
QUALITY_MEMBERS = get_members(QUALITY)
MODALITY_MEMBERS = get_members(MODALITY)
POLARITY_MEMBERS = get_members(POLARITY)
SIGN_MEMBERS = get_members(SIGNS)
HOUSE_MEMBERS = get_members(HOUSES)
Expand Down
2 changes: 1 addition & 1 deletion natal/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def __str__(self) -> str:
op += f"{e.name}: {e.signed_dms}\n"
op += "Signs:\n"
for e in self.signs:
op += f"{e.name}: degree={e.degree:.2f}, ruler={e.ruler}, color={e.color}, quality={e.quality}, element={e.element}, polarity={e.polarity}\n"
op += f"{e.name}: degree={e.degree:.2f}, ruler={e.ruler}, color={e.color}, modality={e.modality}, element={e.element}, polarity={e.polarity}\n"
op += "Aspects:\n"
for e in self.aspects:
op += f"{e.body1.name} {e.aspect_member.symbol} {e.body2.name}: {e.aspect_member.color}\n"
Expand Down
26 changes: 13 additions & 13 deletions natal/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
ELEMENT_MEMBERS,
EXTRA_MEMBERS,
PLANET_MEMBERS,
QUALITY_MEMBERS,
MODALITY_MEMBERS,
SIGN_MEMBERS,
VERTEX_MEMBERS,
)
Expand Down Expand Up @@ -71,34 +71,34 @@ def basic_info(self) -> Grid:
return list(zip(*output))

@property
def element_vs_quality(self) -> Grid:
def element_vs_modality(self) -> Grid:
"""
Generates a grid comparing elements and qualities.
Generates a grid comparing elements and modalities.
Returns:
A grid comparing elements and qualities.
A grid comparing elements and modalities.
"""
aspectable1 = self.data1.aspectables
element_symbols = [svg_of(ele.name) for ele in ELEMENTS]
grid = [[""] + element_symbols + ["sum"]]
element_count = defaultdict(int)
for quality in QUALITY_MEMBERS:
row = [svg_of(quality.name)]
quality_count = 0
for modality in MODALITY_MEMBERS:
row = [svg_of(modality.name)]
modality_count = 0
for element in ELEMENTS:
count = 0
symbols = ""
for body in aspectable1:
if (
body.sign.element == element.name
and body.sign.quality == quality.name
and body.sign.modality == modality.name
):
symbols += svg_of(body.name)
count += 1
element_count[element.name] += 1
row.append(symbols)
quality_count += count
row.append(quality_count)
modality_count += count
row.append(modality_count)
grid.append(row)
grid.append(
["sum"] + list(element_count.values()) + [sum(element_count.values())]
Expand Down Expand Up @@ -250,7 +250,7 @@ def full_report(self) -> str:
chart = Chart(self.data1, width=400, data2=self.data2)
row1 = div(
section("Birth Info", self.basic_info)
+ section("Elements, Modality & Polarity", self.element_vs_quality)
+ section("Elements, Modality & Polarity", self.element_vs_modality)
+ section("Hemisphere & Quadrants", self.quadrants_vs_hemisphere),
class_="info_col",
) + div(chart.svg, class_="chart")
Expand Down Expand Up @@ -292,10 +292,10 @@ def create_pdf(self, html: str) -> BytesIO:
def html_table_of(grid: Grid) -> str:
"""
Converts a grid of data into an HTML table.
# Arguments
* grid - The grid of data to convert
# Returns
String containing the HTML table
"""
Expand Down
6 changes: 3 additions & 3 deletions natal/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from tabulate import tabulate
from typing import Iterable, Literal, NamedTuple, Callable

DistKind = Literal["element", "quality", "polarity"]
DistKind = Literal["element", "modality", "polarity"]
ReportKind = Literal["markdown", "html"]
Grid = list[Iterable[str | int]]

Expand Down Expand Up @@ -63,11 +63,11 @@ def __init__(self, data1: Data, data2: Data | None = None) -> None:

def distribution(self, kind: DistKind) -> StatData:
"""
Generate distribution statistics for elements, qualities, or polarities.
Generate distribution statistics for elements, modalities, or polarities.
Args:
kind (DistKind): The type of distribution to calculate.
Must be one of "element", "quality", or "polarity".
Must be one of "element", "modality", or "polarity".
Returns:
StatData: A named tuple containing the title and grid of distribution data,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "natal"
version = "0.7.7"
version = "0.8.0"
description = "create Natal Chart with ease"
license = "MIT"
repository = "https://github.com/hoishing/natal"
Expand Down
3 changes: 2 additions & 1 deletion tests/test_const.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def test_const():
assert len(PLANET_MEMBERS) == 10
assert len(ASPECT_MEMBERS) == 5
assert len(ELEMENT_MEMBERS) == 4
assert len(QUALITY_MEMBERS) == 3
assert len(MODALITY_MEMBERS) == 3
assert len(POLARITY_MEMBERS) == 2
assert len(SIGN_MEMBERS) == 12
assert len(HOUSE_MEMBERS) == 12
Expand All @@ -31,6 +31,7 @@ def test_house_member():
assert house.name == "four"
assert house.color == "water"


def test_extra_member():
node = EXTRA_MEMBERS[0]
assert node.name == "asc_node"
Expand Down
3 changes: 2 additions & 1 deletion tests/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def test_signs(data1: Data, signs: dict) -> None:
assert round(sign.degree, 2) == signs[sign.name][0]
assert sign.ruler == signs[sign.name][1]
assert sign.color == signs[sign.name][2]
assert sign.quality == signs[sign.name][3]
assert sign.modality == signs[sign.name][3]
assert sign.element == signs[sign.name][4]
assert sign.polarity == signs[sign.name][5]

Expand Down Expand Up @@ -158,6 +158,7 @@ def test_fix_orb_eq_0(data1: Data) -> None:
assert len(data1.aspects) == 24
assert len(data.aspects) == 14


def test_house_sys(data1: Data) -> None:
data = Data(data1.name, data1.city, data1.dt, config=Config(house_sys="W"))
assert data.house_sys == "W"
Expand Down
4 changes: 2 additions & 2 deletions tests/test_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ def test_basic_info(report):
assert basic_info[2][0] == "birth"


def test_element_vs_quality(report):
grid = report.element_vs_quality
def test_element_vs_modality(report):
grid = report.element_vs_modality
assert len(grid) > 0
assert grid[4] == ["sum", 2, 2, 5, 4, 13]
assert [g[5] for g in grid[:5]] == ["sum", 7, 5, 1, 13]
Expand Down
8 changes: 4 additions & 4 deletions tests/test_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ def element_grid():


@fixture
def quality_grid():
def modality_grid():
return [
("quality", "sum", "bodies"),
("modality", "sum", "bodies"),
("fixed", 5, "sun ♉, mercury ♉, jupiter ♉, uranus ♏, asc_node ♏"),
("cardinal", 7, "moon ♑, venus ♈, mars ♋, saturn ♋, pluto ♎, asc ♎, mc ♋"),
("mutable", 1, "neptune ♐"),
Expand Down Expand Up @@ -254,9 +254,9 @@ def inner_planets_cross_ref_grid():
# fmt: on


def test_distribution_grid(stats, element_grid, quality_grid, polarity_grid):
def test_distribution_grid(stats, element_grid, modality_grid, polarity_grid):
assert stats.distribution("element").grid == element_grid
assert stats.distribution("quality").grid == quality_grid
assert stats.distribution("modality").grid == modality_grid
assert stats.distribution("polarity").grid == polarity_grid


Expand Down

0 comments on commit 04a4991

Please sign in to comment.