lxcor-cordial 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. lxcor_cordial-0.1.0/LICENSE +202 -0
  2. lxcor_cordial-0.1.0/NOTICE +8 -0
  3. lxcor_cordial-0.1.0/PKG-INFO +69 -0
  4. lxcor_cordial-0.1.0/README.md +48 -0
  5. lxcor_cordial-0.1.0/pyproject.toml +36 -0
  6. lxcor_cordial-0.1.0/setup.cfg +4 -0
  7. lxcor_cordial-0.1.0/src/cordial/__init__.py +24 -0
  8. lxcor_cordial-0.1.0/src/cordial/cordial_angle.py +51 -0
  9. lxcor_cordial-0.1.0/src/cordial/cordial_angle_adapter.py +41 -0
  10. lxcor_cordial-0.1.0/src/cordial/cordial_circle.py +76 -0
  11. lxcor_cordial-0.1.0/src/cordial/cordial_const.py +238 -0
  12. lxcor_cordial-0.1.0/src/cordial/cordial_converter.py +307 -0
  13. lxcor_cordial-0.1.0/src/cordial/cordial_date.py +176 -0
  14. lxcor_cordial-0.1.0/src/cordial/cordial_datetime.py +33 -0
  15. lxcor_cordial-0.1.0/src/cordial/cordial_equinox.py +62 -0
  16. lxcor_cordial-0.1.0/src/cordial/cordial_julian.py +86 -0
  17. lxcor_cordial-0.1.0/src/cordial/cordial_place.py +46 -0
  18. lxcor_cordial-0.1.0/src/cordial/cordial_sky.py +221 -0
  19. lxcor_cordial-0.1.0/src/cordial/cordial_time.py +107 -0
  20. lxcor_cordial-0.1.0/src/cordial/cordial_util.py +170 -0
  21. lxcor_cordial-0.1.0/src/cordial/cordial_void_day.py +79 -0
  22. lxcor_cordial-0.1.0/src/cordial/data/equinox_jd.json +36 -0
  23. lxcor_cordial-0.1.0/src/cordial/gregorian_date.py +105 -0
  24. lxcor_cordial-0.1.0/src/cordial/gregorian_datetime.py +34 -0
  25. lxcor_cordial-0.1.0/src/cordial/gregorian_time.py +119 -0
  26. lxcor_cordial-0.1.0/src/lxcor_cordial.egg-info/PKG-INFO +69 -0
  27. lxcor_cordial-0.1.0/src/lxcor_cordial.egg-info/SOURCES.txt +28 -0
  28. lxcor_cordial-0.1.0/src/lxcor_cordial.egg-info/dependency_links.txt +1 -0
  29. lxcor_cordial-0.1.0/src/lxcor_cordial.egg-info/top_level.txt +1 -0
  30. lxcor_cordial-0.1.0/tests/test_core.py +255 -0
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,8 @@
1
+ Cordial
2
+ Copyright 2015-2026 Light Cross Holdings Corporation. All Rights Reserved.
3
+
4
+ This product includes software developed by Light Cross Holdings Corporation
5
+ (https://lxcor.com). Under the Apache License 2.0 (section 4d), any redistribution
6
+ of this work, or of a derivative of it, must retain this notice in a NOTICE file
7
+ or in its documentation, so that the origin of the Cordial calendar and clock
8
+ is credited.
@@ -0,0 +1,69 @@
1
+ Metadata-Version: 2.4
2
+ Name: lxcor-cordial
3
+ Version: 0.1.0
4
+ Summary: Cordial: a calendar and clock of 364 days (13 x 28 = 52 x 7), a 26-hour day and a 364-grau circle, with converters to the Gregorian system.
5
+ Author: Light Cross Holdings Corporation
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://cordial.lxcor.com
8
+ Project-URL: Repository, https://github.com/lxcor/cordial-core
9
+ Project-URL: Issues, https://github.com/lxcor/cordial-core/issues
10
+ Keywords: calendar,clock,cordial,equinox,julian day
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Topic :: Scientific/Engineering :: Astronomy
15
+ Classifier: Topic :: Software Development :: Libraries
16
+ Requires-Python: >=3.9
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ License-File: NOTICE
20
+ Dynamic: license-file
21
+
22
+ # Cordial (`lxcor-cordial`)
23
+
24
+ Cordial is a calendar and clock built on two numbers, **364** and **52**: a year of 364 days (13 months of 28 days, 52 weeks of 7),
25
+ a day of 26 hours of 52 minutes of 52 seconds, and a circle of 364 grau (a quarter circle is 91). A Cordial day **begins at noon**; the
26
+ year begins at noon on the date of the **March equinox**, and the days left after the 364th (one or two, as the sky dictates) are the
27
+ **Void Days**. Years are counted from Adam's birth (Anno Adami, AA): the year that began in March 2026 is **6030 AA**.
28
+
29
+ This package is the pure core: the date, time, angle, place and sky classes, the Julian Day link and the converters to the Gregorian
30
+ system. It needs **only the Python standard library** (3.9+) and ships its one data file, the table of March equinoxes.
31
+
32
+ ```
33
+ pip install lxcor-cordial
34
+ ```
35
+
36
+ ```python
37
+ from cordial import GregorianDate, CordialDate, CordialJulian
38
+
39
+ GregorianDate(2026, 11, 13).to_cordial_date().to_date_string() # 'Sagittarius 15, 6030' (the day that begins at noon on that date)
40
+ CordialDate(2027, 9, 15).to_gregorian_date() # datetime.date(2026, 11, 13); the year argument is the internal index (AA 6030 - 4003)
41
+ CordialJulian.cordial_to_jdn(2027, 9, 15) # 2461358: a Cordial day is a Julian day
42
+ ```
43
+
44
+ ```python
45
+ from cordial import cordial_converter as converter
46
+ converter.gregorian_date_to_cordial(2026, 11, 13) # rows of (label, value), ready to show; raises ConverterError with a message
47
+ ```
48
+
49
+ ## Scope and honesty about the sky
50
+
51
+ - Dates are computed from the packaged equinox table (`src/cordial/data/equinox_jd.json`, JPL DE421): Cordial years 2020 to 2052, that is
52
+ Gregorian March 20, 2019 to March 18, 2052. Outside it conversions raise an error (`ValueError` / `ConverterError`). The number of Void
53
+ Days beyond the table is only a forecast by the Gregorian leap-year rule, which differs from the sky in Cordial 2044, 2045, 2048, 2049 and 2052.
54
+ - `tools/build_equinox_jd.py` regenerates the table (needs `skyfield`); extend it and release a new version to widen the range.
55
+ - Positions of the Sun, Moon and stars, maps and charts are not in this package: they need an ephemeris and plotting libraries and live in the
56
+ Cordial web site (https://cordial.lxcor.com), which uses this core.
57
+ - Every Cordial day has a Julian Day Number, computed directly with no other calendar as a step, and the tests check each day from 2020
58
+ to 2052 against the Julian Day Number of its Gregorian date (an external witness).
59
+
60
+ ## Tests
61
+
62
+ ```
63
+ PYTHONPATH=src python -m unittest discover -s tests
64
+ ```
65
+
66
+ ## Licence
67
+
68
+ Apache License 2.0 (see `LICENSE`), with attribution: keep the `NOTICE` file with any redistribution. Commercial use is allowed.
69
+ Copyright 2015-2026 Light Cross Holdings Corporation. All Rights Reserved.
@@ -0,0 +1,48 @@
1
+ # Cordial (`lxcor-cordial`)
2
+
3
+ Cordial is a calendar and clock built on two numbers, **364** and **52**: a year of 364 days (13 months of 28 days, 52 weeks of 7),
4
+ a day of 26 hours of 52 minutes of 52 seconds, and a circle of 364 grau (a quarter circle is 91). A Cordial day **begins at noon**; the
5
+ year begins at noon on the date of the **March equinox**, and the days left after the 364th (one or two, as the sky dictates) are the
6
+ **Void Days**. Years are counted from Adam's birth (Anno Adami, AA): the year that began in March 2026 is **6030 AA**.
7
+
8
+ This package is the pure core: the date, time, angle, place and sky classes, the Julian Day link and the converters to the Gregorian
9
+ system. It needs **only the Python standard library** (3.9+) and ships its one data file, the table of March equinoxes.
10
+
11
+ ```
12
+ pip install lxcor-cordial
13
+ ```
14
+
15
+ ```python
16
+ from cordial import GregorianDate, CordialDate, CordialJulian
17
+
18
+ GregorianDate(2026, 11, 13).to_cordial_date().to_date_string() # 'Sagittarius 15, 6030' (the day that begins at noon on that date)
19
+ CordialDate(2027, 9, 15).to_gregorian_date() # datetime.date(2026, 11, 13); the year argument is the internal index (AA 6030 - 4003)
20
+ CordialJulian.cordial_to_jdn(2027, 9, 15) # 2461358: a Cordial day is a Julian day
21
+ ```
22
+
23
+ ```python
24
+ from cordial import cordial_converter as converter
25
+ converter.gregorian_date_to_cordial(2026, 11, 13) # rows of (label, value), ready to show; raises ConverterError with a message
26
+ ```
27
+
28
+ ## Scope and honesty about the sky
29
+
30
+ - Dates are computed from the packaged equinox table (`src/cordial/data/equinox_jd.json`, JPL DE421): Cordial years 2020 to 2052, that is
31
+ Gregorian March 20, 2019 to March 18, 2052. Outside it conversions raise an error (`ValueError` / `ConverterError`). The number of Void
32
+ Days beyond the table is only a forecast by the Gregorian leap-year rule, which differs from the sky in Cordial 2044, 2045, 2048, 2049 and 2052.
33
+ - `tools/build_equinox_jd.py` regenerates the table (needs `skyfield`); extend it and release a new version to widen the range.
34
+ - Positions of the Sun, Moon and stars, maps and charts are not in this package: they need an ephemeris and plotting libraries and live in the
35
+ Cordial web site (https://cordial.lxcor.com), which uses this core.
36
+ - Every Cordial day has a Julian Day Number, computed directly with no other calendar as a step, and the tests check each day from 2020
37
+ to 2052 against the Julian Day Number of its Gregorian date (an external witness).
38
+
39
+ ## Tests
40
+
41
+ ```
42
+ PYTHONPATH=src python -m unittest discover -s tests
43
+ ```
44
+
45
+ ## Licence
46
+
47
+ Apache License 2.0 (see `LICENSE`), with attribution: keep the `NOTICE` file with any redistribution. Commercial use is allowed.
48
+ Copyright 2015-2026 Light Cross Holdings Corporation. All Rights Reserved.
@@ -0,0 +1,36 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "lxcor-cordial"
7
+ version = "0.1.0"
8
+ description = "Cordial: a calendar and clock of 364 days (13 x 28 = 52 x 7), a 26-hour day and a 364-grau circle, with converters to the Gregorian system."
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ license = "Apache-2.0"
12
+ license-files = ["LICENSE", "NOTICE"]
13
+ authors = [{ name = "Light Cross Holdings Corporation" }]
14
+ keywords = ["calendar", "clock", "cordial", "equinox", "julian day"]
15
+ classifiers = [
16
+ "Development Status :: 3 - Alpha",
17
+ "Intended Audience :: Developers",
18
+ "Programming Language :: Python :: 3",
19
+ "Topic :: Scientific/Engineering :: Astronomy",
20
+ "Topic :: Software Development :: Libraries",
21
+ ]
22
+ dependencies = []
23
+
24
+ [project.urls]
25
+ Homepage = "https://cordial.lxcor.com"
26
+ Repository = "https://github.com/lxcor/cordial-core"
27
+ Issues = "https://github.com/lxcor/cordial-core/issues"
28
+
29
+ [tool.setuptools]
30
+ package-dir = { "" = "src" }
31
+
32
+ [tool.setuptools.packages.find]
33
+ where = ["src"]
34
+
35
+ [tool.setuptools.package-data]
36
+ cordial = ["data/*.json"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,24 @@
1
+ """Cordial: a calendar and clock built on 364 = 13 x 28 = 52 x 7 days, the 26-hour day and the 364-grau circle.
2
+
3
+ Core classes, pure Python (standard library only). A Cordial day begins at Gregorian noon; the year begins at noon on the date of the
4
+ March equinox, and the Void Days that close it are dictated by the next equinox.
5
+ """
6
+
7
+ from cordial import cordial_const as CordialConst
8
+ from cordial.cordial_angle import CordialAngle
9
+ from cordial.cordial_angle_adapter import CordialAngleAdapter
10
+ from cordial.cordial_circle import CordialCircle
11
+ from cordial.cordial_date import CordialDate
12
+ from cordial.cordial_datetime import CordialDatetime
13
+ from cordial.cordial_equinox import CordialEquinox
14
+ from cordial.cordial_julian import CordialJulian
15
+ from cordial.cordial_place import CordialPlace
16
+ from cordial.cordial_sky import CordialSky
17
+ from cordial.cordial_time import CordialTime
18
+ from cordial.cordial_util import CordialUtil
19
+ from cordial.cordial_void_day import CordialVoidDay
20
+ from cordial.gregorian_date import GregorianDate
21
+ from cordial.gregorian_datetime import GregorianDatetime
22
+ from cordial.gregorian_time import GregorianTime
23
+
24
+ __version__ = "0.1.0"
@@ -0,0 +1,51 @@
1
+ from cordial import cordial_const as CordialConst
2
+
3
+
4
+ class CordialAngle:
5
+ """An angle in Cordial units: grau, and the Cordial hours, minutes and seconds into which a grau divides.
6
+
7
+ The circle is 364 grau (a quarter circle 91), not 360 degrees. One grau is the turn of the Earth in one Cordial day divided by 364:
8
+ 26 Cordial hours of 52 minutes of 52 seconds, so 1 grau = 70,304 Cordial seconds, and a Cordial hour of the Earth's turn is 14 grau.
9
+ Its Gregorian counterpart is degrees, arcminutes and arcseconds (see CordialAngleAdapter); 1 grau = 360/364 degrees."""
10
+
11
+ def __init__(self, cdegrees, chours=0, cminutes=0, cseconds=0):
12
+ self.cdegrees = cdegrees
13
+ self.chours = chours
14
+ self.cminutes = cminutes
15
+ self.cseconds = cseconds
16
+ self.decimal = self.to_decimal()
17
+ self.degrees = self.to_degrees()
18
+
19
+ def __str__(self):
20
+ return self.to_decimal()
21
+
22
+ def serialize(self):
23
+ return self.__dict__
24
+
25
+ def to_decimal(self):
26
+ return self.cdegrees + (self.chours / CordialConst.chours_IN_GRAU) + (self.cminutes / CordialConst.cminutes_IN_GRAU) + (self.cseconds / CordialConst.cseconds_IN_GRAU)
27
+
28
+ def to_degrees(self):
29
+ return self.to_decimal() * CordialConst.DEGREES_IN_GRAU
30
+
31
+ def to_symbol_string(self):
32
+ return "%s%s%s%s%s%s%s%s" % (self.cdegrees, u'\u00B0', f'{self.chours:02}', u'\u2032', f'{self.cminutes:02}', u'\u2033', f'{self.cseconds:02}', u'\u2034')
33
+
34
+ @staticmethod
35
+ def from_decimal(decimal_cdegrees):
36
+ cdegrees = int(decimal_cdegrees)
37
+ cdegrees_remainder = decimal_cdegrees - cdegrees
38
+
39
+ decimal_chours = cdegrees_remainder * CordialConst.chours_IN_GRAU
40
+ chours = int(decimal_chours)
41
+ chours_reminder = decimal_chours - chours
42
+
43
+ decimal_cminutes = chours_reminder * CordialConst.cminutes_IN_GHOUR
44
+ cminutes = int(decimal_cminutes)
45
+ cminutes_reminder = decimal_cminutes - cminutes
46
+
47
+ decimal_cseconds = cminutes_reminder * CordialConst.cseconds_IN_GMINUTE
48
+ cseconds = int(decimal_cseconds)
49
+ # cseconds_reminder = decimal_cseconds - cseconds
50
+
51
+ return CordialAngle(cdegrees, chours, cminutes, cseconds)
@@ -0,0 +1,41 @@
1
+ from cordial import cordial_const as CordialConst
2
+
3
+
4
+ class CordialAngleAdapter:
5
+ """A Gregorian angle (degrees, arcminutes, arcseconds) that converts to its Cordial counterpart (CordialAngle) and back.
6
+
7
+ 360 degrees and 364 grau are the same full turn, so the factor is 364/360 each way."""
8
+
9
+ def __init__(self, degrees, arcminutes=0, arcseconds=0):
10
+ self.degrees = degrees
11
+ self.arcminutes = arcminutes
12
+ self.arcseconds = arcseconds
13
+ self.decimal = self.to_decimal()
14
+ self.cdegrees = self.to_cordial()
15
+
16
+ def __str__(self):
17
+ return self.to_decimal()
18
+
19
+ def serialize(self):
20
+ return self.__dict__
21
+
22
+ def to_decimal(self):
23
+ return self.degrees + (self.arcminutes / CordialConst.ARCMINUTES_IN_DEGREE) + (self.arcseconds / CordialConst.ARCSECONDS_IN_DEGREE)
24
+
25
+ def to_cordial(self):
26
+ return self.to_decimal() * CordialConst.cdegrees_IN_DEGREE
27
+
28
+ @staticmethod
29
+ def from_decimal(decimal_degree):
30
+ degree = int(decimal_degree)
31
+ degree_reminder = decimal_degree - degree
32
+
33
+ decimal_arcminutes = degree_reminder * CordialConst.ARCMINUTES_IN_DEGREE
34
+ arcminutes = int(decimal_arcminutes)
35
+ arcminutes_reminder = decimal_arcminutes - arcminutes
36
+
37
+ decimal_arcseconds = arcminutes_reminder * CordialConst.ARCSECONDS_IN_DEGREE
38
+ arcseconds = int(decimal_arcseconds)
39
+ # arcseconds_reminder = decimal_arcseconds - arcseconds
40
+
41
+ return CordialAngleAdapter(degree, arcminutes, arcseconds)
@@ -0,0 +1,76 @@
1
+ from cordial import cordial_const as CordialConst
2
+
3
+
4
+ class CordialCircle:
5
+ """Marks an angle that falls exactly on a division of the full circle: a half, third, quarter, sixth, seventh or eighth.
6
+
7
+ ``system`` is "cordial" (a circle of 364 grau, which divides by 7 and 13 as well as by 2) or "degree" / "gregorian" (360 degrees,
8
+ which does not divide by 7). Each ``is_*`` attribute holds its name ("Half", "Quarter", ...) when the angle is on that division
9
+ and an empty string when it is not; the table of angles shows them.
10
+ """
11
+
12
+ def __init__(self, angle, system="cordial"):
13
+ self.angle = angle
14
+ self.system = system
15
+ self.is_half = self.get_half_label()
16
+ self.is_third = self.get_third_label()
17
+ self.is_quarter = self.get_quarter_label()
18
+ self.is_sixth = self.get_sixth_label()
19
+ self.is_seventh = self.get_seventh_label()
20
+ self.is_eighth = self.get_eighth_label()
21
+
22
+ def serialize(self):
23
+ return self.__dict__
24
+
25
+ def get_angles_in_circle(self):
26
+ if self.system in ("degree", "gregorian"):
27
+ return CordialConst.DEGREES_IN_CIRCLE
28
+ return CordialConst.cdegrees_IN_CIRCLE
29
+
30
+ def get_half_of_circle(self):
31
+ return self.get_angles_in_circle() / 2
32
+
33
+ def get_quarter_of_circle(self):
34
+ return self.get_angles_in_circle() / 4
35
+
36
+ def get_sixth_of_circle(self):
37
+ return self.get_angles_in_circle() / 6
38
+
39
+ def get_eighth_of_circle(self):
40
+ return self.get_angles_in_circle() / 8
41
+
42
+ def get_third_of_circle(self):
43
+ return self.get_angles_in_circle() / 3
44
+
45
+ def get_seventh_of_circle(self):
46
+ return self.get_angles_in_circle() / 7
47
+
48
+ def get_half_label(self):
49
+ if self.angle % self.get_half_of_circle() == 0:
50
+ return "Half"
51
+ return ""
52
+
53
+ def get_third_label(self):
54
+ if round(self.angle, 5) % round(self.get_third_of_circle(), 5) == 0:
55
+ return "Third"
56
+ return ""
57
+
58
+ def get_quarter_label(self):
59
+ if self.angle % self.get_quarter_of_circle() == 0:
60
+ return "Quarter"
61
+ return ""
62
+
63
+ def get_sixth_label(self):
64
+ if round(self.angle, 5) % round(self.get_sixth_of_circle(), 5) == 0:
65
+ return "Sixth"
66
+ return ""
67
+
68
+ def get_seventh_label(self):
69
+ if self.angle % self.get_seventh_of_circle() == 0:
70
+ return "Seventh"
71
+ return ""
72
+
73
+ def get_eighth_label(self):
74
+ if self.angle % self.get_eighth_of_circle() == 0:
75
+ return "Eighth"
76
+ return ""