asteroid_spinprops 0.2.0__py3-none-any.whl

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.
@@ -0,0 +1,118 @@
1
+ Metadata-Version: 2.3
2
+ Name: asteroid_spinprops
3
+ Version: 0.2.0
4
+ Summary: Collection of tools used for fitting sHG1G2 and ssHG1G2 photometric models to sparse asteroid photometry
5
+ License: MIT
6
+ Author: Odysseas
7
+ Author-email: odysseas.xenos@proton.me
8
+ Requires-Python: >=3.11
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Requires-Dist: astropy (==7.0.0)
15
+ Requires-Dist: fink-utils (==0.30.3)
16
+ Requires-Dist: matplotlib (==3.10.1)
17
+ Requires-Dist: nifty-ls (==1.0.1)
18
+ Requires-Dist: numpy (==2.2.5)
19
+ Requires-Dist: pandas (==2.2.3)
20
+ Requires-Dist: requests (==2.32.3)
21
+ Requires-Dist: scipy (==1.15.2)
22
+ Requires-Dist: tqdm (==4.67.1)
23
+ Description-Content-Type: text/markdown
24
+
25
+ # asteroid_spinprops
26
+
27
+
28
+
29
+ ## Getting started
30
+
31
+ To make it easy for you to get started with GitLab, here's a list of recommended next steps .
32
+
33
+ Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
34
+
35
+ ## Add your files
36
+
37
+ - [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
38
+ - [ ] [Add files using the command line](https://docs.gitlab.com/topics/git/add_files/#add-files-to-a-git-repository) or push an existing Git repository with the following command:
39
+
40
+ ```
41
+ cd existing_repo
42
+ git remote add origin https://gitlab.com/odysseas_xenos/rotational-properties-of-asteroids.git
43
+ git branch -M main
44
+ git push -uf origin main
45
+ ```
46
+
47
+ ## Integrate with your tools
48
+
49
+ - [ ] [Set up project integrations](https://gitlab.com/odysseas_xenos/rotational-properties-of-asteroids/-/settings/integrations)
50
+
51
+ ## Collaborate with your team
52
+
53
+ - [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
54
+ - [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
55
+ - [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
56
+ - [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
57
+ - [ ] [Set auto-merge](https://docs.gitlab.com/user/project/merge_requests/auto_merge/)
58
+
59
+ ## Test and Deploy
60
+
61
+ Use the built-in continuous integration in GitLab.
62
+
63
+ - [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/)
64
+ - [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
65
+ - [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
66
+ - [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
67
+ - [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
68
+
69
+ ***
70
+
71
+ # Editing this README
72
+
73
+ When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template.
74
+
75
+ ## Suggestions for a good README
76
+
77
+ Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
78
+
79
+ ## Name
80
+ Choose a self-explaining name for your project.
81
+
82
+ ## Description
83
+ Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
84
+
85
+ ## Badges
86
+ On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
87
+
88
+ ## Visuals
89
+ Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
90
+
91
+ ## Installation
92
+ Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
93
+
94
+ ## Usage
95
+ Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
96
+
97
+ ## Support
98
+ Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
99
+
100
+ ## Roadmap
101
+ If you have ideas for releases in the future, it is a good idea to list them in the README.
102
+
103
+ ## Contributing
104
+ State if you are open to contributions and what your requirements are for accepting them.
105
+
106
+ For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
107
+
108
+ You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
109
+
110
+ ## Authors and acknowledgment
111
+ Show your appreciation to those who have contributed to the project.
112
+
113
+ ## License
114
+ For open source projects, say how it is licensed.
115
+
116
+ ## Project status
117
+ If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
118
+
@@ -0,0 +1,28 @@
1
+ pipelines/estimate_periods_pipeline.py,sha256=76XnTKWrFWAA3CnEXS-8BlQNbIzrDb0HkxDaW9NWEsU,4682
2
+ ssolib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ ssolib/dataprep.py,sha256=VuUevXYo8qq6UXfvkSIdORZAw-8d-UgmjfmvnNQaCvw,17442
4
+ ssolib/modelfit.py,sha256=ZtKByMgR5Ea8FukWEnOBRFqSIJJ7qGXTUOo7Uh5knFY,14041
5
+ ssolib/periodest.py,sha256=LwV3xvyhncoi1uhAoRJERNb6yirY2A3-i1P8mwGUipo,4527
6
+ ssolib/pipetools.py,sha256=YZe8UDlfDeZZ81juKpZg1eVJs7oK0wDZw5w4THn6HM4,4912
7
+ ssolib/ssptools.py,sha256=OMSiJOxCql9-vuSKIir42KQqVM-aM9_7OZln27697Ao,2278
8
+ ssolib/testing/atlas_x_ztf_testing/test_pqfile_1.parquet,sha256=qVTCAlpBZLNxCwuKAMwKdjh9yeHFvfrQcr-ebFMQOVI,56455
9
+ ssolib/testing/atlas_x_ztf_testing/test_pqfile_2.parquet,sha256=Y-PEoaMAE0Tn2COlQgqdSGynbXnmy-j3NLYXf5KFwyY,242886
10
+ ssolib/testing/ephemeris_testing/2000 WL152,sha256=5PEc_VaMhYYD0IH6Zm30LwaRe8BMSgPRYxZDr5Mcu0A,430845
11
+ ssolib/testing/ephemeris_testing/2001 PC,sha256=mp4tTiUqrYGswT742nDwdE-egy8mPhDOuBQH9nmcrOo,23477
12
+ ssolib/testing/ephemeris_testing/2001 SG276,sha256=bC8VoBlfE96rC18oj1a5Qtm2RZoxlnIQNaieil0bbkA,27863
13
+ ssolib/testing/ephemeris_testing/2008 GX32,sha256=cDwiYq--vaBibpsSzpIlcDPkHmeYso0BkQBUjTi-sMQ,23281
14
+ ssolib/testing/ephemeris_testing/2009 BE185,sha256=BOru-vC6mUjti7JrY_HIVfGbvxz44oJgICHDW-bphJQ,32931
15
+ ssolib/testing/ephemeris_testing/2011 EY17,sha256=s7aN5ldebMKF2msd7xwE8hSBdXN-nC1jLKazF_RZLIY,25353
16
+ ssolib/testing/ephemeris_testing/2134 T-1,sha256=OijtVUrCvbQd5ipZZPWpIBcymQ_VhOmc3l3xfyqmGXk,89593
17
+ ssolib/testing/ephemeris_testing/Bellmore,sha256=O_eVM5D4sqVNfnKzaN-buG21Bh0IxLOuPsxXuej6sqQ,675365
18
+ ssolib/testing/ephemeris_testing/Dermott,sha256=VUS9GXTBkb_2FP0OofKvN4cN8KdfHoOMEMCtWd6BxyA,753551
19
+ ssolib/testing/ephemeris_testing/Duke,sha256=cl1XGmaz10J1_HiMw7syU7sf0zgLEAPDNhPQvWQQv-8,515034
20
+ ssolib/testing/ephemeris_testing/Izenberg,sha256=GiQeVNxZ9DW33wjkNNfDFHjiz5PE_dsUVaAP1QOHwmA,619661
21
+ ssolib/testing/ephemeris_testing/Lermontov,sha256=3FmYQ-4smfVpgVDNWJG3TVPAwJKzSau1_mizxkNqwIE,700054
22
+ ssolib/testing/ephemeris_testing/Poullain,sha256=_KgyYqgy01zK6Dloq7p3y06c-BzkAdYGAgkj-XdLPhs,323209
23
+ ssolib/testing/ephemeris_testing/Sonneberga,sha256=ER9ysLNa0kpGP78jM4SpHLLIbHpiDlIAXJ88eqw3gRU,700347
24
+ ssolib/testing/testing_ssoname_keys.pkl,sha256=-gnpow_I4uTpPXlF9sLcVJ2YixWp5YXJHkVHIMjtOzo,241
25
+ ssolib/utils.py,sha256=hSzzw3D22gANYxGA_bakfGsvIlJD2teMsjsVs3q6f7g,9661
26
+ asteroid_spinprops-0.2.0.dist-info/METADATA,sha256=xShRCfR-jjljdHuS6X-5aFo5IDpgDu8rqJxnquh4F44,7058
27
+ asteroid_spinprops-0.2.0.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
28
+ asteroid_spinprops-0.2.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: poetry-core 2.1.2
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,168 @@
1
+ import random
2
+ import pickle
3
+ import warnings
4
+ import numpy as np
5
+ import pandas as pd
6
+ import argparse
7
+ from functools import partial
8
+ import tqdm
9
+
10
+ from ssolib.pipetools import (
11
+ load_light_curve_data,
12
+ process_single_sso,
13
+ match_true_period,
14
+ fill_missing_periods_and_powers,
15
+ collect_rocks_periods,
16
+ )
17
+
18
+ # from line_profiler import profile
19
+ from multiprocessing import Pool
20
+
21
+ warnings.filterwarnings("ignore")
22
+
23
+
24
+ parser = argparse.ArgumentParser(
25
+ description="Process a number of SSOs in the LS pipeline."
26
+ )
27
+ parser.add_argument(
28
+ "-n",
29
+ "--num_ssos",
30
+ type=int,
31
+ default=600,
32
+ help="Number of SSOs to process (default: 600)",
33
+ )
34
+ args = parser.parse_args()
35
+
36
+ nn = [
37
+ "Agostino",
38
+ "Viktorfischl",
39
+ "Phystech",
40
+ "2001 UG32",
41
+ "1999 CH10",
42
+ "2000 OS38",
43
+ "2002 UJ29",
44
+ "2001 RA7",
45
+ ]
46
+
47
+
48
+ # @profile
49
+ def main():
50
+ ephem_path = "./../data/ephem_cache"
51
+ aggregated_path = "./../data/sso_aggregated_ATLAS_x_ztf_no_radec"
52
+
53
+ lcdf = load_light_curve_data("./../data/lc_details.csv")
54
+ with open("./../data/ssoname_keys.pkl", "rb") as f:
55
+ pqload = pickle.load(f)
56
+ path_args = [aggregated_path, pqload, ephem_path]
57
+
58
+ names_lcdb = np.unique(lcdf[lcdf["Period"] != -9.99]["Name"])
59
+
60
+ selected_indices = random.sample(range(len(names_lcdb)), args.num_ssos)
61
+
62
+ results = {
63
+ "names": [],
64
+ "periods": [],
65
+ "powers": [],
66
+ "wperiods": [],
67
+ "wpowers": [],
68
+ "npoints": [],
69
+ "noise": [],
70
+ "Nbs": [],
71
+ }
72
+
73
+ names = [names_lcdb[idx] for idx in selected_indices]
74
+ names = nn
75
+ with Pool(4) as p:
76
+ out = list(
77
+ tqdm.tqdm(
78
+ p.imap(
79
+ partial(process_single_sso, path_args=path_args),
80
+ names,
81
+ ),
82
+ total=len(names),
83
+ )
84
+ )
85
+
86
+ for res in out:
87
+ if res:
88
+ signal, window, noise, name, Nbs, npts = res
89
+ results["periods"].append(signal[2])
90
+ results["powers"].append(signal[3])
91
+ results["wperiods"].append(window[2])
92
+ results["wpowers"].append(window[3])
93
+ results["npoints"].append(npts)
94
+ results["noise"].append(noise)
95
+ results["names"].append(name)
96
+ results["Nbs"].append(Nbs)
97
+
98
+ fill_missing_periods_and_powers(results["periods"], results["powers"])
99
+ fill_missing_periods_and_powers(results["wperiods"], results["wpowers"])
100
+
101
+ ls_stats = pd.DataFrame(
102
+ {
103
+ "name": results["names"],
104
+ "npoints": results["npoints"],
105
+ "noise": results["noise"],
106
+ "Nbs": results["Nbs"],
107
+ }
108
+ )
109
+
110
+ for i in range(5):
111
+ ls_stats[f"P{i}"] = np.stack(results["periods"]).T[i]
112
+ ls_stats[f"A{i}"] = np.stack(results["powers"]).T[i]
113
+ ls_stats[f"WP{i}"] = np.stack(results["wperiods"]).T[i]
114
+ ls_stats[f"WA{i}"] = np.stack(results["wpowers"]).T[i]
115
+
116
+ ls_stats["Prock"], ls_stats["Pmethods"] = collect_rocks_periods(ls_stats["name"])
117
+
118
+ ls_stats["Prock"] = ls_stats["Prock"].apply(
119
+ lambda x: np.nan if len(x) == 0 or np.isnan(x).all() else x
120
+ )
121
+
122
+ # Convert to asteroid period (Hours) from LS frequency space (1/days)
123
+ for i in range(5):
124
+ ls_stats[f"P{i}"] = 48 / ls_stats[f"P{i}"]
125
+
126
+ try:
127
+ ls_stats["minP0"] = [
128
+ np.min(
129
+ np.abs(ls_stats["P0"].iloc[i] - ls_stats["Prock"].iloc[i])
130
+ / ls_stats["Prock"].iloc[i]
131
+ )
132
+ if not isinstance(ls_stats["Prock"].iloc[i], float)
133
+ else np.nan
134
+ for i in range(len(ls_stats))
135
+ ]
136
+ ls_stats["minP1"] = [
137
+ np.min(
138
+ np.abs(ls_stats["P1"].iloc[i] - ls_stats["Prock"].iloc[i])
139
+ / ls_stats["Prock"].iloc[i]
140
+ )
141
+ if not isinstance(ls_stats["Prock"].iloc[i], float)
142
+ else np.nan
143
+ for i in range(len(ls_stats))
144
+ ]
145
+ except Exception as e:
146
+ print("P-Prock matching issue:", e)
147
+ ls_stats["minP0"] = np.nan
148
+ ls_stats["minP1"] = np.nan
149
+
150
+ ls_stats["Ptrue"], ls_stats["Mtrue"] = match_true_period(
151
+ ls_stats["P0"], ls_stats["Prock"], ls_stats["Pmethods"]
152
+ )
153
+ ls_stats["flag"] = 0
154
+
155
+ ls_stats.loc[ls_stats["noise"] > 0.2, "flag"] = 1
156
+
157
+ mask_out_of_bounds = [
158
+ isinstance(p, float) or not np.any((p > 0.03 * 24 * 2) & (p < 2 * 24 * 2))
159
+ for p in ls_stats["Prock"]
160
+ ]
161
+ ls_stats.loc[mask_out_of_bounds, "flag"] = 2
162
+
163
+ print("Final flagging done, saving file...")
164
+ ls_stats.drop_duplicates("name").to_pickle("./../data/LS_stats_out.pkl")
165
+
166
+
167
+ if __name__ == "__main__":
168
+ main()
ssolib/__init__.py ADDED
File without changes