asteroid_spinprops 1.2.0__py3-none-any.whl → 1.2.1__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.
@@ -51,13 +51,16 @@ def get_fit_params(
51
51
  period_blind : bool, optional
52
52
  If True, perform a small grid search over initial periods. Default True.
53
53
  pole_blind : bool, optional
54
- If True, perform a grid search over initial poles. Default True.
54
+ If True, perform a grid search over 12 initial poles all over a sphere. Default True.
55
+ If False, produce the sHG1G2 rms error landscape and initialize SOCCA poles on its local minima
55
56
  p0 : list, optional
56
57
  Initial guess parameters for the fit. Required if `shg1g2_constrained=False`.
57
58
  alt_spin : bool, optional
58
59
  For SOCCA constrained fits, use the antipodal spin solution. Default False.
59
60
  period_in : float, optional
60
61
  Input synodic period (days) to override automatic estimation. Default None.
62
+ period_quality_flag : bool, optional
63
+ Provide bootstrap score, alias/true (0/1) flags and period fit rms for the period estimates
61
64
  terminator : bool, optional
62
65
  If True, include self-shading in the fit. Default False.
63
66
 
@@ -194,9 +197,9 @@ def get_fit_params(
194
197
  C = func_hg1g2_with_spin(pha, H, G1, G2, R,
195
198
  np.radians(ra0), np.radians(dec0))
196
199
 
197
- O = data["cmred"].values[0][cond_ff]
200
+ Obs = data["cmred"].values[0][cond_ff]
198
201
 
199
- all_residuals.append(O - C)
202
+ all_residuals.append(Obs - C)
200
203
 
201
204
  all_residuals = np.concatenate(all_residuals)
202
205
  rms_landscape[j, i] = np.sqrt(np.mean(all_residuals**2))
@@ -256,12 +259,14 @@ def get_fit_params(
256
259
  )
257
260
  alias_flag = (DeltaF1 - y_trumpet) * 100
258
261
  if alias_flag < 1:
259
- SOCCA_opt["Period_class"] = "true"
262
+ SOCCA_opt["Period_class"] = 1 # True
260
263
  else:
261
- SOCCA_opt["Period_class"] = "alias"
264
+ SOCCA_opt["Period_class"] = 0 # Alias
262
265
  SOCCA_opt["Nbs"] = Nbs
263
266
  except Exception:
264
- SOCCA_opt["Period_class"] = "class_error"
267
+ SOCCA_opt["Period_class"] = -1 # Classification error
268
+ SOCCA_opt["prms"] = p_rms
269
+ SOCCA_opt["k_terms"] = k_val
265
270
  except Exception:
266
271
  SOCCA_opt = {"Failed at SOCCA inversion": 5}
267
272
  return SOCCA_opt
@@ -123,7 +123,7 @@ def get_period_estimate(residuals_dataframe, p_min=0.03, p_max=2):
123
123
 
124
124
 
125
125
  def get_multiterm_period_estimate(
126
- residuals_dataframe, p_min=0.03, p_max=2, k_free=True, k_val=None
126
+ residuals_dataframe, p_min=0.03, p_max=2, k_free=True, k_val=None, k_max=4
127
127
  ):
128
128
  """
129
129
  Estimate the period of a multiband time series using a multiband Lomb-Scargle model.
@@ -148,7 +148,8 @@ def get_multiterm_period_estimate(
148
148
  If True, automatically scan multiple base-term complexities to choose optimal model. Default True.
149
149
  k_val : int, optional
150
150
  Fixed number of base terms to use if `k_free=False`. Default None.
151
-
151
+ k_max : int
152
+ Maximum number of terms to use for the multiterm LS periodogram. Default 4
152
153
  Returns
153
154
  -------
154
155
  tuple
@@ -175,7 +176,7 @@ def get_multiterm_period_estimate(
175
176
  residuals = np.zeros(len(residuals_dataframe["filters"].values))
176
177
  bands = np.unique(residuals_dataframe["filters"].values)
177
178
  if k_free:
178
- for k in range(1, 11):
179
+ for k in range(1, k_max + 1):
179
180
  model = LombScargleMultiband(
180
181
  residuals_dataframe["jd"].values,
181
182
  residuals_dataframe["residuals"].values,
@@ -459,6 +459,22 @@ def detect_local_minima(arr):
459
459
  return np.where(detected_minima)
460
460
 
461
461
  def trumpet(peak_diff_1, f_feat, f_obs):
462
+ """
463
+ Implementation of the alias/true flagging algorithm.
464
+
465
+ Parameters
466
+ ----------
467
+ peak_diff_1 : float
468
+ The difference between the 2nd and 3rd highest peaks of the periodogram
469
+ f_feat : float
470
+ The feature frequency.
471
+ f_obs : float
472
+ The 1st highest peak if the periodogram
473
+ Returns
474
+ -------
475
+ The assumed true frequency peak difference value if the peak is true,
476
+ otherwise zero.
477
+ """
462
478
  if peak_diff_1 > 0 and f_obs > f_feat:
463
479
  return 2 * f_feat
464
480
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: asteroid_spinprops
3
- Version: 1.2.0
3
+ Version: 1.2.1
4
4
  Summary: Collection of tools used for fitting sHG1G2 and SOCCA photometric models to sparse asteroid photometry
5
5
  License: MIT
6
6
  Author: Odysseas
@@ -111,13 +111,13 @@ pdf["jd_ltc"] = pdf["cjd"] - pdf["Observer_SSO_distance_column"] / c_kmday # li
111
111
 
112
112
  Your input DataFrame must therefore include:
113
113
 
114
- - time of observation
115
- - PSF magnitude and uncertainty
116
- - filter ID
117
- - RA, Dec
118
- - phase angle
119
- - heliocentric distance (`Obj_Sun_LTC_km`)
120
- - observer-centric distance (`Range_LTC_km`)
114
+ - time of observation (JD)
115
+ - PSF magnitude and uncertainty
116
+ - filter ID
117
+ - RA, Dec (Degrees)
118
+ - phase angle
119
+ - heliocentric distance (AU)
120
+ - observer-centric distance (AU)
121
121
 
122
122
  The preprocessing step renames these fields to the Fink schema, computes reduced magnitudes, and applies the light-time correction to the observation timestamps.
123
123
 
@@ -138,10 +138,23 @@ numeric_filter = inv + 1
138
138
  pdf_s["cfid"].values[0] = numeric_filter
139
139
 
140
140
  # --- Data cleaning and filtering ---
141
- clean_data, errorbar_rejects = dataprep.errorbar_filtering(data=pdf_s, mlimit=0.7928)
141
+ clean_data, errorbar_rejects = dataprep.errorbar_filtering(data=pdf_s, mlimit=0.7928) # mag limit from the LCDB
142
142
  clean_data, projection_rejects = dataprep.projection_filtering(data=clean_data)
143
143
  clean_data, iterative_rejects = dataprep.iterative_filtering(data=clean_data)
144
144
 
145
+ # --- Fit SOCCA ---
146
+ SOCCA_params = modelfit.get_fit_params(
147
+ data=clean_data,
148
+ flavor="SOCCA",
149
+ shg1g2_constrained=True,
150
+ pole_blind=False,
151
+ period_blind=True,
152
+ period_in=None,
153
+ period_quality_flag=True
154
+ )
155
+
156
+
157
+ ## --- Or step-by-step --- ##
145
158
  # --- Fit SHG1G2 model ---
146
159
  shg1g2_params = modelfit.get_fit_params(
147
160
  data=clean_data,
@@ -167,13 +180,15 @@ _, Nbs = periodest.perform_residual_resampling(
167
180
  k=int(k_val)
168
181
  )
169
182
 
170
- # --- Fit SSHG1G2 (spin + multiband) model ---
183
+ # --- Fit SOCCA model ---
171
184
  SOCCA_params = modelfit.get_fit_params(
172
185
  data=clean_data,
173
186
  flavor="SSHG1G2",
174
187
  shg1g2_constrained=True,
175
- blind_scan=True,
188
+ period_blind=False,
189
+ pole_blind=False,
176
190
  period_in=p_in,
191
+ period_quality_flag=False
177
192
  )
178
193
  ```
179
194
 
@@ -0,0 +1,10 @@
1
+ asteroid_spinprops/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ asteroid_spinprops/ssolib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ asteroid_spinprops/ssolib/dataprep.py,sha256=7PfkVNpLjPERkhr8dZQfN8haFCFmoeXB3fWuTSBLVuc,7848
4
+ asteroid_spinprops/ssolib/modelfit.py,sha256=DIp033AxpLKwFQRrRPnnFv3nHWiZ06YsfBnMv94ANvo,20084
5
+ asteroid_spinprops/ssolib/periodest.py,sha256=iql2HhpxN6dFwRmNchomv2m4M_JPULNrHLz5fvc5zYY,13330
6
+ asteroid_spinprops/ssolib/ssptools.py,sha256=DlSgYtXenztRAtEV9d4itzp5OZMjkbXkW2yZ_Qumu4U,4490
7
+ asteroid_spinprops/ssolib/utils.py,sha256=Na0EAgCCeBrvY3-KwfU7PuaoDGLjw5jGP9oi19lY490,13344
8
+ asteroid_spinprops-1.2.1.dist-info/METADATA,sha256=0Zt7MUH5q6uCMKlAOAkK6I7b1_wFKIsV1Qk7Cw4u0_c,6143
9
+ asteroid_spinprops-1.2.1.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
10
+ asteroid_spinprops-1.2.1.dist-info/RECORD,,
@@ -1,10 +0,0 @@
1
- asteroid_spinprops/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- asteroid_spinprops/ssolib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- asteroid_spinprops/ssolib/dataprep.py,sha256=7PfkVNpLjPERkhr8dZQfN8haFCFmoeXB3fWuTSBLVuc,7848
4
- asteroid_spinprops/ssolib/modelfit.py,sha256=-EA0Ha0fUh9CPqqh_f9kuoZWTVmSP-XMITUHJ3OsCy4,19698
5
- asteroid_spinprops/ssolib/periodest.py,sha256=kDWEB0fPRd5paqxNjJmigsocrAd4rydYLwxNh5sMV2U,13216
6
- asteroid_spinprops/ssolib/ssptools.py,sha256=DlSgYtXenztRAtEV9d4itzp5OZMjkbXkW2yZ_Qumu4U,4490
7
- asteroid_spinprops/ssolib/utils.py,sha256=Cv1TYSaUsWLbeQyrdqou6YnrPv4VijDP6GB9HAXtzKA,12902
8
- asteroid_spinprops-1.2.0.dist-info/METADATA,sha256=6j5gC6L3ptLRtFfAQIDUQfuY5y6LmLGOiao0VsMdi48,5635
9
- asteroid_spinprops-1.2.0.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
10
- asteroid_spinprops-1.2.0.dist-info/RECORD,,