asteroid_spinprops 1.2.0__tar.gz → 1.2.1__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.
- {asteroid_spinprops-1.2.0 → asteroid_spinprops-1.2.1}/PKG-INFO +26 -11
- {asteroid_spinprops-1.2.0 → asteroid_spinprops-1.2.1}/README.md +25 -10
- {asteroid_spinprops-1.2.0 → asteroid_spinprops-1.2.1}/asteroid_spinprops/ssolib/modelfit.py +11 -6
- {asteroid_spinprops-1.2.0 → asteroid_spinprops-1.2.1}/asteroid_spinprops/ssolib/periodest.py +4 -3
- {asteroid_spinprops-1.2.0 → asteroid_spinprops-1.2.1}/asteroid_spinprops/ssolib/utils.py +16 -0
- {asteroid_spinprops-1.2.0 → asteroid_spinprops-1.2.1}/pyproject.toml +1 -1
- {asteroid_spinprops-1.2.0 → asteroid_spinprops-1.2.1}/asteroid_spinprops/__init__.py +0 -0
- {asteroid_spinprops-1.2.0 → asteroid_spinprops-1.2.1}/asteroid_spinprops/ssolib/__init__.py +0 -0
- {asteroid_spinprops-1.2.0 → asteroid_spinprops-1.2.1}/asteroid_spinprops/ssolib/dataprep.py +0 -0
- {asteroid_spinprops-1.2.0 → asteroid_spinprops-1.2.1}/asteroid_spinprops/ssolib/ssptools.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: asteroid_spinprops
|
|
3
|
-
Version: 1.2.
|
|
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
|
|
120
|
-
- observer-centric distance
|
|
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
|
|
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
|
-
|
|
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
|
|
|
@@ -83,13 +83,13 @@ pdf["jd_ltc"] = pdf["cjd"] - pdf["Observer_SSO_distance_column"] / c_kmday # li
|
|
|
83
83
|
|
|
84
84
|
Your input DataFrame must therefore include:
|
|
85
85
|
|
|
86
|
-
- time of observation
|
|
87
|
-
- PSF magnitude and uncertainty
|
|
88
|
-
- filter ID
|
|
89
|
-
- RA, Dec
|
|
90
|
-
- phase angle
|
|
91
|
-
- heliocentric distance
|
|
92
|
-
- observer-centric distance
|
|
86
|
+
- time of observation (JD)
|
|
87
|
+
- PSF magnitude and uncertainty
|
|
88
|
+
- filter ID
|
|
89
|
+
- RA, Dec (Degrees)
|
|
90
|
+
- phase angle
|
|
91
|
+
- heliocentric distance (AU)
|
|
92
|
+
- observer-centric distance (AU)
|
|
93
93
|
|
|
94
94
|
The preprocessing step renames these fields to the Fink schema, computes reduced magnitudes, and applies the light-time correction to the observation timestamps.
|
|
95
95
|
|
|
@@ -110,10 +110,23 @@ numeric_filter = inv + 1
|
|
|
110
110
|
pdf_s["cfid"].values[0] = numeric_filter
|
|
111
111
|
|
|
112
112
|
# --- Data cleaning and filtering ---
|
|
113
|
-
clean_data, errorbar_rejects = dataprep.errorbar_filtering(data=pdf_s, mlimit=0.7928)
|
|
113
|
+
clean_data, errorbar_rejects = dataprep.errorbar_filtering(data=pdf_s, mlimit=0.7928) # mag limit from the LCDB
|
|
114
114
|
clean_data, projection_rejects = dataprep.projection_filtering(data=clean_data)
|
|
115
115
|
clean_data, iterative_rejects = dataprep.iterative_filtering(data=clean_data)
|
|
116
116
|
|
|
117
|
+
# --- Fit SOCCA ---
|
|
118
|
+
SOCCA_params = modelfit.get_fit_params(
|
|
119
|
+
data=clean_data,
|
|
120
|
+
flavor="SOCCA",
|
|
121
|
+
shg1g2_constrained=True,
|
|
122
|
+
pole_blind=False,
|
|
123
|
+
period_blind=True,
|
|
124
|
+
period_in=None,
|
|
125
|
+
period_quality_flag=True
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
## --- Or step-by-step --- ##
|
|
117
130
|
# --- Fit SHG1G2 model ---
|
|
118
131
|
shg1g2_params = modelfit.get_fit_params(
|
|
119
132
|
data=clean_data,
|
|
@@ -139,13 +152,15 @@ _, Nbs = periodest.perform_residual_resampling(
|
|
|
139
152
|
k=int(k_val)
|
|
140
153
|
)
|
|
141
154
|
|
|
142
|
-
# --- Fit
|
|
155
|
+
# --- Fit SOCCA model ---
|
|
143
156
|
SOCCA_params = modelfit.get_fit_params(
|
|
144
157
|
data=clean_data,
|
|
145
158
|
flavor="SSHG1G2",
|
|
146
159
|
shg1g2_constrained=True,
|
|
147
|
-
|
|
160
|
+
period_blind=False,
|
|
161
|
+
pole_blind=False,
|
|
148
162
|
period_in=p_in,
|
|
163
|
+
period_quality_flag=False
|
|
149
164
|
)
|
|
150
165
|
```
|
|
151
166
|
|
|
@@ -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
|
-
|
|
200
|
+
Obs = data["cmred"].values[0][cond_ff]
|
|
198
201
|
|
|
199
|
-
all_residuals.append(
|
|
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"] =
|
|
262
|
+
SOCCA_opt["Period_class"] = 1 # True
|
|
260
263
|
else:
|
|
261
|
-
SOCCA_opt["Period_class"] =
|
|
264
|
+
SOCCA_opt["Period_class"] = 0 # Alias
|
|
262
265
|
SOCCA_opt["Nbs"] = Nbs
|
|
263
266
|
except Exception:
|
|
264
|
-
SOCCA_opt["Period_class"] =
|
|
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
|
{asteroid_spinprops-1.2.0 → asteroid_spinprops-1.2.1}/asteroid_spinprops/ssolib/periodest.py
RENAMED
|
@@ -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,
|
|
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
|
[project]
|
|
2
2
|
name = "asteroid_spinprops"
|
|
3
|
-
version = "1.2.
|
|
3
|
+
version = "1.2.1"
|
|
4
4
|
description = "Collection of tools used for fitting sHG1G2 and SOCCA photometric models to sparse asteroid photometry"
|
|
5
5
|
authors = [
|
|
6
6
|
{name = "Odysseas",email = "odysseas.xenos@proton.me"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|