asteroid_spinprops 1.1.1__py3-none-any.whl → 1.1.2__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.
- asteroid_spinprops/ssolib/modelfit.py +76 -69
- {asteroid_spinprops-1.1.1.dist-info → asteroid_spinprops-1.1.2.dist-info}/METADATA +1 -1
- {asteroid_spinprops-1.1.1.dist-info → asteroid_spinprops-1.1.2.dist-info}/RECORD +4 -4
- {asteroid_spinprops-1.1.1.dist-info → asteroid_spinprops-1.1.2.dist-info}/WHEEL +0 -0
|
@@ -7,16 +7,18 @@ from fink_utils.sso.spins import (
|
|
|
7
7
|
estimate_sso_params,
|
|
8
8
|
func_hg1g2_with_spin,
|
|
9
9
|
)
|
|
10
|
-
from asteroid_spinprops.ssolib.periodest import
|
|
10
|
+
from asteroid_spinprops.ssolib.periodest import (
|
|
11
|
+
get_multiterm_period_estimate,
|
|
12
|
+
)
|
|
11
13
|
|
|
12
14
|
|
|
13
15
|
def get_fit_params(
|
|
14
16
|
data,
|
|
15
17
|
flavor,
|
|
16
18
|
shg1g2_constrained=True,
|
|
17
|
-
|
|
19
|
+
period_blind=True,
|
|
20
|
+
pole_blind=True,
|
|
18
21
|
p0=None,
|
|
19
|
-
survey_filter=None,
|
|
20
22
|
alt_spin=False,
|
|
21
23
|
period_in=None,
|
|
22
24
|
terminator=False,
|
|
@@ -44,12 +46,12 @@ def get_fit_params(
|
|
|
44
46
|
Model type to fit. Must be 'SHG1G2' or 'SOCCA'.
|
|
45
47
|
shg1g2_constrained : bool, optional
|
|
46
48
|
Whether to constrain the SOCCA fit using a prior SHG1G2 solution. Default True.
|
|
47
|
-
|
|
48
|
-
If True, perform a small grid search over initial
|
|
49
|
+
period_blind : bool, optional
|
|
50
|
+
If True, perform a small grid search over initial periods. Default True.
|
|
51
|
+
pole_blind : bool, optional
|
|
52
|
+
If True, perform a grid search over initial poles. Default True.
|
|
49
53
|
p0 : list, optional
|
|
50
54
|
Initial guess parameters for the fit. Required if `shg1g2_constrained=False`.
|
|
51
|
-
survey_filter : str or None, optional
|
|
52
|
-
If 'ZTF' or 'ATLAS', only data from that survey are used. Default None uses all data.
|
|
53
55
|
alt_spin : bool, optional
|
|
54
56
|
For SOCCA constrained fits, use the antipodal spin solution. Default False.
|
|
55
57
|
period_in : float, optional
|
|
@@ -80,36 +82,26 @@ def get_fit_params(
|
|
|
80
82
|
If `flavor` is not 'SHG1G2' or 'SOCCA'.
|
|
81
83
|
"""
|
|
82
84
|
|
|
83
|
-
if survey_filter is None:
|
|
84
|
-
filter_mask = np.array(data["cfid"].values[0]) >= 0
|
|
85
|
-
if survey_filter == "ZTF":
|
|
86
|
-
filter_mask = (np.array(data["cfid"].values[0]) == 1) | (
|
|
87
|
-
np.array(data["cfid"].values[0]) == 2
|
|
88
|
-
)
|
|
89
|
-
if survey_filter == "ATLAS":
|
|
90
|
-
filter_mask = (np.array(data["cfid"].values[0]) == 3) | (
|
|
91
|
-
np.array(data["cfid"].values[0]) == 4
|
|
92
|
-
)
|
|
93
85
|
if flavor == "SHG1G2":
|
|
94
86
|
if p0 is None:
|
|
95
87
|
Afit = estimate_sso_params(
|
|
96
|
-
magpsf_red=data["cmred"].values[0]
|
|
97
|
-
sigmapsf=data["csigmapsf"].values[0]
|
|
98
|
-
phase=np.radians(data["Phase"].values[0]
|
|
99
|
-
filters=data["cfid"].values[0]
|
|
100
|
-
ra=np.radians(data["ra"].values[0]
|
|
101
|
-
dec=np.radians(data["dec"].values[0]
|
|
88
|
+
magpsf_red=data["cmred"].values[0],
|
|
89
|
+
sigmapsf=data["csigmapsf"].values[0],
|
|
90
|
+
phase=np.radians(data["Phase"].values[0]),
|
|
91
|
+
filters=data["cfid"].values[0],
|
|
92
|
+
ra=np.radians(data["ra"].values[0]),
|
|
93
|
+
dec=np.radians(data["dec"].values[0]),
|
|
102
94
|
model="SHG1G2",
|
|
103
95
|
)
|
|
104
96
|
|
|
105
97
|
if p0 is not None:
|
|
106
98
|
Afit = estimate_sso_params(
|
|
107
|
-
magpsf_red=data["cmred"].values[0]
|
|
108
|
-
sigmapsf=data["csigmapsf"].values[0]
|
|
109
|
-
phase=np.radians(data["Phase"].values[0]
|
|
110
|
-
filters=data["cfid"].values[0]
|
|
111
|
-
ra=np.radians(data["ra"].values[0]
|
|
112
|
-
dec=np.radians(data["dec"].values[0]
|
|
99
|
+
magpsf_red=data["cmred"].values[0],
|
|
100
|
+
sigmapsf=data["csigmapsf"].values[0],
|
|
101
|
+
phase=np.radians(data["Phase"].values[0]),
|
|
102
|
+
filters=data["cfid"].values[0],
|
|
103
|
+
ra=np.radians(data["ra"].values[0]),
|
|
104
|
+
dec=np.radians(data["dec"].values[0]),
|
|
113
105
|
model="SHG1G2",
|
|
114
106
|
p0=p0,
|
|
115
107
|
)
|
|
@@ -118,11 +110,15 @@ def get_fit_params(
|
|
|
118
110
|
if flavor == "SOCCA":
|
|
119
111
|
if shg1g2_constrained is True:
|
|
120
112
|
shg1g2_params = get_fit_params(
|
|
121
|
-
data=data, flavor="SHG1G2"
|
|
122
|
-
)
|
|
123
|
-
residuals_dataframe = make_residuals_df(
|
|
124
|
-
data, model_parameters=shg1g2_params
|
|
113
|
+
data=data, flavor="SHG1G2"
|
|
125
114
|
)
|
|
115
|
+
try:
|
|
116
|
+
residuals_dataframe = make_residuals_df(
|
|
117
|
+
data, model_parameters=shg1g2_params
|
|
118
|
+
)
|
|
119
|
+
except Exception:
|
|
120
|
+
SOCCA_opt = {"Failed at period search preliminary steps": 3}
|
|
121
|
+
return SOCCA_opt
|
|
126
122
|
if period_in is None:
|
|
127
123
|
# Period search boundaries (in days)
|
|
128
124
|
pmin, pmax = 5e-2, 1e4
|
|
@@ -135,17 +131,20 @@ def get_fit_params(
|
|
|
135
131
|
except KeyError:
|
|
136
132
|
# If more than 10 terms are required switch to fast rotator:
|
|
137
133
|
pmin, pmax = 5e-3, 5e-2
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
134
|
+
try:
|
|
135
|
+
p_in, k_val, p_rms, signal_peaks, window_peaks = (
|
|
136
|
+
get_multiterm_period_estimate(
|
|
137
|
+
residuals_dataframe, p_min=pmin, p_max=pmax, k_free=True
|
|
138
|
+
)
|
|
142
139
|
)
|
|
143
|
-
|
|
140
|
+
except Exception:
|
|
141
|
+
SOCCA_opt = {"Failed at period search after": 4}
|
|
142
|
+
return SOCCA_opt
|
|
144
143
|
period_sy = p_in
|
|
145
144
|
else:
|
|
146
145
|
period_sy = period_in
|
|
147
146
|
|
|
148
|
-
if
|
|
147
|
+
if period_blind is True:
|
|
149
148
|
rms = []
|
|
150
149
|
model = []
|
|
151
150
|
|
|
@@ -154,10 +153,16 @@ def get_fit_params(
|
|
|
154
153
|
)
|
|
155
154
|
|
|
156
155
|
ra0, dec0 = shg1g2_params["alpha0"], shg1g2_params["delta0"]
|
|
156
|
+
|
|
157
|
+
if pole_blind is True:
|
|
158
|
+
ra_init, dec_init = utils.generate_initial_points(
|
|
159
|
+
ra0, dec0, dec_shift=45
|
|
160
|
+
)
|
|
157
161
|
|
|
158
|
-
|
|
159
|
-
ra0, dec0
|
|
160
|
-
|
|
162
|
+
else:
|
|
163
|
+
ra0_antipodal, dec0_antipodal = utils.flip_spin(ra0, dec0)
|
|
164
|
+
ra_init = [ra0, ra0_antipodal]
|
|
165
|
+
dec_init = [dec0, dec0_antipodal]
|
|
161
166
|
|
|
162
167
|
H_key = next(
|
|
163
168
|
(f"H_{i}" for i in range(1, 7) if f"H_{i}" in shg1g2_params),
|
|
@@ -190,9 +195,11 @@ def get_fit_params(
|
|
|
190
195
|
model.append(SOCCA)
|
|
191
196
|
except Exception:
|
|
192
197
|
continue
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
198
|
+
try:
|
|
199
|
+
rms = np.array(rms)
|
|
200
|
+
SOCCA_opt = model[rms.argmin()]
|
|
201
|
+
except Exception:
|
|
202
|
+
SOCCA_opt = {"Failed at SOCCA inversion": 5}
|
|
196
203
|
return SOCCA_opt
|
|
197
204
|
else:
|
|
198
205
|
period_si_t, alt_period_si_t, _ = utils.estimate_sidereal_period(
|
|
@@ -254,14 +261,14 @@ def get_fit_params(
|
|
|
254
261
|
|
|
255
262
|
# Constrained Fit
|
|
256
263
|
Afit = estimate_sso_params(
|
|
257
|
-
data["cmred"].values[0]
|
|
258
|
-
data["csigmapsf"].values[0]
|
|
259
|
-
np.radians(data["Phase"].values[0]
|
|
260
|
-
data["cfid"].values[0]
|
|
261
|
-
ra=np.radians(data["ra"].values[0]
|
|
262
|
-
dec=np.radians(data["dec"].values[0]
|
|
263
|
-
jd=data["cjd"].values[0]
|
|
264
|
-
model="SSHG1G2",
|
|
264
|
+
data["cmred"].values[0],
|
|
265
|
+
data["csigmapsf"].values[0],
|
|
266
|
+
np.radians(data["Phase"].values[0]),
|
|
267
|
+
data["cfid"].values[0],
|
|
268
|
+
ra=np.radians(data["ra"].values[0]),
|
|
269
|
+
dec=np.radians(data["dec"].values[0]),
|
|
270
|
+
jd=data["cjd"].values[0],
|
|
271
|
+
model="SSHG1G2", # We should call this SOCCA
|
|
265
272
|
p0=p0,
|
|
266
273
|
)
|
|
267
274
|
return Afit
|
|
@@ -272,28 +279,28 @@ def get_fit_params(
|
|
|
272
279
|
if p0 is not None:
|
|
273
280
|
if terminator:
|
|
274
281
|
Afit = estimate_sso_params(
|
|
275
|
-
data["cmred"].values[0]
|
|
276
|
-
data["csigmapsf"].values[0]
|
|
277
|
-
np.radians(data["Phase"].values[0]
|
|
278
|
-
data["cfid"].values[0]
|
|
279
|
-
ra=np.radians(data["ra"].values[0]
|
|
280
|
-
dec=np.radians(data["dec"].values[0]
|
|
281
|
-
jd=data["cjd"].values[0]
|
|
282
|
+
data["cmred"].values[0],
|
|
283
|
+
data["csigmapsf"].values[0],
|
|
284
|
+
np.radians(data["Phase"].values[0]),
|
|
285
|
+
data["cfid"].values[0],
|
|
286
|
+
ra=np.radians(data["ra"].values[0]),
|
|
287
|
+
dec=np.radians(data["dec"].values[0]),
|
|
288
|
+
jd=data["cjd"].values[0],
|
|
282
289
|
model="SSHG1G2",
|
|
283
290
|
p0=p0,
|
|
284
291
|
terminator=terminator,
|
|
285
|
-
ra_s=np.radians(data["ra_s"].values[0]
|
|
286
|
-
dec_s=np.radians(data["dec_s"].values[0]
|
|
292
|
+
ra_s=np.radians(data["ra_s"].values[0]),
|
|
293
|
+
dec_s=np.radians(data["dec_s"].values[0]),
|
|
287
294
|
)
|
|
288
295
|
else:
|
|
289
296
|
Afit = estimate_sso_params(
|
|
290
|
-
data["cmred"].values[0]
|
|
291
|
-
data["csigmapsf"].values[0]
|
|
292
|
-
np.radians(data["Phase"].values[0]
|
|
293
|
-
data["cfid"].values[0]
|
|
294
|
-
ra=np.radians(data["ra"].values[0]
|
|
295
|
-
dec=np.radians(data["dec"].values[0]
|
|
296
|
-
jd=data["cjd"].values[0]
|
|
297
|
+
data["cmred"].values[0],
|
|
298
|
+
data["csigmapsf"].values[0],
|
|
299
|
+
np.radians(data["Phase"].values[0]),
|
|
300
|
+
data["cfid"].values[0],
|
|
301
|
+
ra=np.radians(data["ra"].values[0]),
|
|
302
|
+
dec=np.radians(data["dec"].values[0]),
|
|
303
|
+
jd=data["cjd"].values[0],
|
|
297
304
|
model="SSHG1G2",
|
|
298
305
|
p0=p0,
|
|
299
306
|
terminator=terminator,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
asteroid_spinprops/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
asteroid_spinprops/ssolib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
3
|
asteroid_spinprops/ssolib/dataprep.py,sha256=7PfkVNpLjPERkhr8dZQfN8haFCFmoeXB3fWuTSBLVuc,7848
|
|
4
|
-
asteroid_spinprops/ssolib/modelfit.py,sha256=
|
|
4
|
+
asteroid_spinprops/ssolib/modelfit.py,sha256=CM2fc_OKPrajK3Dadiny4JEkY1KuwCXqoarTx8SnYpM,16473
|
|
5
5
|
asteroid_spinprops/ssolib/periodest.py,sha256=kDWEB0fPRd5paqxNjJmigsocrAd4rydYLwxNh5sMV2U,13216
|
|
6
6
|
asteroid_spinprops/ssolib/ssptools.py,sha256=DlSgYtXenztRAtEV9d4itzp5OZMjkbXkW2yZ_Qumu4U,4490
|
|
7
7
|
asteroid_spinprops/ssolib/utils.py,sha256=BUeIP0DZ45tg5qAQML8LBM8Gbj1vn2d3PGzvgQvfq_I,11094
|
|
8
|
-
asteroid_spinprops-1.1.
|
|
9
|
-
asteroid_spinprops-1.1.
|
|
10
|
-
asteroid_spinprops-1.1.
|
|
8
|
+
asteroid_spinprops-1.1.2.dist-info/METADATA,sha256=Ea_ijdxK1WerLh0BSULWUQp3sn054ghbk35Chg_Ggz4,5635
|
|
9
|
+
asteroid_spinprops-1.1.2.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
10
|
+
asteroid_spinprops-1.1.2.dist-info/RECORD,,
|
|
File without changes
|