exovetter 0.0.7__py3-none-any.whl → 0.0.9__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.
@@ -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
- figs = []
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, fig = measure_centroids(
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
- fig.suptitle('Transit '+str(i))
96
+ plt.gcf().suptitle('Transit '+str(i))
92
97
 
93
98
  centroids.append(cents)
94
- figs.append(fig)
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, figs, kept_transits
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
- disp.plotCentroidLocation(res[0], res[1], marker="^", color=clr,
214
- label="diff")
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
- res = ootSoln.x
217
- disp.plotCentroidLocation(res[0], res[1], marker="o", color=clr,
218
- label="OOT")
275
+ res1 = ootSoln.x
276
+ disp.plotCentroidLocation(res1[0], res1[1], marker="o", color=clr,
277
+ label="OOT")
219
278
 
220
- res = intransSoln.x
221
- disp.plotCentroidLocation(res[0], res[1], marker="+", color=clr,
222
- label="InT")
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
 
@@ -105,7 +105,7 @@ def diagnostic_plot(x, y, kept_transits, flag=None):
105
105
  plt.legend()
106
106
 
107
107
  offset, signif = compute_offset_and_signif(x[~idx], y[~idx])
108
- msg = "Offset %i pixels\nProb Transit on Target: %.0e" % (offset, signif)
108
+ msg = "Offset %.2f pixels\nProb Transit on Target: %.2f" % (offset, signif)
109
109
  plt.title(msg)
110
110
  return plt.gcf()
111
111
 
@@ -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
@@ -5,4 +5,4 @@ try:
5
5
  from setuptools_scm import get_version
6
6
  version = get_version(root='..', relative_to=__file__)
7
7
  except Exception:
8
- version = '0.0.7'
8
+ version = '0.0.9'
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
- offset, signif, fig = cent.measure_centroid_shift(centroids, kept_transits, self.centroid_plots)
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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: exovetter
3
- Version: 0.0.7
3
+ Version: 0.0.9
4
4
  Summary: Exoplanet vetting package
5
5
  Home-page: https://github.com/spacetelescope/exovetter
6
6
  Author: Susan Mullally et al.
@@ -10,20 +10,22 @@ Requires-Python: >=3.7
10
10
  Description-Content-Type: text/x-rst
11
11
  License-File: LICENSE.rst
12
12
  Requires-Dist: numpy
13
- Requires-Dist: astropy >=3
13
+ Requires-Dist: astropy>=3
14
14
  Requires-Dist: scipy
15
15
  Provides-Extra: all
16
- Requires-Dist: matplotlib ; extra == 'all'
17
- Requires-Dist: scikit-learn ; extra == 'all'
18
- Requires-Dist: lightkurve >=2 ; extra == 'all'
19
- Requires-Dist: lpproj ; extra == 'all'
16
+ Requires-Dist: matplotlib; extra == "all"
17
+ Requires-Dist: scikit-learn; extra == "all"
18
+ Requires-Dist: lightkurve>=2; extra == "all"
19
+ Requires-Dist: lpproj; extra == "all"
20
20
  Provides-Extra: docs
21
- Requires-Dist: sphinx-astropy ; extra == 'docs'
22
- Requires-Dist: sphinx-rtd-theme ; extra == 'docs'
21
+ Requires-Dist: sphinx-astropy; extra == "docs"
22
+ Requires-Dist: sphinx-rtd-theme; extra == "docs"
23
23
  Provides-Extra: test
24
- Requires-Dist: pytest-cov ; extra == 'test'
25
- Requires-Dist: pytest-remotedata ; extra == 'test'
26
- Requires-Dist: pytest-doctestplus ; extra == 'test'
24
+ Requires-Dist: pytest-cov; extra == "test"
25
+ Requires-Dist: pytest-remotedata; extra == "test"
26
+ Requires-Dist: pytest-doctestplus; extra == "test"
27
+ Requires-Dist: oktopus; extra == "test"
28
+ Requires-Dist: autograd; extra == "test"
27
29
 
28
30
  exovetter: Exoplanet Vetting
29
31
  ============================
@@ -32,7 +34,7 @@ exovetter: Exoplanet Vetting
32
34
  :target: https://exovetter.readthedocs.io/en/latest/?badge=latest
33
35
  :alt: Documentation Status
34
36
 
35
- .. image:: https://github.com/spacetelescope/exovetter/workflows/CI/badge.svg
37
+ .. image:: https://github.com/spacetelescope/exovetter/actions/workflows/ci_workflows.yml/badge.svg
36
38
  :target: https://github.com/spacetelescope/exovetter/actions
37
39
  :alt: Github Actions CI Status
38
40
 
@@ -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=Es0ObF1J9qSSraJcBVdj4CHe2laI8JXK6MYDVl2LypM,337
14
- exovetter/vetters.py,sha256=ONNZM3qhVRd_s6By-wR7VBuas8tyo_TwtrpiS2x4_XE,37423
13
+ exovetter/version.py,sha256=aTtkNj5pQ4n7dp0c5uDacra2xVgSIstpL1dwb53cYWw,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=LWqjn-Oerdw5j2wDCFYqB6omE4K9gckIwAA0-WZvgkY,8655
18
- exovetter/centroid/covar.py,sha256=suSgPjOVVEOclIi7rnhqc7wBbcSVsPOrdad91NXjX3Y,8973
19
- exovetter/centroid/disp.py,sha256=scVCRj16mNSqugHY28_uLt5bOkcdumIlJeFG3BXfldU,3674
17
+ exovetter/centroid/centroid.py,sha256=tNT1ZEQqN1t1Sijn9hJYjGQYCnguVE9iJp2MlL-vWN8,10785
18
+ exovetter/centroid/covar.py,sha256=Ot_gLmVtuJ9T9REThOdOKzGPhHAT-AmE4mWaAcI8pic,8975
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.7.dist-info/LICENSE.rst,sha256=uhiFz7eEG8WszLtRtYIT89FNMI3ijy1aACnvl5BOz2Y,1492
25
- exovetter-0.0.7.dist-info/METADATA,sha256=nXJOHqH5ayjdJ7idVePETqwxsiD8RKpI0JQBUoZ0Epc,3706
26
- exovetter-0.0.7.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
27
- exovetter-0.0.7.dist-info/top_level.txt,sha256=wh0_U5IPEspONX8zhGRaFUqfuovCGkgYjAmWuQe0w6Q,10
28
- exovetter-0.0.7.dist-info/RECORD,,
24
+ exovetter-0.0.9.dist-info/LICENSE.rst,sha256=uhiFz7eEG8WszLtRtYIT89FNMI3ijy1aACnvl5BOz2Y,1492
25
+ exovetter-0.0.9.dist-info/METADATA,sha256=HJ5erRbKMEdxfb8-Ex3WDAo-lYD_shmONAUfj3T1UXk,3798
26
+ exovetter-0.0.9.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
27
+ exovetter-0.0.9.dist-info/top_level.txt,sha256=wh0_U5IPEspONX8zhGRaFUqfuovCGkgYjAmWuQe0w6Q,10
28
+ exovetter-0.0.9.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.43.0)
2
+ Generator: setuptools (75.3.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5