asteroid_spinprops 0.2.13__tar.gz → 0.2.15__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 (28) hide show
  1. {asteroid_spinprops-0.2.13 → asteroid_spinprops-0.2.15}/PKG-INFO +1 -1
  2. {asteroid_spinprops-0.2.13 → asteroid_spinprops-0.2.15}/asteroid_spinprops/ssolib/modelfit.py +41 -17
  3. {asteroid_spinprops-0.2.13 → asteroid_spinprops-0.2.15}/asteroid_spinprops/ssolib/utils.py +53 -0
  4. {asteroid_spinprops-0.2.13 → asteroid_spinprops-0.2.15}/pyproject.toml +1 -1
  5. {asteroid_spinprops-0.2.13 → asteroid_spinprops-0.2.15}/README.md +0 -0
  6. {asteroid_spinprops-0.2.13 → asteroid_spinprops-0.2.15}/asteroid_spinprops/__init__.py +0 -0
  7. {asteroid_spinprops-0.2.13 → asteroid_spinprops-0.2.15}/asteroid_spinprops/ssolib/__init__.py +0 -0
  8. {asteroid_spinprops-0.2.13 → asteroid_spinprops-0.2.15}/asteroid_spinprops/ssolib/dataprep.py +0 -0
  9. {asteroid_spinprops-0.2.13 → asteroid_spinprops-0.2.15}/asteroid_spinprops/ssolib/periodest.py +0 -0
  10. {asteroid_spinprops-0.2.13 → asteroid_spinprops-0.2.15}/asteroid_spinprops/ssolib/pipetools.py +0 -0
  11. {asteroid_spinprops-0.2.13 → asteroid_spinprops-0.2.15}/asteroid_spinprops/ssolib/ssptools.py +0 -0
  12. {asteroid_spinprops-0.2.13 → asteroid_spinprops-0.2.15}/asteroid_spinprops/ssolib/testing/atlas_x_ztf_testing/test_pqfile_1.parquet +0 -0
  13. {asteroid_spinprops-0.2.13 → asteroid_spinprops-0.2.15}/asteroid_spinprops/ssolib/testing/atlas_x_ztf_testing/test_pqfile_2.parquet +0 -0
  14. {asteroid_spinprops-0.2.13 → asteroid_spinprops-0.2.15}/asteroid_spinprops/ssolib/testing/ephemeris_testing/2000 WL152 +0 -0
  15. {asteroid_spinprops-0.2.13 → asteroid_spinprops-0.2.15}/asteroid_spinprops/ssolib/testing/ephemeris_testing/2001 PC +0 -0
  16. {asteroid_spinprops-0.2.13 → asteroid_spinprops-0.2.15}/asteroid_spinprops/ssolib/testing/ephemeris_testing/2001 SG276 +0 -0
  17. {asteroid_spinprops-0.2.13 → asteroid_spinprops-0.2.15}/asteroid_spinprops/ssolib/testing/ephemeris_testing/2008 GX32 +0 -0
  18. {asteroid_spinprops-0.2.13 → asteroid_spinprops-0.2.15}/asteroid_spinprops/ssolib/testing/ephemeris_testing/2009 BE185 +0 -0
  19. {asteroid_spinprops-0.2.13 → asteroid_spinprops-0.2.15}/asteroid_spinprops/ssolib/testing/ephemeris_testing/2011 EY17 +0 -0
  20. {asteroid_spinprops-0.2.13 → asteroid_spinprops-0.2.15}/asteroid_spinprops/ssolib/testing/ephemeris_testing/2134 T-1 +0 -0
  21. {asteroid_spinprops-0.2.13 → asteroid_spinprops-0.2.15}/asteroid_spinprops/ssolib/testing/ephemeris_testing/Bellmore +0 -0
  22. {asteroid_spinprops-0.2.13 → asteroid_spinprops-0.2.15}/asteroid_spinprops/ssolib/testing/ephemeris_testing/Dermott +0 -0
  23. {asteroid_spinprops-0.2.13 → asteroid_spinprops-0.2.15}/asteroid_spinprops/ssolib/testing/ephemeris_testing/Duke +0 -0
  24. {asteroid_spinprops-0.2.13 → asteroid_spinprops-0.2.15}/asteroid_spinprops/ssolib/testing/ephemeris_testing/Izenberg +0 -0
  25. {asteroid_spinprops-0.2.13 → asteroid_spinprops-0.2.15}/asteroid_spinprops/ssolib/testing/ephemeris_testing/Lermontov +0 -0
  26. {asteroid_spinprops-0.2.13 → asteroid_spinprops-0.2.15}/asteroid_spinprops/ssolib/testing/ephemeris_testing/Poullain +0 -0
  27. {asteroid_spinprops-0.2.13 → asteroid_spinprops-0.2.15}/asteroid_spinprops/ssolib/testing/ephemeris_testing/Sonneberga +0 -0
  28. {asteroid_spinprops-0.2.13 → asteroid_spinprops-0.2.15}/asteroid_spinprops/ssolib/testing/testing_ssoname_keys.pkl +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: asteroid_spinprops
3
- Version: 0.2.13
3
+ Version: 0.2.15
4
4
  Summary: Collection of tools used for fitting sHG1G2 and ssHG1G2 photometric models to sparse asteroid photometry
5
5
  License: MIT
6
6
  Author: Odysseas
@@ -25,6 +25,7 @@ def get_fit_params(
25
25
  survey_filter=None,
26
26
  alt_spin=False,
27
27
  period_in=None,
28
+ terminator=False,
28
29
  ):
29
30
  if survey_filter is None:
30
31
  filter_mask = np.array(data["cfid"].values[0]) >= 0
@@ -84,11 +85,13 @@ def get_fit_params(
84
85
  )
85
86
 
86
87
  ra0, dec0 = shg1g2_params["alpha0"], shg1g2_params["delta0"]
87
- ra0alt, dec0alt = utils.flip_spin(
88
- shg1g2_params["alpha0"], shg1g2_params["delta0"]
88
+ # ra0alt, dec0alt = utils.flip_spin(
89
+ # shg1g2_params["alpha0"], shg1g2_params["delta0"]
90
+ # )
91
+ ra_init, dec_init = utils.generate_initial_points(
92
+ ra0, dec0, dec_shift=45
89
93
  )
90
-
91
- for ra, dec in zip([ra0, ra0alt], [dec0, dec0alt]):
94
+ for ra, dec in zip(ra_init, dec_init):
92
95
  for period_in in period_scan:
93
96
  p_in = [
94
97
  shg1g2_params["H_1"],
@@ -103,7 +106,11 @@ def get_fit_params(
103
106
  ] # phi 0
104
107
 
105
108
  sshg1g2 = get_fit_params(
106
- data, "SSHG1G2", shg1g2_constrained=False, p0=p_in
109
+ data,
110
+ "SSHG1G2",
111
+ shg1g2_constrained=False,
112
+ p0=p_in,
113
+ terminator=terminator,
107
114
  )
108
115
  try:
109
116
  rms.append(sshg1g2["rms"])
@@ -190,17 +197,34 @@ def get_fit_params(
190
197
  if p0 is None:
191
198
  print("Initialize SSHG1G2 first!")
192
199
  if p0 is not None:
193
- Afit = estimate_sso_params(
194
- data["cmred"].values[0][filter_mask],
195
- data["csigmapsf"].values[0][filter_mask],
196
- np.radians(data["Phase"].values[0][filter_mask]),
197
- data["cfid"].values[0][filter_mask],
198
- ra=np.radians(data["ra"].values[0][filter_mask]),
199
- dec=np.radians(data["dec"].values[0][filter_mask]),
200
- jd=data["cjd"].values[0][filter_mask],
201
- model="SSHG1G2",
202
- p0=p0,
203
- )
200
+ if terminator:
201
+ Afit = estimate_sso_params(
202
+ data["cmred"].values[0][filter_mask],
203
+ data["csigmapsf"].values[0][filter_mask],
204
+ np.radians(data["Phase"].values[0][filter_mask]),
205
+ data["cfid"].values[0][filter_mask],
206
+ ra=np.radians(data["ra"].values[0][filter_mask]),
207
+ dec=np.radians(data["dec"].values[0][filter_mask]),
208
+ jd=data["cjd"].values[0][filter_mask],
209
+ model="SSHG1G2",
210
+ p0=p0,
211
+ terminator=terminator,
212
+ ra_s=np.radians(data["ra_s"].values[0][filter_mask]),
213
+ dec_s=np.radians(data["dec_s"].values[0][filter_mask]),
214
+ )
215
+ else:
216
+ Afit = estimate_sso_params(
217
+ data["cmred"].values[0][filter_mask],
218
+ data["csigmapsf"].values[0][filter_mask],
219
+ np.radians(data["Phase"].values[0][filter_mask]),
220
+ data["cfid"].values[0][filter_mask],
221
+ ra=np.radians(data["ra"].values[0][filter_mask]),
222
+ dec=np.radians(data["dec"].values[0][filter_mask]),
223
+ jd=data["cjd"].values[0][filter_mask],
224
+ model="SSHG1G2",
225
+ p0=p0,
226
+ terminator=terminator,
227
+ )
204
228
  return Afit
205
229
  if flavor not in ["SHG1G2", "SSHG1G2"]:
206
230
  print("Model must either be SHG1G2 or SSHG1G2, not {}".format(flavor))
@@ -209,7 +233,7 @@ def get_fit_params(
209
233
  def plot_model(
210
234
  data, flavor, model_params, x_axis="Date", resolution=400, filterout=False
211
235
  ):
212
- fink_colors = ["#15284F", "#F5622E", "#3C8DFF", "#D5D5D3"]
236
+ fink_colors = ["#15284F", "#F5622E", "#0E6B77", "#4A4A4A"]
213
237
 
214
238
  jd = np.linspace(
215
239
  np.min(data["cjd"].values[0]), np.max(data["cjd"].values[0]), resolution
@@ -412,3 +412,56 @@ def read_clean_data(
412
412
 
413
413
  def oblateness(a_b, a_c):
414
414
  return 1 / 2 * a_b / a_c + 1 / 2 * 1 / a_b
415
+
416
+
417
+ def wrap_longitude(long):
418
+ """Wrap RA to [0, 360)."""
419
+ return long % 360
420
+
421
+
422
+ def wrap_latitude(lat):
423
+ """Wrap Dec to [-90, 90] by folding over the poles."""
424
+ m = (lat + 90) % 360 # shift so -90 maps to 0
425
+ if m > 180:
426
+ m = 360 - m
427
+ return m - 90
428
+
429
+
430
+ def generate_initial_points(ra, dec, dec_shift=45):
431
+ """
432
+ Generate 18 initial (RA, Dec) points
433
+
434
+ Parameters:
435
+ ra (float): base RA in degrees
436
+ dec (float): base Dec in degrees
437
+ dec_shifts (tuple): the two Dec shifts (in degrees) to try in step 2
438
+ """
439
+ if np.abs(2 * dec - dec_shift) < 10:
440
+ dec_shift += 20
441
+
442
+ ra_list = []
443
+ dec_list = []
444
+
445
+ base_coords = [(ra, dec), flip_spin(ra, dec)]
446
+
447
+ ra_sweep = [0, 120, 240]
448
+
449
+ for base_ra, base_dec in base_coords:
450
+ for offset in ra_sweep:
451
+ ra_list.append(wrap_longitude(base_ra + offset))
452
+ dec_list.append(base_dec)
453
+
454
+ dec_sweep = [-dec_shift, dec_shift]
455
+ for shift in dec_sweep:
456
+ for base_ra, base_dec in base_coords:
457
+ if (base_dec + shift > 90) | (base_dec - shift < 90):
458
+ flag = 1
459
+ else:
460
+ flag = 0
461
+ shifted_dec = wrap_latitude(base_dec + shift)
462
+
463
+ for offset in ra_sweep:
464
+ temp_ra = base_ra + (180 if flag == 1 else 0)
465
+ ra_list.append(wrap_longitude(temp_ra + offset))
466
+ dec_list.append(shifted_dec)
467
+ return ra_list, dec_list
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "asteroid_spinprops"
3
- version = "0.2.13"
3
+ version = "0.2.15"
4
4
  description = "Collection of tools used for fitting sHG1G2 and ssHG1G2 photometric models to sparse asteroid photometry"
5
5
  authors = [
6
6
  {name = "Odysseas",email = "odysseas.xenos@proton.me"}