Skip to content

Commit

Permalink
RN and V updated
Browse files Browse the repository at this point in the history
  • Loading branch information
g-battaglia committed Feb 27, 2025
1 parent 511aaef commit 5b09a79
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 5 deletions.
16 changes: 12 additions & 4 deletions kerykeion/composite_subject_factory.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import logging
from typing import Union

from kerykeion import AstrologicalSubject
Expand All @@ -13,10 +12,19 @@
)


# TODO: Check DIFFERENCE IN DEGREES BETWEEN PLANETS AND HOUSES!
# TODO: ORDER UTILS!

class CompositeSubjectFactory:
"""
Factory class to create a Composite Subject Model from two Astrological Subjects
Currently, the only available method for creating composite charts is the midpoint method.
The composite houses and planets are calculated based on the midpoint of the corresponding points of the two subjects.
The house are then reordered to match the original house system of the first subject.
Args:
first_subject (AstrologicalSubject): First astrological subject
second_subject (AstrologicalSubject): Second astrological subject
chart_name (str): Name of the composite chart. If None, it will be automatically generated.
"""

model: Union[CompositeSubjectModel, None]
first_subject: AstrologicalSubjectModel
second_subject: AstrologicalSubjectModel
Expand Down
8 changes: 8 additions & 0 deletions kerykeion/kr_types/kr_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ class KerykeionPointModel(SubscriptableBaseModel):


class AstrologicalSubjectModel(SubscriptableBaseModel):
"""
Pydantic Model for Astrological Subject
"""

# Data
name: str
year: int
Expand Down Expand Up @@ -200,6 +204,10 @@ class RelationshipScoreModel(SubscriptableBaseModel):


class CompositeSubjectModel(SubscriptableBaseModel):
"""
Pydantic Model for Composite Subject
"""

# Data
name: str
first_subject: AstrologicalSubjectModel
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 = "kerykeion"
version = "4.24.7"
version = "4.25.0"
authors = ["Giacomo Battaglia <[email protected]>"]
description = "A python library for astrology."
license = "AGPL-3.0"
Expand Down
40 changes: 40 additions & 0 deletions release_notes/V4.25.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
## Release Note: Composite Charts Feature

This feature allows users to create composite charts, which are astrological charts that combine the data of two individuals to form a single chart. This is particularly useful for analyzing relationships and compatibility.

### Key Features:
- **Composite Subjects**: Create composite subjects by combining the astrological data of two individuals.
- **Composite Charts**: Generate composite charts by combining the astrological data of two individuals.

### Supported Methods:
- **Midpoint Method**: Currently, the only available method for creating composite charts is the midpoint method. In this method, the composite houses and planets are calculated based on the midpoint of the corresponding points of the two subjects.
The house are then reordered to match the original house system of the first subject.

### Example Usage:
Here is an example of how to create a composite chart using the new feature:

```python
if __name__ == "__main__":
from kerykeion.astrological_subject import AstrologicalSubject
from kerykeion.composite_subject_factory import CompositeSubjectFactory
from kerykeion.charts.kerykeion_chart_svg import KerykeionChartSVG

# Create astrological subjects
first = AstrologicalSubject("John Lennon", 1940, 10, 9, 18, 30, "Liverpool", "GB")
second = AstrologicalSubject("Paul McCartney", 1942, 6, 18, 15, 30, "Liverpool", "GB")

# Generate composite chart data
composite_chart = CompositeSubjectFactory(first, second)
print(composite_chart.get_midpoint_composite_subject_model().model_dump_json(indent=4))

# Create and save the composite chart as an SVG
angelina = AstrologicalSubject("Angelina Jolie", 1975, 6, 4, 9, 9, "Los Angeles", "US", lng=-118.15, lat=34.03, tz_str="America/Los_Angeles")
brad = AstrologicalSubject("Brad Pitt", 1963, 12, 18, 6, 31, "Shawnee", "US", lng=-96.56, lat=35.20, tz_str="America/Chicago")

composite_subject_factory = CompositeSubjectFactory(angelina, brad)
composite_subject_model = composite_subject_factory.get_midpoint_composite_subject_model()
composite_chart = KerykeionChartSVG(composite_subject_model, "Composite")
composite_chart.makeSVG()
```

With this new feature, you can now explore the dynamics of relationships through composite charts, providing deeper insights into compatibility and shared potentials.

0 comments on commit 5b09a79

Please sign in to comment.