Loading observation_sim/instruments/chip/chip_utils.py +1 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ import os import galsim import ctypes import numpy as np from scipy import stats from astropy.io import fits from observation_sim.instruments.chip import effects Loading observation_sim/mock_objects/SpecDisperser/SpecDisperser.py +15 −15 Original line number Diff line number Diff line Loading @@ -163,10 +163,10 @@ class SpecDisperser(object): ) # Account for pixel centering of the trace yfrac_beam = ytrace_beam - floor(ytrace_beam + 0.5) yfrac_beam = ytrace_beam - np.floor(ytrace_beam + 0.5) ysens = lam_beam * 0 lam_index = argsort(lam_beam) lam_index = np.argsort(lam_beam) conf_sens = self.grating_conf.sens[beam] lam_intep = np.linspace( Loading Loading @@ -199,19 +199,19 @@ class SpecDisperser(object): sensitivity_beam = ysens len_spec_x = len(dx) len_spec_y = int(abs(ceil(ytrace_beam[-1]) - floor(ytrace_beam[0])) + 1) len_spec_y = int(abs(np.ceil(ytrace_beam[-1]) - np.floor(ytrace_beam[0])) + 1) beam_sh = (self.img_sh[0] + len_spec_y, self.img_sh[1] + len_spec_x) modelf = zeros(product(beam_sh), dtype=float) modelf = np.zeros(np.product(beam_sh), dtype=float) model = modelf.reshape(beam_sh) idx = np.arange(modelf.size, dtype=int64).reshape(beam_sh) x0 = array((self.thumb_y, self.thumb_x), dtype=int64) idx = np.arange(modelf.size, dtype=np.int64).reshape(beam_sh) x0 = np.array((self.thumb_y, self.thumb_x), dtype=np.int64) dxpix = dx - dx[0] + x0[1] dyc = cast[int](np.floor(ytrace_beam + 0.5)) dyc = np.cast[int](np.floor(ytrace_beam + 0.5)) # dypix = cast[int](np.floor(ytrace_beam - dyc[0] + x0[0] + 0.5)) # dypix = np.cast[int](np.floor(ytrace_beam - dyc[0] + x0[0] + 0.5)) dypix = dyc - dyc[0] + x0[0] frac_ids = yfrac_beam < 0 Loading @@ -223,7 +223,7 @@ class SpecDisperser(object): nonz = sensitivity_beam != 0 origin_in = zeros_like(self.origin) origin_in = np.zeros_like(self.origin) dx0_in = dx[0] dy0_in = dyc[0] if self.isAlongY == 1: Loading @@ -242,9 +242,9 @@ class SpecDisperser(object): if self.flat_cube is None: beam_flat = None else: beam_flat = zeros([len(modelf), len(self.flat_cube)]) beam_flat = np.zeros([len(modelf), len(self.flat_cube)]) sub_flat_cube = zeros([len(self.flat_cube), beam_sh[0], beam_sh[1]]) sub_flat_cube = np.zeros([len(self.flat_cube), beam_sh[0], beam_sh[1]]) sub_flat_cube[0] = sub_flat_cube[0] + 1.0 overlap_flag = 1 Loading Loading @@ -278,7 +278,7 @@ class SpecDisperser(object): beam_x_s - originOut_x : beam_x_e - originOut_x + 1, ] = self.flat_cube[:, beam_y_s : beam_y_e + 1, beam_x_s : beam_x_e + 1] for i in arange(0, len(self.flat_cube), 1): for i in np.arange(0, len(self.flat_cube), 1): beam_flat[:, i] = sub_flat_cube[i].flatten() # beam_flat = zeros([len(modelf), len(self.flat_cube)]) # flat_sh = self.flat_cube[0].shape Loading @@ -299,8 +299,8 @@ class SpecDisperser(object): sensitivity_beam[nonz], modelf, x0, array(self.img_sh, dtype=int64), array(beam_sh, dtype=int64), np.array(self.img_sh, dtype=np.int64), np.array(beam_sh, dtype=np.int64), beam_flat, lam_beam[lam_index][nonz], ) Loading Loading @@ -331,7 +331,7 @@ class SpecDisperser(object): sens_file_name = conffile[0:-5] + "_sensitivity_" + orders[beam] + ".fits" if os.path.exists(sens_file_name) is False: senstivity_out = Table( array([w, sens]).T, names=("WAVELENGTH", "SENSITIVITY") np.array([w, sens]).T, names=("WAVELENGTH", "SENSITIVITY") ) senstivity_out.write(sens_file_name, format="fits") Loading observation_sim/sim_steps/add_ghost.py +1 −0 Original line number Diff line number Diff line import galsim import traceback from observation_sim.mock_objects import Ghost from observation_sim.psf import FieldDistortion Loading pyproject.toml +2 −1 Original line number Diff line number Diff line Loading @@ -71,12 +71,13 @@ include = ["observation_sim*"] testpaths = ["tests"] [tool.ruff] preview = true line-length = 88 target-version = "py311" [tool.ruff.lint] select = ["E", "F", "W"] # E/W = PEP8, F = pyflakes ignore = ["E501"] # example: ignore line length if using black ignore = ["E501", "E203"] # example: ignore line length if using black [tool.ruff.format] quote-style = "double" Loading Loading
observation_sim/instruments/chip/chip_utils.py +1 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ import os import galsim import ctypes import numpy as np from scipy import stats from astropy.io import fits from observation_sim.instruments.chip import effects Loading
observation_sim/mock_objects/SpecDisperser/SpecDisperser.py +15 −15 Original line number Diff line number Diff line Loading @@ -163,10 +163,10 @@ class SpecDisperser(object): ) # Account for pixel centering of the trace yfrac_beam = ytrace_beam - floor(ytrace_beam + 0.5) yfrac_beam = ytrace_beam - np.floor(ytrace_beam + 0.5) ysens = lam_beam * 0 lam_index = argsort(lam_beam) lam_index = np.argsort(lam_beam) conf_sens = self.grating_conf.sens[beam] lam_intep = np.linspace( Loading Loading @@ -199,19 +199,19 @@ class SpecDisperser(object): sensitivity_beam = ysens len_spec_x = len(dx) len_spec_y = int(abs(ceil(ytrace_beam[-1]) - floor(ytrace_beam[0])) + 1) len_spec_y = int(abs(np.ceil(ytrace_beam[-1]) - np.floor(ytrace_beam[0])) + 1) beam_sh = (self.img_sh[0] + len_spec_y, self.img_sh[1] + len_spec_x) modelf = zeros(product(beam_sh), dtype=float) modelf = np.zeros(np.product(beam_sh), dtype=float) model = modelf.reshape(beam_sh) idx = np.arange(modelf.size, dtype=int64).reshape(beam_sh) x0 = array((self.thumb_y, self.thumb_x), dtype=int64) idx = np.arange(modelf.size, dtype=np.int64).reshape(beam_sh) x0 = np.array((self.thumb_y, self.thumb_x), dtype=np.int64) dxpix = dx - dx[0] + x0[1] dyc = cast[int](np.floor(ytrace_beam + 0.5)) dyc = np.cast[int](np.floor(ytrace_beam + 0.5)) # dypix = cast[int](np.floor(ytrace_beam - dyc[0] + x0[0] + 0.5)) # dypix = np.cast[int](np.floor(ytrace_beam - dyc[0] + x0[0] + 0.5)) dypix = dyc - dyc[0] + x0[0] frac_ids = yfrac_beam < 0 Loading @@ -223,7 +223,7 @@ class SpecDisperser(object): nonz = sensitivity_beam != 0 origin_in = zeros_like(self.origin) origin_in = np.zeros_like(self.origin) dx0_in = dx[0] dy0_in = dyc[0] if self.isAlongY == 1: Loading @@ -242,9 +242,9 @@ class SpecDisperser(object): if self.flat_cube is None: beam_flat = None else: beam_flat = zeros([len(modelf), len(self.flat_cube)]) beam_flat = np.zeros([len(modelf), len(self.flat_cube)]) sub_flat_cube = zeros([len(self.flat_cube), beam_sh[0], beam_sh[1]]) sub_flat_cube = np.zeros([len(self.flat_cube), beam_sh[0], beam_sh[1]]) sub_flat_cube[0] = sub_flat_cube[0] + 1.0 overlap_flag = 1 Loading Loading @@ -278,7 +278,7 @@ class SpecDisperser(object): beam_x_s - originOut_x : beam_x_e - originOut_x + 1, ] = self.flat_cube[:, beam_y_s : beam_y_e + 1, beam_x_s : beam_x_e + 1] for i in arange(0, len(self.flat_cube), 1): for i in np.arange(0, len(self.flat_cube), 1): beam_flat[:, i] = sub_flat_cube[i].flatten() # beam_flat = zeros([len(modelf), len(self.flat_cube)]) # flat_sh = self.flat_cube[0].shape Loading @@ -299,8 +299,8 @@ class SpecDisperser(object): sensitivity_beam[nonz], modelf, x0, array(self.img_sh, dtype=int64), array(beam_sh, dtype=int64), np.array(self.img_sh, dtype=np.int64), np.array(beam_sh, dtype=np.int64), beam_flat, lam_beam[lam_index][nonz], ) Loading Loading @@ -331,7 +331,7 @@ class SpecDisperser(object): sens_file_name = conffile[0:-5] + "_sensitivity_" + orders[beam] + ".fits" if os.path.exists(sens_file_name) is False: senstivity_out = Table( array([w, sens]).T, names=("WAVELENGTH", "SENSITIVITY") np.array([w, sens]).T, names=("WAVELENGTH", "SENSITIVITY") ) senstivity_out.write(sens_file_name, format="fits") Loading
observation_sim/sim_steps/add_ghost.py +1 −0 Original line number Diff line number Diff line import galsim import traceback from observation_sim.mock_objects import Ghost from observation_sim.psf import FieldDistortion Loading
pyproject.toml +2 −1 Original line number Diff line number Diff line Loading @@ -71,12 +71,13 @@ include = ["observation_sim*"] testpaths = ["tests"] [tool.ruff] preview = true line-length = 88 target-version = "py311" [tool.ruff.lint] select = ["E", "F", "W"] # E/W = PEP8, F = pyflakes ignore = ["E501"] # example: ignore line length if using black ignore = ["E501", "E203"] # example: ignore line length if using black [tool.ruff.format] quote-style = "double" Loading