exovetter 0.0.7__py3-none-any.whl → 0.0.8__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.
- exovetter/centroid/centroid.py +82 -15
- exovetter/centroid/disp.py +3 -3
- exovetter/version.py +1 -1
- exovetter/vetters.py +9 -4
- {exovetter-0.0.7.dist-info → exovetter-0.0.8.dist-info}/METADATA +1 -1
- {exovetter-0.0.7.dist-info → exovetter-0.0.8.dist-info}/RECORD +9 -9
- {exovetter-0.0.7.dist-info → exovetter-0.0.8.dist-info}/LICENSE.rst +0 -0
- {exovetter-0.0.7.dist-info → exovetter-0.0.8.dist-info}/WHEEL +0 -0
- {exovetter-0.0.7.dist-info → exovetter-0.0.8.dist-info}/top_level.txt +0 -0
exovetter/centroid/centroid.py
CHANGED
|
@@ -14,6 +14,7 @@ def compute_diff_image_centroids(
|
|
|
14
14
|
duration_days,
|
|
15
15
|
remove_transits,
|
|
16
16
|
max_oot_shift_pix=1.5,
|
|
17
|
+
starloc_pix = None,
|
|
17
18
|
plot=False
|
|
18
19
|
):
|
|
19
20
|
"""Compute difference image centroid shifts for every transit in a dataset.
|
|
@@ -42,6 +43,9 @@ def compute_diff_image_centroids(
|
|
|
42
43
|
(float) Duration of transit.
|
|
43
44
|
remove_transits
|
|
44
45
|
(list) List of 0 indexed transit integers to not calculate on.
|
|
46
|
+
starloc_pix
|
|
47
|
+
(2d array) catalog location of target star for plotting.
|
|
48
|
+
Default is None.
|
|
45
49
|
max_oot_shift_pix
|
|
46
50
|
(float) Passed to `fastpsffit.fastGaussianPrfFit()
|
|
47
51
|
|
|
@@ -74,29 +78,30 @@ def compute_diff_image_centroids(
|
|
|
74
78
|
transits = getIngressEgressCadences(
|
|
75
79
|
time, period_days, epoch, duration_days)
|
|
76
80
|
|
|
77
|
-
|
|
81
|
+
axs = []
|
|
78
82
|
centroids = []
|
|
79
83
|
|
|
80
84
|
for i in range(len(transits)):
|
|
81
85
|
if i not in remove_transits:
|
|
82
86
|
cin = transits[i]
|
|
83
|
-
cents,
|
|
87
|
+
cents, ax = measure_centroids(
|
|
84
88
|
cube,
|
|
85
89
|
cin,
|
|
86
90
|
max_oot_shift_pix=max_oot_shift_pix,
|
|
91
|
+
starloc_pix = starloc_pix,
|
|
87
92
|
plot=plot
|
|
88
93
|
)
|
|
89
94
|
|
|
90
95
|
if plot == True:
|
|
91
|
-
|
|
96
|
+
plt.gcf().suptitle('Transit '+str(i))
|
|
92
97
|
|
|
93
98
|
centroids.append(cents)
|
|
94
|
-
|
|
99
|
+
axs.append(ax)
|
|
95
100
|
|
|
96
101
|
centroids = np.array(centroids)
|
|
97
102
|
all_transits = list(np.arange(len(transits)))
|
|
98
103
|
kept_transits = [x for x in all_transits if x not in remove_transits]
|
|
99
|
-
return centroids,
|
|
104
|
+
return centroids, axs, kept_transits
|
|
100
105
|
|
|
101
106
|
|
|
102
107
|
def measure_centroid_shift(centroids, kept_transits, plot=False):
|
|
@@ -140,6 +145,51 @@ def measure_centroid_shift(centroids, kept_transits, plot=False):
|
|
|
140
145
|
fig = covar.diagnostic_plot(dcol, drow, kept_transits, flags)
|
|
141
146
|
return offset_pix, signif, fig
|
|
142
147
|
|
|
148
|
+
def measure_centroid_shift_cat(centroids, kept_transits, starloc_pix, plot=False):
|
|
149
|
+
"""Measure the average offset of the DIC centroids from the catalog position.
|
|
150
|
+
|
|
151
|
+
Inputs
|
|
152
|
+
----------
|
|
153
|
+
centroids
|
|
154
|
+
(2d np array) Output of :func:`compute_diff_image_centroids`
|
|
155
|
+
|
|
156
|
+
kept_transits
|
|
157
|
+
(list) List of 0 indexed transit integers to calculate on.
|
|
158
|
+
|
|
159
|
+
starloc_pix
|
|
160
|
+
(2d np array) col,row expected location of target star
|
|
161
|
+
|
|
162
|
+
Returns
|
|
163
|
+
-----------
|
|
164
|
+
offset
|
|
165
|
+
(float) Size of offset in pixels (or whatever unit `centroids`
|
|
166
|
+
is in)
|
|
167
|
+
signif
|
|
168
|
+
(float) The statistical significance of the transit. Values
|
|
169
|
+
close to 1 mean the transit is likely on the target star.
|
|
170
|
+
Values less than ~1e-3 suggest the target is not the
|
|
171
|
+
source of the transit.
|
|
172
|
+
fig
|
|
173
|
+
A figure handle. Is **None** if plot is **False**
|
|
174
|
+
"""
|
|
175
|
+
|
|
176
|
+
# DIC - catalog
|
|
177
|
+
# dcol = centroids[:, 5] - centroids[:, 0]
|
|
178
|
+
# drow = centroids[:, 4] - centroids[:, 1]
|
|
179
|
+
dcol = centroids[:, 4] - starloc_pix[0]
|
|
180
|
+
drow = centroids[:, 5] - starloc_pix[1]
|
|
181
|
+
|
|
182
|
+
flags = centroids[:, -1].astype(bool)
|
|
183
|
+
|
|
184
|
+
offset_pix, signif = covar.compute_offset_and_signif(
|
|
185
|
+
dcol[~flags], drow[~flags])
|
|
186
|
+
|
|
187
|
+
fig = None
|
|
188
|
+
if plot:
|
|
189
|
+
fig = covar.diagnostic_plot(dcol, drow, kept_transits, flags)
|
|
190
|
+
|
|
191
|
+
return offset_pix, signif, fig
|
|
192
|
+
|
|
143
193
|
|
|
144
194
|
def getIngressEgressCadences(time, period_days, epoch_btjd, duration_days):
|
|
145
195
|
assert np.all(np.isfinite(time))
|
|
@@ -151,7 +201,7 @@ def getIngressEgressCadences(time, period_days, epoch_btjd, duration_days):
|
|
|
151
201
|
return transits
|
|
152
202
|
|
|
153
203
|
|
|
154
|
-
def measure_centroids(cube, cin, max_oot_shift_pix=0.5, plot=False):
|
|
204
|
+
def measure_centroids(cube, cin, max_oot_shift_pix=0.5, starloc_pix = None, plot=False):
|
|
155
205
|
"""Private function of :func:`compute_diff_image_centroids`
|
|
156
206
|
|
|
157
207
|
Computes OOT, ITR and diff images for a single transit event,
|
|
@@ -209,17 +259,31 @@ def measure_centroids(cube, cin, max_oot_shift_pix=0.5, plot=False):
|
|
|
209
259
|
if diffSoln.success:
|
|
210
260
|
clr = "green"
|
|
211
261
|
|
|
262
|
+
fig = plt.gcf()
|
|
263
|
+
axlist = fig.axes
|
|
264
|
+
#assert len(axlist) == 3, axlist
|
|
265
|
+
|
|
212
266
|
res = diffSoln.x
|
|
213
|
-
|
|
214
|
-
|
|
267
|
+
for ax in axlist:
|
|
268
|
+
if ax.get_label() == '<colorbar>':
|
|
269
|
+
continue
|
|
270
|
+
|
|
271
|
+
plt.sca(ax)
|
|
272
|
+
disp.plotCentroidLocation(res[0], res[1], marker="^", color=clr,
|
|
273
|
+
label="diff")
|
|
215
274
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
275
|
+
res1 = ootSoln.x
|
|
276
|
+
disp.plotCentroidLocation(res1[0], res1[1], marker="o", color=clr,
|
|
277
|
+
label="OOT")
|
|
219
278
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
279
|
+
res2 = intransSoln.x
|
|
280
|
+
disp.plotCentroidLocation(res2[0], res2[1], marker="+", color=clr,
|
|
281
|
+
label="InT")
|
|
282
|
+
|
|
283
|
+
if starloc_pix is not None:
|
|
284
|
+
disp.plotCentroidLocation(starloc_pix[0], starloc_pix[1], marker="*",
|
|
285
|
+
color='red', label="Cat", ms=10)
|
|
286
|
+
|
|
223
287
|
plt.legend(fontsize=12, framealpha=0.7, facecolor='silver')
|
|
224
288
|
|
|
225
289
|
out = []
|
|
@@ -236,7 +300,7 @@ def measure_centroids(cube, cin, max_oot_shift_pix=0.5, plot=False):
|
|
|
236
300
|
return out, ax
|
|
237
301
|
|
|
238
302
|
|
|
239
|
-
def generateDiffImg(cube, transits, plot=False):
|
|
303
|
+
def generateDiffImg(cube, transits, starloc_pix = None, plot=False):
|
|
240
304
|
"""Generate a difference image.
|
|
241
305
|
|
|
242
306
|
Also generates an image for each the $n$ cadedences before
|
|
@@ -249,6 +313,8 @@ def generateDiffImg(cube, transits, plot=False):
|
|
|
249
313
|
(np 3 array) Datacube of postage stamps
|
|
250
314
|
transits
|
|
251
315
|
(2-tuples) Indices of the first and last cadence
|
|
316
|
+
starloc_pix
|
|
317
|
+
(np 2 element array) col, row position of star
|
|
252
318
|
|
|
253
319
|
Optional Inputs
|
|
254
320
|
-----------------
|
|
@@ -286,6 +352,7 @@ def generateDiffImg(cube, transits, plot=False):
|
|
|
286
352
|
fig = plt.figure()
|
|
287
353
|
fig.set_size_inches(16, 4)
|
|
288
354
|
disp.plotTransit(fig, oot, during, diff)
|
|
355
|
+
|
|
289
356
|
else:
|
|
290
357
|
fig = None
|
|
291
358
|
|
exovetter/centroid/disp.py
CHANGED
|
@@ -8,15 +8,15 @@ import numpy as np
|
|
|
8
8
|
|
|
9
9
|
def plotTransit(fig, oot, during, diff, **kwargs):
|
|
10
10
|
|
|
11
|
-
fig.add_subplot(131)
|
|
11
|
+
ax1 = fig.add_subplot(131)
|
|
12
12
|
plotImage(oot, **kwargs)
|
|
13
13
|
plt.title("OOT")
|
|
14
14
|
|
|
15
|
-
fig.add_subplot(132)
|
|
15
|
+
ax2 = fig.add_subplot(132)
|
|
16
16
|
plotImage(during, **kwargs)
|
|
17
17
|
plt.title("In-transit")
|
|
18
18
|
|
|
19
|
-
fig.add_subplot(133)
|
|
19
|
+
ax3 = fig.add_subplot(133)
|
|
20
20
|
plotDiffImage(diff, **kwargs)
|
|
21
21
|
plt.title("Difference")
|
|
22
22
|
|
exovetter/version.py
CHANGED
exovetter/vetters.py
CHANGED
|
@@ -585,7 +585,7 @@ class Sweet(BaseVetter):
|
|
|
585
585
|
class Centroid(BaseVetter):
|
|
586
586
|
"""Class to handle centroid vetting"""
|
|
587
587
|
|
|
588
|
-
def __init__(self, lc_name="flux", diff_plots=False, centroid_plots=False):
|
|
588
|
+
def __init__(self, lc_name="flux", diff_plots=False, centroid_plots=False, starloc_pix=None):
|
|
589
589
|
"""
|
|
590
590
|
Parameters
|
|
591
591
|
----------
|
|
@@ -616,6 +616,7 @@ class Centroid(BaseVetter):
|
|
|
616
616
|
self.metrics = None
|
|
617
617
|
self.diff_plots = diff_plots
|
|
618
618
|
self.centroid_plots = centroid_plots
|
|
619
|
+
self.starloc_pix = starloc_pix
|
|
619
620
|
|
|
620
621
|
def run(self, tce, lk_tpf, plot=False, remove_transits=None):
|
|
621
622
|
"""Runs cent.compute_diff_image_centroids and cent.measure_centroid_shift
|
|
@@ -665,12 +666,16 @@ class Centroid(BaseVetter):
|
|
|
665
666
|
|
|
666
667
|
if remove_transits is None: # reformat to be a blank list
|
|
667
668
|
remove_transits = []
|
|
668
|
-
|
|
669
|
+
|
|
669
670
|
centroids, figs, kept_transits = cent.compute_diff_image_centroids(
|
|
670
671
|
time, cube, period_days, epoch, duration_days,
|
|
671
|
-
remove_transits, plot=self.diff_plots)
|
|
672
|
+
remove_transits, starloc_pix=self.starloc_pix, plot=self.diff_plots)
|
|
672
673
|
|
|
673
|
-
|
|
674
|
+
if (self.starloc_pix is not None) and (len(self.starloc_pix) == 2):
|
|
675
|
+
offset, signif, fig = cent.measure_centroid_shift_cat(centroids, kept_transits, self.starloc_pix, self.centroid_plots)
|
|
676
|
+
else:
|
|
677
|
+
offset, signif, fig = cent.measure_centroid_shift(centroids, kept_transits, self.centroid_plots)
|
|
678
|
+
|
|
674
679
|
figs.append(fig)
|
|
675
680
|
|
|
676
681
|
# TODO: If plot=True, figs is a list of figure handles.
|
|
@@ -10,19 +10,19 @@ exovetter/tce.py,sha256=5JFKkbKoKCtdhm5EuW6FMAvp0LiaHLuqpFUbY0joyLI,7302
|
|
|
10
10
|
exovetter/transit_coverage.py,sha256=Wix6TaQmEgRxlEZKB6WF3OFQVXqtJN1tBkltFaMDrHM,2194
|
|
11
11
|
exovetter/trapezoid_fit.py,sha256=Dok-H0zRsfigh4zfVO4R6Wi2TgK6hQXh4EIIYGouxiQ,31097
|
|
12
12
|
exovetter/utils.py,sha256=1K34N6sQ7iomf4oFHyqGubcDhNwTa2lF_uKEOGJGrCk,24909
|
|
13
|
-
exovetter/version.py,sha256=
|
|
14
|
-
exovetter/vetters.py,sha256=
|
|
13
|
+
exovetter/version.py,sha256=CNeb6A0ENE0jLt2wd0GA-qc99gr3KYBjtMQVwKtJGN0,337
|
|
14
|
+
exovetter/vetters.py,sha256=muqjSzFRs5gCrOV1OAjnTd2y7y_dU9hWJfKpqUK_9RY,37732
|
|
15
15
|
exovetter/viz_transits.py,sha256=FUc8DEedaQQ8YDoeVvR1QyGPmh2oPGmVg27W3WrVguQ,5648
|
|
16
16
|
exovetter/centroid/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
17
|
-
exovetter/centroid/centroid.py,sha256=
|
|
17
|
+
exovetter/centroid/centroid.py,sha256=tNT1ZEQqN1t1Sijn9hJYjGQYCnguVE9iJp2MlL-vWN8,10785
|
|
18
18
|
exovetter/centroid/covar.py,sha256=suSgPjOVVEOclIi7rnhqc7wBbcSVsPOrdad91NXjX3Y,8973
|
|
19
|
-
exovetter/centroid/disp.py,sha256=
|
|
19
|
+
exovetter/centroid/disp.py,sha256=Y7UeecpHuhzEyNb6F6_FoureXdIttongS_L4jbdNYgE,3692
|
|
20
20
|
exovetter/centroid/fastpsffit.py,sha256=eRMxYUJ_4hsCxso4u1d1zQvFSJQlJ_gRzhNa2PXkKuE,4532
|
|
21
21
|
exovetter/modshift/__init__.py,sha256=j5665q0RHVzbzdPBXv_jUozGB4sex8ANXtzB41EYzRQ,68
|
|
22
22
|
exovetter/modshift/modshift.py,sha256=VEnj7ITvYRfqICyRiNeCZ9tqQ4d4fPOw8avB6TTbhIU,14773
|
|
23
23
|
exovetter/modshift/plotmodshift.py,sha256=MMLkvxkOqBGIYGPN97_WtrHgTZsDzY_XRRNswhz5YQI,2452
|
|
24
|
-
exovetter-0.0.
|
|
25
|
-
exovetter-0.0.
|
|
26
|
-
exovetter-0.0.
|
|
27
|
-
exovetter-0.0.
|
|
28
|
-
exovetter-0.0.
|
|
24
|
+
exovetter-0.0.8.dist-info/LICENSE.rst,sha256=uhiFz7eEG8WszLtRtYIT89FNMI3ijy1aACnvl5BOz2Y,1492
|
|
25
|
+
exovetter-0.0.8.dist-info/METADATA,sha256=rz9jh06oK8QeTWjgvsHYteiZRucjVbEsGnnQ7AUds7s,3706
|
|
26
|
+
exovetter-0.0.8.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
27
|
+
exovetter-0.0.8.dist-info/top_level.txt,sha256=wh0_U5IPEspONX8zhGRaFUqfuovCGkgYjAmWuQe0w6Q,10
|
|
28
|
+
exovetter-0.0.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|