From c39d8ff131ca9d895c8a75e727150f50c1a43bf7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Dec 2021 17:19:14 +0000 Subject: [PATCH 1/5] Update cython requirement from ~=0.29.24 to ~=0.29.25 Updates the requirements on [cython](https://github.com/cython/cython) to permit the latest version. - [Release notes](https://github.com/cython/cython/releases) - [Changelog](https://github.com/cython/cython/blob/master/CHANGES.rst) - [Commits](https://github.com/cython/cython/compare/0.29.24...0.29.25) --- updated-dependencies: - dependency-name: cython dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 812f260e..948e030a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,7 +7,7 @@ astroalign~=2.4 astropy>=4.3 astroquery~=0.4 barycorrpy~=0.4 -cython~=0.29.24 ; platform_system != "Windows" +cython~=0.29.25 ; platform_system != "Windows" dynesty~=1.1 ; platform_system == "Windows" holoviews~=1.14 LDTk~=1.7 From 0ffe818c53c8cf7e62c0a0b468a2f88931f04ccf Mon Sep 17 00:00:00 2001 From: Rob Zellem Date: Wed, 8 Dec 2021 15:59:45 -0800 Subject: [PATCH 2/5] updated time_bin --- exotic/api/elca.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exotic/api/elca.py b/exotic/api/elca.py index 5c9c04ec..2877f82f 100644 --- a/exotic/api/elca.py +++ b/exotic/api/elca.py @@ -123,7 +123,7 @@ def time_bin(time, flux, dt=1./(60*24)): if mask.sum() > 0: bflux[i] = np.nanmean(flux[mask]) btime[i] = np.nanmean(time[mask]) - bstds[i] = np.nanstd(flux[mask])/(1+mask.sum())**0.5 + bstds[i] = np.nanstd(flux[mask])/(mask.sum()**0.5) zmask = (bflux==0) | (btime==0) | np.isnan(bflux) | np.isnan(btime) return btime[~zmask], bflux[~zmask], bstds[~zmask] From cca328285a6966fd0bacd4d6d8ab30673e9ee497 Mon Sep 17 00:00:00 2001 From: Kyle A Pearson Date: Thu, 9 Dec 2021 12:17:49 -0800 Subject: [PATCH 3/5] index constraint for stars close to edge of FOV and light curve up sampling --- exotic/api/elca.py | 11 ++++++++--- exotic/exotic.py | 28 ++++++++++++++++++---------- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/exotic/api/elca.py b/exotic/api/elca.py index f96ea743..51b673bb 100644 --- a/exotic/api/elca.py +++ b/exotic/api/elca.py @@ -223,10 +223,12 @@ def lc2min_airmass(pars): def create_fit_variables(self): self.phase = get_phase(self.time, self.parameters['per'], self.parameters['tmid']) self.transit = transit(self.time, self.parameters) + self.time_upsample = np.linspace(min(self.time), max(self.time),1000) + self.transit_upsample = transit(self.time_upsample, self.parameters) + self.phase_upsample = get_phase(self.time_upsample, self.parameters['per'], self.parameters['tmid']) if self.mode == "ns": self.parameters['a1'], self.errors['a1'] = mc_a1(self.parameters.get('a2',0), self.errors.get('a2',1e-6), self.transit, self.airmass, self.data) - if np.ndim(self.airmass) == 2: detrended = self.data/self.transit self.wf = weightedflux(detrended, self.gw, self.nearest) @@ -409,7 +411,9 @@ def plot_bestfit(self, title="", bin_dt=30./(60*24), zoom=False, phase=True): si = np.argsort(self.phase) bt2, bf2, bs = time_bin(self.phase[si]*self.parameters['per'], self.detrended[si], bin_dt) axs[0].errorbar(bt2/self.parameters['per'],bf2,yerr=bs,alpha=1,zorder=2,color='blue',ls='none',marker='s') - axs[0].plot(self.phase[si], self.transit[si], 'r-', zorder=3, label=lclabel) + #axs[0].plot(self.phase[si], self.transit[si], 'r-', zorder=3, label=lclabel) + sii = np.argsort(self.phase_upsample) + axs[0].plot(self.phase_upsample[sii], self.transit_upsample[sii], 'r-', zorder=3, label=lclabel) axs[0].set_xlim([min(self.phase), max(self.phase)]) axs[0].set_xlabel("Phase ", fontsize=14) else: @@ -421,8 +425,9 @@ def plot_bestfit(self, title="", bin_dt=30./(60*24), zoom=False, phase=True): bt, bf, bs = time_bin(self.time, self.detrended, bin_dt) si = np.argsort(self.time) + sii = np.argsort(self.time_upsample) axs[0].errorbar(bt,bf,yerr=bs,alpha=1,zorder=2,color='blue',ls='none',marker='s') - axs[0].plot(self.time[si], self.transit[si], 'r-', zorder=3, label=lclabel) + axs[0].plot(self.time_sample[sii], self.transit_sample[sii], 'r-', zorder=3, label=lclabel) axs[0].set_xlim([min(self.time), max(self.time)]) axs[0].set_xlabel("Time [day]", fontsize=14) diff --git a/exotic/exotic.py b/exotic/exotic.py index dd60887e..a14da297 100644 --- a/exotic/exotic.py +++ b/exotic/exotic.py @@ -900,10 +900,16 @@ def gaussian_psf(x, y, x0, y0, a, sigx, sigy, rot, b): return a * gausx * gausy + b -def mesh_box(pos, box): +def mesh_box(pos, box, maxx=0, maxy=0): pos = [int(np.round(pos[0])), int(np.round(pos[1]))] - x = np.arange(pos[0] - box, pos[0] + box + 1) - y = np.arange(pos[1] - box, pos[1] + box + 1) + if maxx: + x = np.arange(max(0,pos[0] - box), min(maxx, pos[0] + box + 1)) + else: + x = np.arange(max(0,pos[0] - box), pos[0] + box + 1) + if maxy: + y = np.arange(max(0,pos[1] - box), min(maxy, pos[1] + box + 1)) + else: + y = np.arange(max(0,pos[1] - box), pos[1] + box + 1) xv, yv = np.meshgrid(x, y) return xv.astype(int), yv.astype(int) @@ -911,17 +917,17 @@ def mesh_box(pos, box): # Method fits a 2D gaussian function that matches the star_psf to the star image and returns its pixel coordinates def fit_centroid(data, pos, psf_function=gaussian_psf, box=10): # get sub field in image - xv, yv = mesh_box(pos, box) - - init = [np.nanmax(data[yv, xv]) - np.nanmin(data[yv, xv]), 1, 1, 0, np.nanmin(data[yv, xv])] - + xv, yv = mesh_box(pos, box, maxx=data.shape[1], maxy=data.shape[0]) + subarray = data[yv, xv] + init = [np.nanmax(subarray) - np.nanmin(subarray), 1, 1, 0, np.nanmin(subarray)] + # lower bound: [xc, yc, amp, sigx, sigy, rotation, bg] - lo = [pos[0] - box * 0.5, pos[1] - box * 0.5, 0, 0.5, 0.5, -np.pi / 4, np.nanmin(data[yv, xv]) - 1] - up = [pos[0] + box * 0.5, pos[1] + box * 0.5, 1e7, 20, 20, np.pi / 4, np.nanmax(data[yv, xv]) + 1] + lo = [pos[0] - box * 0.5, pos[1] - box * 0.5, 0, 0.5, 0.5, -np.pi / 4, np.nanmin(subarray) - 1] + up = [pos[0] + box * 0.5, pos[1] + box * 0.5, 1e7, 20, 20, np.pi / 4, np.nanmax(subarray) + 1] def fcn2min(pars): model = psf_function(xv, yv, *pars) - return (data[yv, xv] - model).flatten() + return (subarray - model).flatten() try: res = least_squares(fcn2min, x0=[*pos, *init], bounds=[lo, up], jac='3-point', xtol=None, method='trf') @@ -1085,6 +1091,8 @@ def realTimeReduce(i, target_name, info_dict, ax): 'comp': np.zeros(2, dtype=int) } + print("initial image:", inputfiles[0]) + # open files, calibrate, align, photometry for i, fileName in enumerate(inputfiles): hdul = fits.open(name=fileName, memmap=False, cache=False, lazy_load_hdus=False, From e8439122af4bc672003bf0512eab486e7b0d4544 Mon Sep 17 00:00:00 2001 From: Kyle A Pearson Date: Thu, 9 Dec 2021 12:22:50 -0800 Subject: [PATCH 4/5] typos --- exotic/api/elca.py | 2 +- exotic/exotic.py | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/exotic/api/elca.py b/exotic/api/elca.py index 2cd308c7..c0bbab23 100644 --- a/exotic/api/elca.py +++ b/exotic/api/elca.py @@ -427,7 +427,7 @@ def plot_bestfit(self, title="", bin_dt=30./(60*24), zoom=False, phase=True): si = np.argsort(self.time) sii = np.argsort(self.time_upsample) axs[0].errorbar(bt,bf,yerr=bs,alpha=1,zorder=2,color='blue',ls='none',marker='s') - axs[0].plot(self.time_sample[sii], self.transit_sample[sii], 'r-', zorder=3, label=lclabel) + axs[0].plot(self.time_upsample[sii], self.transit_upsample[sii], 'r-', zorder=3, label=lclabel) axs[0].set_xlim([min(self.time), max(self.time)]) axs[0].set_xlabel("Time [day]", fontsize=14) diff --git a/exotic/exotic.py b/exotic/exotic.py index a14da297..785d534a 100644 --- a/exotic/exotic.py +++ b/exotic/exotic.py @@ -1091,8 +1091,6 @@ def realTimeReduce(i, target_name, info_dict, ax): 'comp': np.zeros(2, dtype=int) } - print("initial image:", inputfiles[0]) - # open files, calibrate, align, photometry for i, fileName in enumerate(inputfiles): hdul = fits.open(name=fileName, memmap=False, cache=False, lazy_load_hdus=False, From 2ef2337c28dae750771f9a933a94de20c1fbe037 Mon Sep 17 00:00:00 2001 From: Rob Zellem Date: Thu, 9 Dec 2021 12:48:57 -0800 Subject: [PATCH 5/5] v1.9.0: update to centroiding and lightcurve plotter --- exotic/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exotic/version.py b/exotic/version.py index 22944760..0a0a43a5 100644 --- a/exotic/version.py +++ b/exotic/version.py @@ -1 +1 @@ -__version__ = "1.8.4" +__version__ = "1.9.0"