diff --git a/webbpsf/detectors.py b/webbpsf/detectors.py index becb0e88..4eb5020d 100644 --- a/webbpsf/detectors.py +++ b/webbpsf/detectors.py @@ -606,9 +606,9 @@ def apply_miri_ifu_broadening(hdulist, options, slice_width=0.196): out = _miri_mrs_empirical_broadening(psf_model=hdulist[ext].data, alpha_width=alpha_width, beta_width=beta_width) if wavelen * 1e6 <= 7.5: amplitude_cruciform = get_mrs_cruciform_amplitude(wavelen * 1e6) - oversample_factor = hdulist[ext].header['DET_SAMP']/7 # optimised parameters with oversampling = 7 - fwhm_cruciform = constants.INSTRUMENT_IFU_BROADENING_PARAMETERS["MIRI"]["fwhm_cruciform"]*oversample_factor - offset_cruciform = constants.INSTRUMENT_IFU_BROADENING_PARAMETERS["MIRI"]["offset_cruciform"]*oversample_factor + oversample_factor = hdulist[ext].header['DET_SAMP'] / 7 # optimised parameters with oversampling = 7 + fwhm_cruciform = constants.INSTRUMENT_IFU_BROADENING_PARAMETERS["MIRI"]["fwhm_cruciform"] * oversample_factor + offset_cruciform = constants.INSTRUMENT_IFU_BROADENING_PARAMETERS["MIRI"]["offset_cruciform"] * oversample_factor out = _miri_mrs_empirical_cruciform(psf_model=out, amp=amplitude_cruciform, fwhm=fwhm_cruciform, x_0=offset_cruciform) @@ -695,7 +695,7 @@ def get_mrs_cruciform_amplitude(wavelen): Empirical amplitude of additional cruciform component in MIRI IFU data wavelen: wavelength (only applicable if wavelength < 7.5 um - see apply_miri_ifu_broadening) """ - return -0.16765378*wavelen + 1.23632423 # Patapis 2025 PSF paper + return -0.16765378 * wavelen + 1.23632423 # Patapis 2025 PSF paper def _round_up_to_odd_integer(value): @@ -738,4 +738,4 @@ def _miri_mrs_empirical_cruciform(psf_model, amp, fwhm, x_0): # TODO: extend algorithm to handle the datacube case psf_model_cruciform = np.apply_along_axis(lambda m: convolve(m, kernel_cruciform), axis=1, arr=psf_model) - return psf_model+amp*psf_model_cruciform + return psf_model + amp * psf_model_cruciform diff --git a/webbpsf/match_data.py b/webbpsf/match_data.py index 4fe926a1..4fcb927c 100644 --- a/webbpsf/match_data.py +++ b/webbpsf/match_data.py @@ -79,15 +79,16 @@ def setup_sim_to_match_file(filename_or_HDUList, verbose=True, plot=False, choic inferred_output_type, inferred_coord_system = infer_mrs_cube_type(filename_or_HDUList) if band == 'MULTIPLE' or inferred_output_type != 'band': warnings.warn(f"** The input file seems to be an MRS datacube with output_type='{inferred_output_type}', " - "combining multiple bands. Note that PSF models can be computed for only 1 band at a time. " - "You will need to make multiple PSF simulations to model the PSF in this dataset. For high " - "precision work, be aware of the small (<1 deg) rotation differences between the individual bands. **") + "combining multiple bands. Note that PSF models can be computed for only 1 band at a time. " + "You will need to make multiple PSF simulations to model the PSF in this dataset. For high " + "precision work, be aware of the small (<1 deg) rotation differences between the individual" + "bands. **") band = 'SHORT' # just pick one, arbitrarily if inferred_coord_system != 'ifualign': warnings.warn(f"** The input file seems to be an MRS datacube with coord_system='skyalign'. Note that PSF " - "models can be computed only for coord_system='ifualign'.. You will need to either re-reduce " - "your data using the ifualign coord_system (preferred) or rotate the PSF model based on the " - "position angle (less preferred, due to numerical interpolation noise). **") + "models can be computed only for coord_system='ifualign'.. You will need to either re-reduce " + "your data using the ifualign coord_system (preferred) or rotate the PSF model based on the " + "position angle (less preferred, due to numerical interpolation noise). **") band_lookup = {'SHORT': 'A', 'MEDIUM': 'B', 'LONG': 'C'} inst.band = str(ch) + band_lookup[band] @@ -241,9 +242,11 @@ def get_nrc_coron_mask_from_pps_apername(apname_pps): return image_mask + def infer_mrs_cube_type(filename, verbose=False): """attempt to infer cube coordinate system and output type from header metadata. - The cube_build step doesn't record in metadata several of its key input parameters; this function attempts to infer what their values were. + The cube_build step doesn't record in metadata several of its key input parameters; + this function attempts to infer what their values were. Returns (guessed_output_type, guessed_coord_system) """ diff --git a/webbpsf/opds.py b/webbpsf/opds.py index f0322b8f..5783fbb0 100644 --- a/webbpsf/opds.py +++ b/webbpsf/opds.py @@ -1752,7 +1752,7 @@ def _get_zernikes_for_ote_field_dep( # special case for MIRI: don't do the following warning specifically for the MRS field point since it's # a known issue that # point is slightly outside of the valid region. This specific case is benign and # it's not helpful to emit this warning for every MRS calculation ever - mrs_v2v3 = [-8.39108833, -5.32144667]*u.arcmin + mrs_v2v3 = [-8.39108833, -5.32144667] * u.arcmin is_mrs_fieldpoint = np.allclose(v2v3, mrs_v2v3, atol=0.01) if (clip_dist > 0.1 * u.arcsec) and not is_mrs_fieldpoint: