diff --git a/jwst/cube_build/cube_build_step.py b/jwst/cube_build/cube_build_step.py index 30da89f019..33a349eb8c 100755 --- a/jwst/cube_build/cube_build_step.py +++ b/jwst/cube_build/cube_build_step.py @@ -64,7 +64,7 @@ class CubeBuildStep (Step): search_output_file = boolean(default=false) output_use_model = boolean(default=true) # Use filenames in the output models suffix = string(default='s3d') - offset_file = string(default=None) + offset_file = string(default=None) # Filename containing a list of Ra and Dec offsets to apply to files. debug_spaxel = string(default='-1 -1 -1') # Default not used """ @@ -239,7 +239,7 @@ def process(self, input): # ________________________________________________________________________________ # If an offset file is provided do some basic checks on the file and its contents. # The offset list contains a matching list to the files in the association -# used in calspec3 (or offline cube building). +# used in calspec3 (for offline cube building). # Each row in the offset list contain a filename, ra offset and dec offset. # The offset list is an asdf file. self.offsets = None @@ -546,15 +546,15 @@ def read_user_input(self): # ________________________________________________________________________________ def check_offset_file(self): - """Read in an optional ra and dec offsets for each file. + """Read in an optional ra and dec offset for each file. Summary ---------- Check that is file is asdf file. - check the file has the correct format: + Check the file has the correct format using an local schema file. + The schema file, ifuoffset.schema.yaml, is located in the jwst/cube_build directory. For each file in the input assocation check that there is a corresponding file in the offset file. - Also check that each file in the offset list contain a ra offset and dec offset. """ @@ -565,7 +565,8 @@ def check_offset_file(self): af = asdf.open(self.offset_file, custom_schema=DATA_PATH/'ifuoffset.schema.yaml') except: schema_message = ('Validation Error for offset file. Fix the offset file. \n' + \ - 'The offset file needs to have the same number of elements the filename, raoffset and decoffset lists.\n' +\ + 'The offset file needs to have the same number of elements ' + \ + 'in the three lists: filename, raoffset and decoffset.\n' +\ 'The units need to provided and only arcsec is allowed.') raise Exception(schema_message) @@ -573,7 +574,9 @@ def check_offset_file(self): offset_filename = af['filename'] offset_ra = af['raoffset'] offset_dec = af['decoffset'] - + # Note: + # af['units'] is checked by the schema validation. It must be arcsec or a validation error occurs. + # check that all the file names in input_model are in the offset filename for model in self.input_models: file_check = model.meta.filename diff --git a/jwst/cube_build/ifu_cube.py b/jwst/cube_build/ifu_cube.py index 4d3d6a7128..97e0e64024 100644 --- a/jwst/cube_build/ifu_cube.py +++ b/jwst/cube_build/ifu_cube.py @@ -1738,8 +1738,7 @@ def map_miri_pixel_to_sky(self, input_model, this_par1, subtract_background, if offsets is not None: raoffset, decoffset = self.find_ra_dec_offset(input_model.meta.filename) log.info("Ra and Dec offset (arc seconds) applied to file :%8.6f, %8.6f, %s", - raoffset.value, - decoffset.value, input_model.meta.filename) + raoffset.value, decoffset.value, input_model.meta.filename) # check if background sky matching as been done in mrs_imatch step # If it has not been subtracted and the background has not been @@ -2442,6 +2441,10 @@ def find_ra_dec_offset(self, filename): # ******************************************************************************** def offset_coord(self, ra, dec, raoffset, decoffset): + """ Given an ra,dec and ra offset and dec offset, use astropy SkyCoord functions + to apply the offsets + """ + coord = SkyCoord(ra, dec, unit='deg') coord_new = coord.spherical_offsets_by(raoffset, decoffset)