From 7ba7cf921e291ae640645953a3ea786675629d7d Mon Sep 17 00:00:00 2001 From: Arthur Vigan Date: Sat, 19 Dec 2020 15:44:38 +0100 Subject: [PATCH 01/16] =?UTF-8?q?Add=20default=20-1.75=C2=B0=20true=20Nort?= =?UTF-8?q?h=20offset=20+=20associated=20warning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ticket #88 --- sphere/IFS.py | 19 ++++++++++++++++++- sphere/IRDIS/ImagingReduction.py | 19 ++++++++++++++++++- sphere/IRDIS/SpectroReduction.py | 3 ++- sphere/instruments/IFS.ini | 3 +++ sphere/instruments/IRDIS.ini | 3 +++ sphere/toolbox.py | 18 +++++++++++------- 6 files changed, 55 insertions(+), 10 deletions(-) diff --git a/sphere/IFS.py b/sphere/IFS.py index 702c90f..c063f36 100644 --- a/sphere/IFS.py +++ b/sphere/IFS.py @@ -462,6 +462,22 @@ def __new__(cls, path, log_level='info', sphere_handler=None): reduction._logger.info('Creating IFS reduction at path {}'.format(path)) + # + # v1.4 - True North correction change + # + reduction._logger.warning('#################################################################') + reduction._logger.warning('Starting in the present version of the pipeline, the default ') + reduction._logger.warning('-1.75° true North offset is automatically added to the derotation') + reduction._logger.warning('angles. The offset value can be modified in the configuration of ') + reduction._logger.warning('the reduction: ') + reduction._logger.warning(' ') + reduction._logger.warning(' >>> reduction.config[\'true_north\'] = xxx ') + reduction._logger.warning(' ') + reduction._logger.warning('To avoid any issues, make sure to: ') + reduction._logger.warning(' * either reprocess data previously processed with version <1.4 ') + reduction._logger.warning(' * or take into account the offset in your astrometric analysis ') + reduction._logger.warning('#################################################################') + # # configuration # @@ -1051,7 +1067,8 @@ def sort_frames(self): toolbox.compute_times(frames_info, logger=self._logger) # compute angles (ra, dec, parang) - ret = toolbox.compute_angles(frames_info, logger=self._logger) + true_north = self.config['true_north'] + ret = toolbox.compute_angles(frames_info, true_north, logger=self._logger) if ret == sphere.ERROR: self._update_recipe_status('sort_frames', sphere.ERROR) self._status = sphere.FATAL diff --git a/sphere/IRDIS/ImagingReduction.py b/sphere/IRDIS/ImagingReduction.py index 638819b..ead156f 100644 --- a/sphere/IRDIS/ImagingReduction.py +++ b/sphere/IRDIS/ImagingReduction.py @@ -123,6 +123,22 @@ def __new__(cls, path, log_level='info', sphere_handler=None): reduction._logger.info('Creating IRDIS imaging reduction at path {}'.format(path)) + # + # v1.4 - True North correction change + # + reduction._logger.warning('#################################################################') + reduction._logger.warning('Starting in the present version of the pipeline, the default ') + reduction._logger.warning('-1.75° true North offset is automatically added to the derotation') + reduction._logger.warning('angles. The offset value can be modified in the configuration of ') + reduction._logger.warning('the reduction: ') + reduction._logger.warning(' ') + reduction._logger.warning(' >>> reduction.config[\'true_north\'] = xxx ') + reduction._logger.warning(' ') + reduction._logger.warning('To avoid any issues, make sure to: ') + reduction._logger.warning(' * either reprocess data previously processed with version <1.4 ') + reduction._logger.warning(' * or take into account the offset in your astrometric analysis ') + reduction._logger.warning('#################################################################') + # # configuration # @@ -674,7 +690,8 @@ def sort_frames(self): toolbox.compute_times(frames_info, logger=self._logger) # compute angles (ra, dec, parang) - ret = toolbox.compute_angles(frames_info, logger=self._logger) + true_north = self.config['true_north'] + ret = toolbox.compute_angles(frames_info, true_north, logger=self._logger) if ret == sphere.ERROR: self._update_recipe_status('sort_frames', sphere.ERROR) self._status = sphere.FATAL diff --git a/sphere/IRDIS/SpectroReduction.py b/sphere/IRDIS/SpectroReduction.py index 1d51272..c1a6e25 100644 --- a/sphere/IRDIS/SpectroReduction.py +++ b/sphere/IRDIS/SpectroReduction.py @@ -747,7 +747,8 @@ def sort_frames(self): toolbox.compute_times(frames_info, logger=self._logger) # compute angles (ra, dec, parang) - ret = toolbox.compute_angles(frames_info, logger=self._logger) + true_north = self.config['true_north'] + ret = toolbox.compute_angles(frames_info, true_north, logger=self._logger) if ret == sphere.ERROR: self._update_recipe_status('sort_frames', sphere.ERROR) self._status = sphere.FATAL diff --git a/sphere/instruments/IFS.ini b/sphere/instruments/IFS.ini index a20e65b..9519c33 100644 --- a/sphere/instruments/IFS.ini +++ b/sphere/instruments/IFS.ini @@ -20,6 +20,9 @@ default_center = (290//2, 290//2) # field orientation offset orientation_offset = 102 +# true North +true_north = -1.75 + # # default reduction parameters # diff --git a/sphere/instruments/IRDIS.ini b/sphere/instruments/IRDIS.ini index c12fe3c..73b1a78 100644 --- a/sphere/instruments/IRDIS.ini +++ b/sphere/instruments/IRDIS.ini @@ -21,6 +21,9 @@ default_center = ((485, 520), (486, 508)) # field orientation offset orientation_offset = 0 +# true North +true_north = -1.75 + [calibration-spectro] # LRS parameters diff --git a/sphere/toolbox.py b/sphere/toolbox.py index 3f68c17..08b016b 100644 --- a/sphere/toolbox.py +++ b/sphere/toolbox.py @@ -173,7 +173,7 @@ def compute_times(frames_info, logger=_log): frames_info['MJD'] = mjd -def compute_angles(frames_info, logger=_log): +def compute_angles(frames_info, true_north, logger=_log): ''' Compute the various angles associated to frames: RA, DEC, parang, pupil offset, final derotation angle @@ -183,9 +183,11 @@ def compute_angles(frames_info, logger=_log): frames_info : dataframe The data frame with all the information on science frames + true_north : float + True North offset correction, in degrees + logger : logHandler object Log handler for the reduction. Default is root logger - ''' logger.debug('> compute angles') @@ -262,11 +264,13 @@ def compute_angles(frames_info, logger=_log): # # Derotation angles # - # PA_on-sky = PA_detector + PARANGLE + True_North + PUP_OFFSET + INSTRUMENT_OFFSET - # PUP_OFFSET = -135.99 ± 0.11 + # PA_on-sky = PA_detector + PARANGLE + True_North + PUP_OFFSET + INSTRUMENT_OFFSET + TRUE_NORTH + # + # PUP_OFFSET = +135.99 ± 0.11 # INSTRUMENT_OFFSET - # IFS = +100.48 ± 0.10 - # IRD = 0.00 ± 0.00 + # * IFS = -100.48 ± 0.10 + # * IRD = 0.00 ± 0.00 + # TRUE_NORTH = -1.75 ± 0.08 # if len(instrument) != 1: logger.error('Sequence is mixing different instruments: {0}'.format(instrument)) @@ -298,7 +302,7 @@ def compute_angles(frames_info, logger=_log): frames_info['PUPIL OFFSET'] = pupoff + instru_offset # final derotation value - frames_info['DEROT ANGLE'] = frames_info['PARANG'] + pupoff + instru_offset + frames_info['DEROT ANGLE'] = frames_info['PARANG'] + pupoff + instru_offset + true_north return sphere.SUCCESS From 2a9ce96cd819436b41b985f01588f3b2211523b6 Mon Sep 17 00:00:00 2001 From: Arthur Vigan Date: Sat, 19 Dec 2020 16:22:25 +0100 Subject: [PATCH 02/16] Set clean option to False in examples --- examples/ifs_reduction.py | 1 + examples/irdis_imaging_reduction.py | 1 + examples/irdis_spectro_reduction.py | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/ifs_reduction.py b/examples/ifs_reduction.py index 4fdcb70..1c164a9 100644 --- a/examples/ifs_reduction.py +++ b/examples/ifs_reduction.py @@ -11,6 +11,7 @@ reduction.config['preproc_collapse_science'] = True reduction.config['preproc_collapse_type'] = 'coadd' reduction.config['preproc_coadd_value'] = 2 +reduction.config['clean'] = False reduction.show_config() #%% reduction diff --git a/examples/irdis_imaging_reduction.py b/examples/irdis_imaging_reduction.py index 7aba070..58fc33c 100644 --- a/examples/irdis_imaging_reduction.py +++ b/examples/irdis_imaging_reduction.py @@ -13,6 +13,7 @@ reduction.config['combine_shift_method'] = 'fft' reduction.config['preproc_collapse_science'] = True reduction.config['preproc_collapse_type'] = 'mean' +reduction.config['clean'] = False reduction.show_config() #%% reduction diff --git a/examples/irdis_spectro_reduction.py b/examples/irdis_spectro_reduction.py index ebe73db..5ddc541 100644 --- a/examples/irdis_spectro_reduction.py +++ b/examples/irdis_spectro_reduction.py @@ -9,7 +9,7 @@ #%% configuration reduction.config['combine_science_dim'] = 300 -reduction.config['clean'] = True +reduction.config['clean'] = False reduction.show_config() #%% reduction From 775e78f3fc44e6df96b53985a1533d9688488689 Mon Sep 17 00:00:00 2001 From: Arthur Vigan Date: Sat, 19 Dec 2020 16:24:28 +0100 Subject: [PATCH 03/16] =?UTF-8?q?Fix=20implementation=20of=20the=20default?= =?UTF-8?q?=20-1.75=C2=B0=20true=20North=20offset?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ticket #88 --- sphere/IFS.py | 25 ++++++++++++++++--------- sphere/IRDIS/ImagingReduction.py | 25 ++++++++++++++++--------- sphere/IRDIS/SpectroReduction.py | 21 ++++++++++++++------- sphere/instruments/IFS.ini | 6 +++--- sphere/instruments/IRDIS.ini | 6 +++--- sphere/toolbox.py | 9 ++++++--- 6 files changed, 58 insertions(+), 34 deletions(-) diff --git a/sphere/IFS.py b/sphere/IFS.py index c063f36..e82b760 100644 --- a/sphere/IFS.py +++ b/sphere/IFS.py @@ -471,7 +471,7 @@ def __new__(cls, path, log_level='info', sphere_handler=None): reduction._logger.warning('angles. The offset value can be modified in the configuration of ') reduction._logger.warning('the reduction: ') reduction._logger.warning(' ') - reduction._logger.warning(' >>> reduction.config[\'true_north\'] = xxx ') + reduction._logger.warning(' >>> reduction.config[\'cal_true_north\'] = xxx ') reduction._logger.warning(' ') reduction._logger.warning('To avoid any issues, make sure to: ') reduction._logger.warning(' * either reprocess data previously processed with version <1.4 ') @@ -609,6 +609,12 @@ def show_config(self): for key in keys: print('{0:<30s}{1}'.format(key, dico[key])) + # calibrations + print('-'*35) + keys = [key for key in dico if key.startswith('cal')] + for key in keys: + print('{0:<30s}{1}'.format(key, dico[key])) + # pre-processing print('-'*35) keys = [key for key in dico if key.startswith('preproc')] @@ -1067,7 +1073,7 @@ def sort_frames(self): toolbox.compute_times(frames_info, logger=self._logger) # compute angles (ra, dec, parang) - true_north = self.config['true_north'] + true_north = self.config['cal_true_north'] ret = toolbox.compute_angles(frames_info, true_north, logger=self._logger) if ret == sphere.ERROR: self._update_recipe_status('sort_frames', sphere.ERROR) @@ -2162,27 +2168,28 @@ def sph_ifs_preprocess_science(self, img = img[np.newaxis, ...] # collapse + true_north = self.config['cal_true_north'] if (typ == 'OBJECT,CENTER'): if collapse_center: self._logger.info(' ==> collapse: mean ({0} -> 1 frame, 0 dropped)'.format(len(img))) img = np.mean(img, axis=0, keepdims=True) - frames_info_new = toolbox.collapse_frames_info(finfo, fname, 'mean', logger=self._logger) + frames_info_new = toolbox.collapse_frames_info(finfo, fname, true_north, 'mean', logger=self._logger) else: - frames_info_new = toolbox.collapse_frames_info(finfo, fname, 'none', logger=self._logger) + frames_info_new = toolbox.collapse_frames_info(finfo, fname, true_north, 'none', logger=self._logger) elif (typ == 'OBJECT,FLUX'): if collapse_psf: self._logger.info(' ==> collapse: mean ({0} -> 1 frame, 0 dropped)'.format(len(img))) img = np.mean(img, axis=0, keepdims=True) - frames_info_new = toolbox.collapse_frames_info(finfo, fname, 'mean', logger=self._logger) + frames_info_new = toolbox.collapse_frames_info(finfo, fname, true_north, 'mean', logger=self._logger) else: - frames_info_new = toolbox.collapse_frames_info(finfo, fname, 'none', logger=self._logger) + frames_info_new = toolbox.collapse_frames_info(finfo, fname, true_north, 'none', logger=self._logger) elif (typ == 'OBJECT'): if collapse_science: if collapse_type == 'mean': self._logger.info(' ==> collapse: mean ({0} -> 1 frame, 0 dropped)'.format(len(img))) img = np.mean(img, axis=0, keepdims=True) - frames_info_new = toolbox.collapse_frames_info(finfo, fname, 'mean', logger=self._logger) + frames_info_new = toolbox.collapse_frames_info(finfo, fname, true_north, 'mean', logger=self._logger) elif collapse_type == 'coadd': if (not isinstance(coadd_value, int)) or (coadd_value <= 1): self._logger.error('coadd_value must be an integer >1') @@ -2207,13 +2214,13 @@ def sph_ifs_preprocess_science(self, nimg[f] = np.mean(img[f*coadd_value:(f+1)*coadd_value], axis=0) img = nimg - frames_info_new = toolbox.collapse_frames_info(finfo, fname, 'coadd', coadd_value=coadd_value, logger=self._logger) + frames_info_new = toolbox.collapse_frames_info(finfo, fname, true_north, 'coadd', coadd_value=coadd_value, logger=self._logger) else: self._logger.error('Unknown collapse type {0}'.format(collapse_type)) self._update_recipe_status('sph_ifs_preprocess_science', sphere.ERROR) return else: - frames_info_new = toolbox.collapse_frames_info(finfo, fname, 'none', logger=self._logger) + frames_info_new = toolbox.collapse_frames_info(finfo, fname, true_north, 'none', logger=self._logger) # check for any error during collapse of frame information if frames_info_new is None: diff --git a/sphere/IRDIS/ImagingReduction.py b/sphere/IRDIS/ImagingReduction.py index ead156f..3ccf83f 100644 --- a/sphere/IRDIS/ImagingReduction.py +++ b/sphere/IRDIS/ImagingReduction.py @@ -132,7 +132,7 @@ def __new__(cls, path, log_level='info', sphere_handler=None): reduction._logger.warning('angles. The offset value can be modified in the configuration of ') reduction._logger.warning('the reduction: ') reduction._logger.warning(' ') - reduction._logger.warning(' >>> reduction.config[\'true_north\'] = xxx ') + reduction._logger.warning(' >>> reduction.config[\'cal_true_north\'] = xxx ') reduction._logger.warning(' ') reduction._logger.warning('To avoid any issues, make sure to: ') reduction._logger.warning(' * either reprocess data previously processed with version <1.4 ') @@ -274,6 +274,12 @@ def show_config(self): for key in keys: print('{0:<30s}{1}'.format(key, dico[key])) + # calibrations + print('-'*35) + keys = [key for key in dico if key.startswith('cal')] + for key in keys: + print('{0:<30s}{1}'.format(key, dico[key])) + # pre-processing print('-'*35) keys = [key for key in dico if key.startswith('preproc')] @@ -690,7 +696,7 @@ def sort_frames(self): toolbox.compute_times(frames_info, logger=self._logger) # compute angles (ra, dec, parang) - true_north = self.config['true_north'] + true_north = self.config['cal_true_north'] ret = toolbox.compute_angles(frames_info, true_north, logger=self._logger) if ret == sphere.ERROR: self._update_recipe_status('sort_frames', sphere.ERROR) @@ -1262,27 +1268,28 @@ def sph_ird_preprocess_science(self, img[:, :, 1966:] = np.nan # collapse + true_north = self.config['cal_true_north'] if (typ == 'OBJECT,CENTER'): if collapse_center: self._logger.info(' ==> collapse: mean') img = np.mean(img, axis=0, keepdims=True) - frames_info_new = toolbox.collapse_frames_info(finfo, fname, 'mean', logger=self._logger) + frames_info_new = toolbox.collapse_frames_info(finfo, fname, true_north, 'mean', logger=self._logger) else: - frames_info_new = toolbox.collapse_frames_info(finfo, fname, 'none', logger=self._logger) + frames_info_new = toolbox.collapse_frames_info(finfo, fname, true_north, 'none', logger=self._logger) elif (typ == 'OBJECT,FLUX'): if collapse_psf: self._logger.info(' ==> collapse: mean') img = np.mean(img, axis=0, keepdims=True) - frames_info_new = toolbox.collapse_frames_info(finfo, fname, 'mean', logger=self._logger) + frames_info_new = toolbox.collapse_frames_info(finfo, fname, true_north, 'mean', logger=self._logger) else: - frames_info_new = toolbox.collapse_frames_info(finfo, fname, 'none', logger=self._logger) + frames_info_new = toolbox.collapse_frames_info(finfo, fname, true_north, 'none', logger=self._logger) elif (typ == 'OBJECT'): if collapse_science: if collapse_type == 'mean': self._logger.info(' ==> collapse: mean ({0} -> 1 frame, 0 dropped)'.format(len(img))) img = np.mean(img, axis=0, keepdims=True) - frames_info_new = toolbox.collapse_frames_info(finfo, fname, 'mean', logger=self._logger) + frames_info_new = toolbox.collapse_frames_info(finfo, fname, true_north, 'mean', logger=self._logger) elif collapse_type == 'coadd': if (not isinstance(coadd_value, int)) or (coadd_value <= 1): self._logger.error('coadd_value must be an integer >1') @@ -1307,13 +1314,13 @@ def sph_ird_preprocess_science(self, nimg[f] = np.mean(img[f*coadd_value:(f+1)*coadd_value], axis=0) img = nimg - frames_info_new = toolbox.collapse_frames_info(finfo, fname, 'coadd', coadd_value=coadd_value, logger=self._logger) + frames_info_new = toolbox.collapse_frames_info(finfo, fname, true_north, 'coadd', coadd_value=coadd_value, logger=self._logger) else: self._logger.error('Unknown collapse type {0}'.format(collapse_type)) self._update_recipe_status('sph_ird_preprocess_science', sphere.ERROR) return else: - frames_info_new = toolbox.collapse_frames_info(finfo, fname, 'none', logger=self._logger) + frames_info_new = toolbox.collapse_frames_info(finfo, fname, true_north, 'none', logger=self._logger) # check for any error during collapse of frame information if frames_info_new is None: diff --git a/sphere/IRDIS/SpectroReduction.py b/sphere/IRDIS/SpectroReduction.py index c1a6e25..fd0995d 100644 --- a/sphere/IRDIS/SpectroReduction.py +++ b/sphere/IRDIS/SpectroReduction.py @@ -314,6 +314,12 @@ def show_config(self): for key in keys: print('{0:<30s}{1}'.format(key, dico[key])) + # calibrations + print('-'*35) + keys = [key for key in dico if key.startswith('cal')] + for key in keys: + print('{0:<30s}{1}'.format(key, dico[key])) + # pre-processing print('-'*35) keys = [key for key in dico if key.startswith('preproc')] @@ -747,7 +753,7 @@ def sort_frames(self): toolbox.compute_times(frames_info, logger=self._logger) # compute angles (ra, dec, parang) - true_north = self.config['true_north'] + true_north = self.config['cal_true_north'] ret = toolbox.compute_angles(frames_info, true_north, logger=self._logger) if ret == sphere.ERROR: self._update_recipe_status('sort_frames', sphere.ERROR) @@ -1520,28 +1526,29 @@ def sph_ird_preprocess_science(self, img[:, :, 1966:] = np.nan # collapse + true_north = self.config['cal_true_north'] if (typ == 'OBJECT,CENTER'): if collapse_center: self._logger.info(' ==> collapse: mean') img = np.mean(img, axis=0, keepdims=True) - frames_info_new = toolbox.collapse_frames_info(finfo, fname, 'mean', logger=self._logger) + frames_info_new = toolbox.collapse_frames_info(finfo, fname, true_north, 'mean', logger=self._logger) else: - frames_info_new = toolbox.collapse_frames_info(finfo, fname, 'none', logger=self._logger) + frames_info_new = toolbox.collapse_frames_info(finfo, fname, true_north, 'none', logger=self._logger) elif (typ == 'OBJECT,FLUX'): if collapse_psf: self._logger.info(' ==> collapse: mean') img = np.mean(img, axis=0, keepdims=True) - frames_info_new = toolbox.collapse_frames_info(finfo, fname, 'mean', logger=self._logger) + frames_info_new = toolbox.collapse_frames_info(finfo, fname, true_north, 'mean', logger=self._logger) else: - frames_info_new = toolbox.collapse_frames_info(finfo, fname, 'none', logger=self._logger) + frames_info_new = toolbox.collapse_frames_info(finfo, fname, true_north, 'none', logger=self._logger) elif (typ == 'OBJECT'): if collapse_science: self._logger.info(' ==> collapse: mean ({0} -> 1 frame, 0 dropped)'.format(len(img))) img = np.mean(img, axis=0, keepdims=True) - frames_info_new = toolbox.collapse_frames_info(finfo, fname, 'mean', logger=self._logger) + frames_info_new = toolbox.collapse_frames_info(finfo, fname, true_north, 'mean', logger=self._logger) else: - frames_info_new = toolbox.collapse_frames_info(finfo, fname, 'none', logger=self._logger) + frames_info_new = toolbox.collapse_frames_info(finfo, fname, true_north, 'none', logger=self._logger) # check for any error during collapse of frame information if frames_info_new is None: diff --git a/sphere/instruments/IFS.ini b/sphere/instruments/IFS.ini index 9519c33..cb0af1b 100644 --- a/sphere/instruments/IFS.ini +++ b/sphere/instruments/IFS.ini @@ -20,9 +20,6 @@ default_center = (290//2, 290//2) # field orientation offset orientation_offset = 102 -# true North -true_north = -1.75 - # # default reduction parameters # @@ -32,6 +29,9 @@ true_north = -1.75 misc_silent_esorex = True misc_plot = True +# true North +cal_true_north = -1.75 + # pre-processing preproc_subtract_background = True preproc_fix_badpix = True diff --git a/sphere/instruments/IRDIS.ini b/sphere/instruments/IRDIS.ini index 73b1a78..aa63198 100644 --- a/sphere/instruments/IRDIS.ini +++ b/sphere/instruments/IRDIS.ini @@ -21,9 +21,6 @@ default_center = ((485, 520), (486, 508)) # field orientation offset orientation_offset = 0 -# true North -true_north = -1.75 - [calibration-spectro] # LRS parameters @@ -45,6 +42,9 @@ wave_max_mrs = 1820 misc_silent_esorex = True misc_plot = True +# true North +cal_true_north = -1.75 + # # default reduction parameters for imaging # diff --git a/sphere/toolbox.py b/sphere/toolbox.py index 08b016b..b67ff42 100644 --- a/sphere/toolbox.py +++ b/sphere/toolbox.py @@ -346,7 +346,7 @@ def compute_bad_pixel_map(bpm_files, dtype=np.uint8, logger=_log): return bpm -def collapse_frames_info(finfo, fname, collapse_type, coadd_value=2, logger=_log): +def collapse_frames_info(finfo, fname, true_north, collapse_type, coadd_value=2, logger=_log): ''' Collapse frame info to match the collapse operated on the data @@ -358,6 +358,9 @@ def collapse_frames_info(finfo, fname, collapse_type, coadd_value=2, logger=_log fname : str The name of the current file + true_north : float + True North offset correction, in degrees + collapse_type : str Type of collapse. Possible values are mean or coadd. Default is mean. @@ -402,7 +405,7 @@ def collapse_frames_info(finfo, fname, collapse_type, coadd_value=2, logger=_log (finfo.loc[(fname, imax), 'TIME END'] - finfo.loc[(fname, imin), 'TIME START']) / 2 # recompute angles - ret = compute_angles(nfinfo, logger=logger) + ret = compute_angles(nfinfo, true_north, logger=logger) if ret == sphere.ERROR: return None elif collapse_type == 'coadd': @@ -431,7 +434,7 @@ def collapse_frames_info(finfo, fname, collapse_type, coadd_value=2, logger=_log (finfo.loc[(fname, imax), 'TIME END'] - finfo.loc[(fname, imin), 'TIME START']) / 2 # recompute angles - ret = compute_angles(nfinfo, logger=logger) + ret = compute_angles(nfinfo, true_north, logger=logger) if ret == sphere.ERROR: return None else: From b7ede41bf0b58430846720d29e73eaa1964ac9cf Mon Sep 17 00:00:00 2001 From: Arthur Vigan Date: Sat, 19 Dec 2020 16:27:36 +0100 Subject: [PATCH 04/16] Remove save of parang.fits files and keep only derot.fits files --- sphere/IFS.py | 3 --- sphere/IRDIS/ImagingReduction.py | 3 --- 2 files changed, 6 deletions(-) diff --git a/sphere/IFS.py b/sphere/IFS.py index e82b760..6f42aa4 100644 --- a/sphere/IFS.py +++ b/sphere/IFS.py @@ -3130,7 +3130,6 @@ def sph_ifs_combine_data(self, cpix=True, psf_dim=80, science_dim=290, correct_a self._logger.debug('> save final cubes and metadata') flux_files.to_csv(path.products / 'psf_frames.csv') fits.writeto(path.products / 'psf_cube.fits', psf_cube, overwrite=True) - fits.writeto(path.products / 'psf_parang.fits', psf_parang, overwrite=True) fits.writeto(path.products / 'psf_derot.fits', psf_derot, overwrite=True) if save_scaled: self._logger.debug('> save scaled cubes') @@ -3228,7 +3227,6 @@ def sph_ifs_combine_data(self, cpix=True, psf_dim=80, science_dim=290, correct_a self._logger.debug('> save final cubes and metadata') starcen_files.to_csv(path.products / 'starcenter_frames.csv') fits.writeto(path.products / 'starcenter_cube.fits', cen_cube, overwrite=True) - fits.writeto(path.products / 'starcenter_parang.fits', cen_parang, overwrite=True) fits.writeto(path.products / 'starcenter_derot.fits', cen_derot, overwrite=True) if save_scaled: self._logger.debug('> save scaled cubes') @@ -3342,7 +3340,6 @@ def sph_ifs_combine_data(self, cpix=True, psf_dim=80, science_dim=290, correct_a self._logger.debug('> save final cubes and metadata') object_files.to_csv(path.products / 'science_frames.csv') fits.writeto(path.products / 'science_cube.fits', sci_cube, overwrite=True) - fits.writeto(path.products / 'science_parang.fits', sci_parang, overwrite=True) fits.writeto(path.products / 'science_derot.fits', sci_derot, overwrite=True) if save_scaled: self._logger.debug('> save scaled cubes') diff --git a/sphere/IRDIS/ImagingReduction.py b/sphere/IRDIS/ImagingReduction.py index 3ccf83f..b758f35 100644 --- a/sphere/IRDIS/ImagingReduction.py +++ b/sphere/IRDIS/ImagingReduction.py @@ -1729,7 +1729,6 @@ def sph_ird_combine_data(self, cpix=True, psf_dim=80, science_dim=290, correct_a self._logger.debug('> save final cubes and metadata') flux_files.to_csv(path.products / 'psf_frames.csv') fits.writeto(path.products / 'psf_cube.fits', psf_cube, overwrite=True) - fits.writeto(path.products / 'psf_parang.fits', psf_parang, overwrite=True) fits.writeto(path.products / 'psf_derot.fits', psf_derot, overwrite=True) if save_scaled: self._logger.debug('> save scaled cubes') @@ -1823,7 +1822,6 @@ def sph_ird_combine_data(self, cpix=True, psf_dim=80, science_dim=290, correct_a self._logger.debug('> save final cubes and metadata') starcen_files.to_csv(path.products / 'starcenter_frames.csv') fits.writeto(path.products / 'starcenter_cube.fits', cen_cube, overwrite=True) - fits.writeto(path.products / 'starcenter_parang.fits', cen_parang, overwrite=True) fits.writeto(path.products / 'starcenter_derot.fits', cen_derot, overwrite=True) if save_scaled: self._logger.debug('> save scaled cubes') @@ -1959,7 +1957,6 @@ def sph_ird_combine_data(self, cpix=True, psf_dim=80, science_dim=290, correct_a self._logger.debug('> save final cubes and metadata') object_files.to_csv(path.products / 'science_frames.csv') fits.writeto(path.products / 'science_cube.fits', sci_cube, overwrite=True) - fits.writeto(path.products / 'science_parang.fits', sci_parang, overwrite=True) fits.writeto(path.products / 'science_derot.fits', sci_derot, overwrite=True) if save_scaled: self._logger.debug('> save scaled cubes') From 25a9017634e18c4204c71cb29f5573b4b474aaed Mon Sep 17 00:00:00 2001 From: Arthur Vigan Date: Sat, 19 Dec 2020 16:34:51 +0100 Subject: [PATCH 05/16] Change copyright date --- sphere/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sphere/__init__.py b/sphere/__init__.py index 70e06a6..46c3580 100644 --- a/sphere/__init__.py +++ b/sphere/__init__.py @@ -1,5 +1,5 @@ __author__ = 'Arthur Vigan' -__copyright__ = 'Copyright (C) 2017-2020 Arthur Vigan' +__copyright__ = 'Copyright (C) 2017-2021 Arthur Vigan' __license__ = 'MIT' __version__ = '1.3' From a2b7c99e2d802f687f9b60d2fd1b2a86ff0a8b49 Mon Sep 17 00:00:00 2001 From: Arthur Vigan Date: Sat, 19 Dec 2020 19:18:56 +0100 Subject: [PATCH 06/16] Add possibility to perform spatial filtering on PSF images Close #86 --- examples/ifs_reduction.py | 3 ++- examples/irdis_imaging_reduction.py | 3 ++- examples/irdis_spectro_reduction.py | 2 +- sphere/IFS.py | 35 +++++++++++++++++------------ sphere/IRDIS/ImagingReduction.py | 23 +++++++++++-------- sphere/IRDIS/SpectroReduction.py | 23 +++++++++++-------- sphere/instruments/IFS.ini | 3 ++- sphere/instruments/IRDIS.ini | 6 +++-- sphere/toolbox.py | 31 +++++++++++++++++++------ 9 files changed, 84 insertions(+), 45 deletions(-) diff --git a/examples/ifs_reduction.py b/examples/ifs_reduction.py index 1c164a9..04de5cf 100644 --- a/examples/ifs_reduction.py +++ b/examples/ifs_reduction.py @@ -11,6 +11,7 @@ reduction.config['preproc_collapse_science'] = True reduction.config['preproc_collapse_type'] = 'coadd' reduction.config['preproc_coadd_value'] = 2 +reduction.config['center_high_pass_waffle'] = True reduction.config['clean'] = False reduction.show_config() @@ -45,7 +46,7 @@ #%% high-level science processing reduction.sph_ifs_wavelength_recalibration(high_pass=True, offset=(-3, 0), plot=True) -reduction.sph_ifs_star_center(high_pass=True, offset=(-3, 0), plot=True) +reduction.sph_ifs_star_center(high_pass_psf=False, high_pass_waffle=True, offset=(-3, 0), plot=True) reduction.sph_ifs_combine_data(cpix=True, psf_dim=80, science_dim=200, correct_anamorphism=True, shift_method='interp', manual_center=None, coarse_centering=False, save_scaled=False) diff --git a/examples/irdis_imaging_reduction.py b/examples/irdis_imaging_reduction.py index 58fc33c..a0b7cf9 100644 --- a/examples/irdis_imaging_reduction.py +++ b/examples/irdis_imaging_reduction.py @@ -13,6 +13,7 @@ reduction.config['combine_shift_method'] = 'fft' reduction.config['preproc_collapse_science'] = True reduction.config['preproc_collapse_type'] = 'mean' +reduction.config['center_high_pass_waffle'] = True reduction.config['clean'] = False reduction.show_config() @@ -41,7 +42,7 @@ collapse_psf=True, collapse_center=True) #%% high-level science processing -reduction.sph_ird_star_center(high_pass=True, offset=(0, 0), plot=True) +reduction.sph_ird_star_center(high_pass_psf=True, high_pass_waffle=False, offset=(0, 0), plot=True) reduction.sph_ird_combine_data(cpix=True, psf_dim=80, science_dim=200, correct_anamorphism=True, shift_method='interp', manual_center=None, coarse_centering=False, save_scaled=False) diff --git a/examples/irdis_spectro_reduction.py b/examples/irdis_spectro_reduction.py index 5ddc541..5fabc48 100644 --- a/examples/irdis_spectro_reduction.py +++ b/examples/irdis_spectro_reduction.py @@ -38,7 +38,7 @@ collapse_center=True) #%% high-level science processing -reduction.sph_ird_star_center(high_pass=False, plot=True) +reduction.sph_ird_star_center(high_pass_psf=False, high_pass_waffle=True, plot=True) reduction.sph_ird_wavelength_recalibration(fit_scaling=True, plot=True) reduction.sph_ird_combine_data(cpix=True, psf_dim=80, science_dim=300, correct_mrs_chromatism=True, split_posang=True, diff --git a/sphere/IFS.py b/sphere/IFS.py index 6f42aa4..9d26302 100644 --- a/sphere/IFS.py +++ b/sphere/IFS.py @@ -702,11 +702,12 @@ def process_science(self): config = self.config - self.sph_ifs_wavelength_recalibration(high_pass=config['center_high_pass'], + self.sph_ifs_wavelength_recalibration(high_pass=config['center_high_pass_waffle'], offset=config['center_offset'], box_waffle=config['center_box_waffle'], plot=config['misc_plot']) - self.sph_ifs_star_center(high_pass=config['center_high_pass'], + self.sph_ifs_star_center(high_pass_psf=config['center_high_pass_psf'], + high_pass_waffle=config['center_high_pass_waffle'], offset=config['center_offset'], box_psf=config['center_box_psf'], box_waffle=config['center_box_waffle'], @@ -2541,7 +2542,7 @@ def sph_ifs_wavelength_recalibration(self, high_pass=False, offset=(0, 0), box_w Parameters ---------- high_pass : bool - Apply high-pass filter to the image before searching for the satelitte spots. + Apply high-pass filter to the image before searching for the waffle spots. Default is False offset : tuple @@ -2598,12 +2599,12 @@ def sph_ifs_wavelength_recalibration(self, high_pass=False, offset=(0, 0), box_w # # star center # - self._logger.info(' * fitting satellite spots') + self._logger.info(' * fitting waffle spots') # get first DIT of first OBJECT,CENTER in the sequence starcen_files = frames_info[frames_info['DPR TYPE'] == 'OBJECT,CENTER'] if len(starcen_files) == 0: - self._logger.info(' ==> no OBJECT,CENTER file in the data set. Wavelength cannot be recalibrated. The standard wavelength calibrated by the ESO pripeline will be used.') + self._logger.info(' ==> no OBJECT,CENTER file in the data set. Wavelength cannot be recalibrated. The standard wavelength calibrated by the ESO pipeline will be used.') return ifs_mode = starcen_files['INS2 COMB IFS'].values[0] @@ -2623,7 +2624,7 @@ def sph_ifs_wavelength_recalibration(self, high_pass=False, offset=(0, 0), box_w waffle_orientation = hdr['HIERARCH ESO OCS WAFFLE ORIENT'] self._logger.debug('> waffle orientation: {}'.format(waffle_orientation)) if plot: - save_path = path.products / '{}spots_fitting.pdf'.format(fname) + save_path = path.products / '{}waffle_fitting.pdf'.format(fname) else: save_path = None spot_center, spot_dist, img_center \ @@ -2769,14 +2770,20 @@ def sph_ifs_wavelength_recalibration(self, high_pass=False, offset=(0, 0), box_w self._status = sphere.INCOMPLETE - def sph_ifs_star_center(self, high_pass=False, offset=(0, 0), box_psf=60, box_waffle=16, plot=True): + def sph_ifs_star_center(self, high_pass_psf=False, high_pass_waffle=False, offset=(0, 0), + box_psf=60, box_waffle=16, plot=True): '''Determines the star center for all frames where a center can be determined (OBJECT,CENTER and OBJECT,FLUX) Parameters ---------- - high_pass : bool - Apply high-pass filter to the image before searching for the satelitte spots + high_pass_psf : bool + Apply high-pass filter to the PSF image before searching for the center. + Default is False + + high_pass_waffle : bool + Apply high-pass filter to the image before searching for the waffle spots. + Default is False offset : tuple Apply an (x,y) offset to the default center position, for the waffle centering. @@ -2834,12 +2841,12 @@ def sph_ifs_star_center(self, high_pass=False, offset=(0, 0), box_psf=60, box_wa # centers if plot: - save_path = path.products / '{}PSF_fitting.pdf'.format(fname) + save_path = path.products / '{}psf_fitting.pdf'.format(fname) else: save_path = None img_center = toolbox.star_centers_from_PSF_img_cube(cube, wave_drh, pixel, exclude_fraction=0.15, - box_size=box_psf, save_path=save_path, - logger=self._logger) + high_pass=high_pass_psf, box_size=box_psf, + save_path=save_path, logger=self._logger) # save self._logger.debug('> save centers') @@ -2867,12 +2874,12 @@ def sph_ifs_star_center(self, high_pass=False, offset=(0, 0), box_psf=60, box_wa waffle_orientation = hdr['HIERARCH ESO OCS WAFFLE ORIENT'] self._logger.debug('> waffle orientation: {}'.format(waffle_orientation)) if plot: - save_path = path.products / '{}spots_fitting.pdf'.format(fname) + save_path = path.products / '{}waffle_fitting.pdf'.format(fname) else: save_path = None spot_center, spot_dist, img_center \ = toolbox.star_centers_from_waffle_img_cube(cube, wave_drh, waffle_orientation, center_guess, - pixel, orientation_offset, high_pass=high_pass, + pixel, orientation_offset, high_pass=high_pass_waffle, center_offset=offset, box_size=box_waffle, save_path=save_path, logger=self._logger) diff --git a/sphere/IRDIS/ImagingReduction.py b/sphere/IRDIS/ImagingReduction.py index b758f35..cd62d91 100644 --- a/sphere/IRDIS/ImagingReduction.py +++ b/sphere/IRDIS/ImagingReduction.py @@ -361,7 +361,8 @@ def process_science(self): config = self.config - self.sph_ird_star_center(high_pass=config['center_high_pass'], + self.sph_ird_star_center(high_pass_psf=config['center_high_pass_psf'], + high_pass_waffle=config['center_high_pass_waffle'], offset=config['center_offset'], box_psf=config['center_box_psf'], box_waffle=config['center_box_waffle'], @@ -1388,14 +1389,18 @@ def sph_ird_preprocess_science(self, self._status = sphere.INCOMPLETE - def sph_ird_star_center(self, high_pass=False, offset=(0, 0), box_psf=60, box_waffle=16, plot=True): + def sph_ird_star_center(self, high_pass_psf=False, high_pass_waffle=False, offset=(0, 0), box_psf=60, box_waffle=16, plot=True): '''Determines the star center for all frames where a center can be determined (OBJECT,CENTER and OBJECT,FLUX) Parameters ---------- - high_pass : bool - Apply high-pass filter to the image before searching for the satelitte spots. + high_pass_psf : bool + Apply high-pass filter to the PSF image before searching for the center. + Default is False + + high_pass_waffle : bool + Apply high-pass filter to the center image before searching for the waffle spots. Default is False offset : tuple @@ -1446,12 +1451,12 @@ def sph_ird_star_center(self, high_pass=False, offset=(0, 0), box_psf=60, box_wa # centers if plot: - save_path = path.products / '{}_PSF_fitting.pdf'.format(fname) + save_path = path.products / '{}_psf_fitting.pdf'.format(fname) else: save_path = None img_center = toolbox.star_centers_from_PSF_img_cube(cube, wave, pixel, exclude_fraction=0.3, - box_size=box_psf, save_path=save_path, - logger=self._logger) + high_pass=high_pass_psf, box_size=box_psf, + save_path=save_path, logger=self._logger) # save self._logger.debug('> save centers') @@ -1479,12 +1484,12 @@ def sph_ird_star_center(self, high_pass=False, offset=(0, 0), box_psf=60, box_wa waffle_orientation = hdr['HIERARCH ESO OCS WAFFLE ORIENT'] self._logger.debug('> waffle orientation: {}'.format(waffle_orientation)) if plot: - save_path = path.products / '{}_spots_fitting.pdf'.format(fname) + save_path = path.products / '{}_waffle_fitting.pdf'.format(fname) else: save_path = None spot_center, spot_dist, img_center \ = toolbox.star_centers_from_waffle_img_cube(cube, wave, waffle_orientation, center_guess, - pixel, orientation_offset, high_pass=high_pass, + pixel, orientation_offset, high_pass=high_pass_waffle, center_offset=offset, box_size=box_waffle, coro=coro, save_path=save_path, logger=self._logger) diff --git a/sphere/IRDIS/SpectroReduction.py b/sphere/IRDIS/SpectroReduction.py index fd0995d..65a529d 100644 --- a/sphere/IRDIS/SpectroReduction.py +++ b/sphere/IRDIS/SpectroReduction.py @@ -406,7 +406,8 @@ def process_science(self): config = self.config - self.sph_ird_star_center(high_pass=config['center_high_pass'], + self.sph_ird_star_center(high_pass_psf=config['center_high_pass_psf'], + high_pass_waffle=config['center_high_pass_waffle'], box_psf=config['center_box_psf'], box_waffle=config['center_box_waffle'], plot=config['misc_plot']) @@ -1616,14 +1617,18 @@ def sph_ird_preprocess_science(self, self._status = sphere.INCOMPLETE - def sph_ird_star_center(self, high_pass=False, box_psf=40, box_waffle=240, plot=True): + def sph_ird_star_center(self, high_pass_psf=False, high_pass_waffle=False, box_psf=40, box_waffle=240, plot=True): '''Determines the star center for all frames where a center can be determined (OBJECT,CENTER and OBJECT,FLUX) Parameters ---------- - high_pass : bool - Apply high-pass filter to the image before searching for the satelitte spots. + high_pass_psf : bool + Apply high-pass filter to the PSF image before searching for the center. + Default is False + + high_pass_waffle : bool + Apply high-pass filter to the center image before searching for the waffle spots. Default is False box_psf : int @@ -1680,11 +1685,11 @@ def sph_ird_star_center(self, high_pass=False, box_psf=40, box_waffle=240, plot= # centers if plot: - save_path = path.products / '{}_PSF_fitting.pdf'.format(fname) + save_path = path.products / '{}_psf_fitting.pdf'.format(fname) else: save_path = None - psf_center = toolbox.star_centers_from_PSF_lss_cube(cube, wave_lin, pixel, box_size=box_psf, - save_path=save_path, logger=self._logger) + psf_center = toolbox.star_centers_from_PSF_lss_cube(cube, wave_lin, pixel, high_pass=high_pass_psf, + box_size=box_psf, save_path=save_path, logger=self._logger) # save self._logger.debug('> save centers') @@ -1715,12 +1720,12 @@ def sph_ird_star_center(self, high_pass=False, box_psf=40, box_waffle=240, plot= # centers if plot: - save_path = path.products / '{}_spots_fitting.pdf'.format(fname) + save_path = path.products / '{}_waffle_fitting.pdf'.format(fname) else: save_path = None spot_centers, spot_dist, img_centers \ = toolbox.star_centers_from_waffle_lss_cube(cube_cen, cube_sci, wave_lin, centers, pixel, - high_pass=high_pass, save_path=save_path, + high_pass=high_pass_waffle, save_path=save_path, box_size=box_waffle, logger=self._logger) # save diff --git a/sphere/instruments/IFS.ini b/sphere/instruments/IFS.ini index cb0af1b..a0dea17 100644 --- a/sphere/instruments/IFS.ini +++ b/sphere/instruments/IFS.ini @@ -43,7 +43,8 @@ preproc_collapse_psf = True preproc_collapse_center = True # center -center_high_pass = False +center_high_pass_psf = False +center_high_pass_waffle = False center_offset = (-3, 0) center_box_psf = 60 center_box_waffle = 16 diff --git a/sphere/instruments/IRDIS.ini b/sphere/instruments/IRDIS.ini index aa63198..3f47e12 100644 --- a/sphere/instruments/IRDIS.ini +++ b/sphere/instruments/IRDIS.ini @@ -60,7 +60,8 @@ preproc_collapse_psf = True preproc_collapse_center = True # center -center_high_pass = False +center_high_pass_psf = False +center_high_pass_waffle = False center_offset = (0, 0) center_box_psf = 60 center_box_waffle = 16 @@ -93,7 +94,8 @@ preproc_collapse_psf = True preproc_collapse_center = True # center -center_high_pass = False +center_high_pass_psf = False +center_high_pass_waffle = False center_box_psf = 40 center_box_waffle = 240 diff --git a/sphere/toolbox.py b/sphere/toolbox.py index b67ff42..cbfb597 100644 --- a/sphere/toolbox.py +++ b/sphere/toolbox.py @@ -489,8 +489,8 @@ def lines_intersect(a1, a2, b1, b2): return (num / denom)*db + b1 -def star_centers_from_PSF_img_cube(cube, wave, pixel, exclude_fraction=0.1, box_size=60, - save_path=None, logger=_log): +def star_centers_from_PSF_img_cube(cube, wave, pixel, exclude_fraction=0.1, high_pass=False, + box_size=60, save_path=None, logger=_log): ''' Compute star center from PSF images (IRDIS CI, IRDIS DBI, IFS) @@ -509,6 +509,10 @@ def star_centers_from_PSF_img_cube(cube, wave, pixel, exclude_fraction=0.1, box_ Exclude a fraction of the image borders to avoid getting biased by hot pixels close to the edges. Default is 10% + high_pass : bool + Apply high-pass filter to the PSF image before searching for the center. + Default is False + box_size : int Size of the box in which the fit is performed. Default is 60 pixels @@ -541,8 +545,13 @@ def star_centers_from_PSF_img_cube(cube, wave, pixel, exclude_fraction=0.1, box_ logger.info(' ==> wave {0:2d}/{1:2d} ({2:4.0f} nm)'.format(idx+1, nwave, cwave)) # remove any NaN - img = np.nan_to_num(img) - + img = np.nan_to_num(cube[idx]) + + # optional high-pass filter + if high_pass: + img = img - ndimage.median_filter(img, 15, mode='mirror') + cube[idx] = img + # center guess cy, cx = np.unravel_index(np.argmax(img), img.shape) @@ -551,7 +560,7 @@ def star_centers_from_PSF_img_cube(cube, wave, pixel, exclude_fraction=0.1, box_ lf = exclude_fraction hf = 1-exclude_fraction if (cx <= lf*dim[-1]) or (cx >= hf*dim[-1]) or \ - (cy <= lf*dim[0]) or (cy >= hf*dim[0]): + (cy <= lf*dim[0]) or (cy >= hf*dim[0]): nimg = img.copy() nimg[:, :int(lf*dim[-1])] = 0 nimg[:, int(hf*dim[-1]):] = 0 @@ -650,7 +659,7 @@ def star_centers_from_PSF_img_cube(cube, wave, pixel, exclude_fraction=0.1, box_ return img_centers -def star_centers_from_PSF_lss_cube(cube, wave_cube, pixel, box_size=40, save_path=None, logger=_log): +def star_centers_from_PSF_lss_cube(cube, wave_cube, pixel, high_pass=False, box_size=40, save_path=None, logger=_log): ''' Compute star center from PSF LSS spectra (IRDIS LSS) @@ -665,6 +674,10 @@ def star_centers_from_PSF_lss_cube(cube, wave_cube, pixel, box_size=40, save_pat pixel : float Pixel scale, in mas/pixel + high_pass : bool + Apply high-pass filter to the PSF image before searching for the center. + Default is False + box_size : int Width of the box in which the fit is performed. Default is 16 pixels @@ -698,6 +711,10 @@ def star_centers_from_PSF_lss_cube(cube, wave_cube, pixel, box_size=40, save_pat # remove any NaN img = np.nan_to_num(cube[fidx]) + # optional high-pass filter + if high_pass: + img = img - ndimage.median_filter(img, 15, mode='mirror') + # approximate center prof = np.sum(img, axis=0) cx_int = np.int(np.argmax(prof)) @@ -758,7 +775,7 @@ def star_centers_from_PSF_lss_cube(cube, wave_cube, pixel, box_size=40, save_pat def star_centers_from_waffle_img_cube(cube_cen, wave, waffle_orientation, center_guess, pixel, - orientation_offset, high_pass=False, center_offset=(0, 0), + orientation_offset, high_pass=False, center_offset=(0, 0), box_size=16, smooth=0, coro=True, save_path=None, logger=_log): ''' Compute star center from waffle images (IRDIS CI, IRDIS DBI, IFS) From 90e094016de475d8bb58fdbe518ac96c9ad7cfd8 Mon Sep 17 00:00:00 2001 From: Arthur Vigan Date: Sat, 19 Dec 2020 19:32:06 +0100 Subject: [PATCH 07/16] Add ASCL badge to read me file --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 365413a..c199559 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ VLT/SPHERE ========== + +ascl:2009.002 + Information ----------- @@ -65,4 +68,4 @@ With important contributions from: * Julien Milli (IPAG/UGA): Support of SPARTA files * Jean-Françoise Sauvage (ONERA): Support of SPARTA files * Dino Mesa (INAF/OAPD): IFS pre-processing - * ESO personnel in general: SPHERE pipeline and calibration procedures \ No newline at end of file + * ESO personnel in general: SPHERE pipeline and calibration procedures From 37da8262141255c5a8cbe776a744091f88c22eb0 Mon Sep 17 00:00:00 2001 From: Arthur Vigan Date: Sat, 19 Dec 2020 19:55:00 +0100 Subject: [PATCH 08/16] Add some badges from shields.io --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c199559..040b87f 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,13 @@ VLT/SPHERE ========== - -ascl:2009.002 +[](https://github.com/avigan/SPHERE/releases/tag/v1.3) + +[](https://github.com/avigan/SPHERE/releases/tag/v1.3) + +[](https://github.com/avigan/SPHERE/blob/master/LICENSE) + +[ascl:2009.002](https://ascl.net/2009.002) Information ----------- From 82ef20b6706a043c8d76584ed6f2fe82eb5ba74c Mon Sep 17 00:00:00 2001 From: Arthur Vigan Date: Sat, 19 Dec 2020 19:57:38 +0100 Subject: [PATCH 09/16] More badges --- README.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/README.md b/README.md index 040b87f..536f189 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,7 @@ VLT/SPHERE ========== -[](https://github.com/avigan/SPHERE/releases/tag/v1.3) - -[](https://github.com/avigan/SPHERE/releases/tag/v1.3) - -[](https://github.com/avigan/SPHERE/blob/master/LICENSE) - -[ascl:2009.002](https://ascl.net/2009.002) +[](https://pypi.org/project/vlt-sphere/) [](https://github.com/avigan/SPHERE/releases/tag/v1.3) [](https://github.com/avigan/SPHERE/releases/tag/v1.3) [](https://github.com/avigan/SPHERE/blob/master/LICENSE) [ascl:2009.002](https://ascl.net/2009.002) Information ----------- From c92dc4ae0b3354317b8bf258fc9db35a7db1523e Mon Sep 17 00:00:00 2001 From: Arthur Vigan Date: Sat, 19 Dec 2020 19:59:48 +0100 Subject: [PATCH 10/16] More badges --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 536f189..1ac260b 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ VLT/SPHERE ========== -[](https://pypi.org/project/vlt-sphere/) [](https://github.com/avigan/SPHERE/releases/tag/v1.3) [](https://github.com/avigan/SPHERE/releases/tag/v1.3) [](https://github.com/avigan/SPHERE/blob/master/LICENSE) [ascl:2009.002](https://ascl.net/2009.002) +[](https://pypi.org/project/vlt-sphere/) [](https://github.com/avigan/SPHERE/releases/tag/v1.3) [](https://github.com/avigan/SPHERE/releases/tag/v1.3) [](https://github.com/avigan/SPHERE/blob/master/LICENSE) [ascl:2009.002](https://ascl.net/2009.002) [](https://ui.adsabs.harvard.edu/abs/2020ascl.soft09002V/abstract) Information ----------- From fcbf6139d96babd6606b9081b372b509e7ad46f4 Mon Sep 17 00:00:00 2001 From: Arthur Vigan Date: Sat, 19 Dec 2020 20:02:54 +0100 Subject: [PATCH 11/16] Add required credit in README --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1ac260b..a02a49a 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,11 @@ The package is not fully documented, but [examples are provided](https://github. Credits ------- -The development of the SPHERE instrument has demanded a tremendous effort from many scientists, who have devoted several years of their life to design, build, test and commission the instrument. To recognize this work, we kindly ask you to cite the relevant instrumental papers in your scientific work. The reference papers for the instrument and its observing mode are: +Please cite the following reference if you use this pipeline in a scientific publication: + +[Vigan, 2020, ASCL, ascl:2009.002](https://ui.adsabs.harvard.edu/abs/2020ascl.soft09002V/abstract) + +Moreover, the development of the SPHERE instrument has demanded a tremendous effort from many scientists, who have devoted several years of their life to design, build, test and commission the instrument. To recognize this work, we kindly ask you to cite the relevant instrumental papers in your scientific work. The reference papers for the instrument and its observing mode are: SPHERE: * General description: [Beuzit et al., 2019, A&A, 631, A155](https://ui.adsabs.harvard.edu/abs/2019A%26A...631A.155B/abstract) From 6e40956a8e0d69547e3b9ab5916a4986bfc92ddc Mon Sep 17 00:00:00 2001 From: Arthur Vigan Date: Sat, 19 Dec 2020 20:04:08 +0100 Subject: [PATCH 12/16] Small layout fix --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a02a49a..0e84477 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ Credits Please cite the following reference if you use this pipeline in a scientific publication: -[Vigan, 2020, ASCL, ascl:2009.002](https://ui.adsabs.harvard.edu/abs/2020ascl.soft09002V/abstract) +* [Vigan, 2020, ASCL, ascl:2009.002](https://ui.adsabs.harvard.edu/abs/2020ascl.soft09002V/abstract) Moreover, the development of the SPHERE instrument has demanded a tremendous effort from many scientists, who have devoted several years of their life to design, build, test and commission the instrument. To recognize this work, we kindly ask you to cite the relevant instrumental papers in your scientific work. The reference papers for the instrument and its observing mode are: From b309151b6833efc189cfdc20381a6aa16366f8fe Mon Sep 17 00:00:00 2001 From: Arthur Vigan Date: Sat, 19 Dec 2020 20:07:41 +0100 Subject: [PATCH 13/16] Python badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0e84477..f157623 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ VLT/SPHERE ========== -[](https://pypi.org/project/vlt-sphere/) [](https://github.com/avigan/SPHERE/releases/tag/v1.3) [](https://github.com/avigan/SPHERE/releases/tag/v1.3) [](https://github.com/avigan/SPHERE/blob/master/LICENSE) [ascl:2009.002](https://ascl.net/2009.002) [](https://ui.adsabs.harvard.edu/abs/2020ascl.soft09002V/abstract) + [](https://pypi.org/project/vlt-sphere/) [](https://github.com/avigan/SPHERE/releases/tag/v1.3) [](https://github.com/avigan/SPHERE/releases/tag/v1.3) [](https://github.com/avigan/SPHERE/blob/master/LICENSE) [ascl:2009.002](https://ascl.net/2009.002) [](https://ui.adsabs.harvard.edu/abs/2020ascl.soft09002V/abstract) Information ----------- From 509e8d617758b2f78f7f5cd92a2a0a8d847075fe Mon Sep 17 00:00:00 2001 From: Arthur Vigan Date: Sat, 19 Dec 2020 20:09:03 +0100 Subject: [PATCH 14/16] Adjust ADS badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f157623..83947a3 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ VLT/SPHERE ========== - [](https://pypi.org/project/vlt-sphere/) [](https://github.com/avigan/SPHERE/releases/tag/v1.3) [](https://github.com/avigan/SPHERE/releases/tag/v1.3) [](https://github.com/avigan/SPHERE/blob/master/LICENSE) [ascl:2009.002](https://ascl.net/2009.002) [](https://ui.adsabs.harvard.edu/abs/2020ascl.soft09002V/abstract) + [](https://pypi.org/project/vlt-sphere/) [](https://github.com/avigan/SPHERE/releases/tag/v1.3) [](https://github.com/avigan/SPHERE/releases/tag/v1.3) [](https://github.com/avigan/SPHERE/blob/master/LICENSE) [ascl:2009.002](https://ascl.net/2009.002) [](https://ui.adsabs.harvard.edu/abs/2020ascl.soft09002V/abstract) Information ----------- From 485bb68e92b603b6519e1d042a13e9c2c784802b Mon Sep 17 00:00:00 2001 From: Arthur Vigan Date: Tue, 29 Dec 2020 18:46:04 +0100 Subject: [PATCH 15/16] Add warning message about true North correction in examples --- examples/ifs_reduction.py | 13 +++++++++++++ examples/irdis_imaging_reduction.py | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/examples/ifs_reduction.py b/examples/ifs_reduction.py index 04de5cf..af42a5d 100644 --- a/examples/ifs_reduction.py +++ b/examples/ifs_reduction.py @@ -1,5 +1,18 @@ import sphere.IFS as IFS +##################################################################### +# Starting in the present version of the pipeline, the default # +# -1.75° true North offset is automatically added to the derotation # +# angles. The offset value can be modified in the configuration of # +# the reduction: # +# # +# >>> reduction.config[\'cal_true_north\'] = xxx # +# # +# To avoid any issues, make sure to: # +# * either reprocess data previously processed with version <1.4 # +# * or take into account the offset in your astrometric analysis # +##################################################################### + ####################################################@ # full reduction # diff --git a/examples/irdis_imaging_reduction.py b/examples/irdis_imaging_reduction.py index a0b7cf9..aa8ef10 100644 --- a/examples/irdis_imaging_reduction.py +++ b/examples/irdis_imaging_reduction.py @@ -1,5 +1,18 @@ import sphere.IRDIS as IRDIS +##################################################################### +# Starting in the present version of the pipeline, the default # +# -1.75° true North offset is automatically added to the derotation # +# angles. The offset value can be modified in the configuration of # +# the reduction: # +# # +# >>> reduction.config[\'cal_true_north\'] = xxx # +# # +# To avoid any issues, make sure to: # +# * either reprocess data previously processed with version <1.4 # +# * or take into account the offset in your astrometric analysis # +##################################################################### + ####################################################@ # full reduction # From 1963b4f6f625ad073a2153c77cb8726de76f8186 Mon Sep 17 00:00:00 2001 From: Arthur Vigan Date: Tue, 29 Dec 2020 18:47:22 +0100 Subject: [PATCH 16/16] Bump version numbers to 1.4 --- setup.py | 2 +- sphere/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index db4417c..3a5cc7f 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ # setup setup( name='vlt-sphere', - version='1.3', + version='1.4', description='Reduction and analysis code for the VLT/SPHERE instrument', long_description=long_description, long_description_content_type='text/markdown', diff --git a/sphere/__init__.py b/sphere/__init__.py index 46c3580..63ab25f 100644 --- a/sphere/__init__.py +++ b/sphere/__init__.py @@ -1,7 +1,7 @@ __author__ = 'Arthur Vigan' __copyright__ = 'Copyright (C) 2017-2021 Arthur Vigan' __license__ = 'MIT' -__version__ = '1.3' +__version__ = '1.4' import logging import enum