Skip to content

Commit

Permalink
Merge pull request #149 from LSSTDESC/v3.1.0
Browse files Browse the repository at this point in the history
Flat and star_field
  • Loading branch information
jeremyneveu authored Nov 14, 2024
2 parents c0fd560 + 5322c06 commit 1ab853e
Show file tree
Hide file tree
Showing 33 changed files with 4,753 additions and 2,286 deletions.
6 changes: 4 additions & 2 deletions config/auxtel.ini
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ SPECTRACTOR_FIT_TIMEOUT_PER_ITER = 1200
SPECTRACTOR_FIT_TIMEOUT = 7200
# library to compute atmospheric transmission: none, libradtran, getobsatmo
SPECTRACTOR_ATMOSPHERE_SIM = getobsatmo
# simulate star field with Gaia catalog: False, True
SPECTRACTOR_SIMULATE_STARFIELD = False

[instrument]
# instrument name
Expand Down Expand Up @@ -55,7 +57,7 @@ CCD_PIXEL2ARCSEC = 0.0952
# approximate maximum ADU output of the CCD
CCD_MAXADU = 170000
# electronic gain : elec/ADU
CCD_GAIN = 1.1
CCD_GAIN = 1.3
# rebinning of the image in pixel
CCD_REBIN = 2

Expand Down Expand Up @@ -107,7 +109,7 @@ PIXWIDTH_BACKGROUND = 40
PIXWIDTH_BOXSIZE = 20

[PSF]
# the PSF model: Gauss, Moffat or MoffatGauss
# the PSF model: Gauss, Moffat, DoubleMoffat or MoffatGauss
PSF_TYPE = Moffat
# the order of the polynomials to model wavelength dependence of the PSF shape parameters
PSF_POLY_ORDER = 2
Expand Down
6 changes: 4 additions & 2 deletions config/ctio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ SPECTRACTOR_DECONVOLUTION_PSF2D = True
SPECTRACTOR_DECONVOLUTION_FFM = True
# library to compute atmospheric transmission: none, libradtran, getobsatmo
SPECTRACTOR_ATMOSPHERE_SIM = none
# simulate star field with Gaia catalog: False, True
SPECTRACTOR_SIMULATE_STARFIELD = True

[instrument]
# instrument name
Expand Down Expand Up @@ -99,10 +101,10 @@ PIXWIDTH_BACKGROUND = 100
PIXWIDTH_BOXSIZE = 40

[PSF]
# the PSF model: Gauss, Moffat or MoffatGauss
# the PSF model: Gauss, Moffat, DoubleMoffat, or MoffatGauss
PSF_TYPE = Moffat
# the order of the polynomials to model wavelength dependence of the PSF shape parameters
PSF_POLY_ORDER = 4
PSF_POLY_ORDER = 2
# regularisation parameter for the chisq minimisation to extract the spectrum
PSF_FIT_REG_PARAM = 0.04
# step size in pixels for the first transverse PSF1D fit
Expand Down
6 changes: 5 additions & 1 deletion config/default.ini
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ SPECTRACTOR_FIT_TIMEOUT_PER_ITER = 600
SPECTRACTOR_FIT_TIMEOUT = 3600
# library to compute atmospheric transmission: none, libradtran, getobsatmo
SPECTRACTOR_ATMOSPHERE_SIM = none
# simulate star field with Gaia catalog: False, True
SPECTRACTOR_SIMULATE_STARFIELD = False

[instrument]
# instrument name
Expand Down Expand Up @@ -113,12 +115,14 @@ PIXWIDTH_BACKGROUND = 40
PIXWIDTH_BOXSIZE = 20

[PSF]
# the PSF model: Gauss, Moffat or MoffatGauss
# the PSF model: Gauss, Moffat, DoubleMoffat or MoffatGauss
PSF_TYPE = Moffat
# the order of the polynomials to model wavelength dependence of the PSF shape parameters
PSF_POLY_ORDER = 2
# regularisation parameter for the chisq minimisation to extract the spectrum
PSF_FIT_REG_PARAM = 0.01
# polynomial type: must be polynomial or legendre
PSF_POLY_TYPE = polynomial

[detection line algorithm parameters]
# order of the background polynome to fit
Expand Down
2 changes: 1 addition & 1 deletion runImageSim.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@
continue

image = ImageSim(file_name, spectrum_file_name, args.output_directory, A2=1,
psf_poly_params=psf_poly_params, with_stars=False)
psf_poly_params=psf_poly_params, with_starfield=False)
2 changes: 1 addition & 1 deletion runSimulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@
atmgrid = AtmosphereGrid(file_name)
image = ImageSim(file_name, spectrum_file_name, args.output_directory, A1=1, A2=1,
pwv=5, ozone=300, aerosols=0.03,
psf_poly_params=None, with_stars=True)
psf_poly_params=None, with_starfield=True)
sim_file_name = args.output_directory + tag.replace('reduc_', 'sim_')
Spectractor(sim_file_name, args.output_directory, target, [xpos, ypos], disperser_label, args.config)
2 changes: 1 addition & 1 deletion spectractor/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

__version__ = '3.0.3'
__version__ = '3.1.0'
__version_info__ = tuple(map(int, __version__.split('.')))
4 changes: 4 additions & 0 deletions spectractor/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ def load_config(config_filename, rebin=True):
if parameters.PIXWIDTH_BOXSIZE > parameters.PIXWIDTH_BACKGROUND:
raise ValueError(f'parameters.PIXWIDTH_BOXSIZE must be smaller than parameters.PIXWIDTH_BACKGROUND (or equal).')

# check consistency
if parameters.PSF_POLY_TYPE not in ["polynomial", "legendre"]:
raise ValueError(f'parameters.PSF_POLY_TYPE must be either "polynomial" or "legendre". Got {parameters.PSF_POLY_TYPE=}')

# check presence of atmospheric simulation packages
if parameters.SPECTRACTOR_ATMOSPHERE_SIM.lower() not in ["none", "libradtran", "getobsatmo"]:
raise ValueError(f'parameters.SPECTRACTOR_ATMOSPHERE_SIM must be either ["none", "libradtran", "getobsatmo"]. '
Expand Down
4 changes: 2 additions & 2 deletions spectractor/extractor/background.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def make_source_mask(data, nsigma, npixels, mask=None, sigclip_sigma=3.0,
Parameters
----------
data : 2D `~numpy.ndarray`
data : np.ndarray
The 2D array of the image.
nsigma : float
The number of standard deviations per pixel above the ``background``
Expand Down Expand Up @@ -236,7 +236,7 @@ def extract_spectrogram_background_sextractor(data, err, ws=(20, 30), mask_signa
>>> from spectractor import parameters
>>> parameters.DEBUG = True
>>> psf = MoffatGauss()
>>> s0 = ChromaticPSF(psf, Nx=100, Ny=200, saturation=1000)
>>> s0 = ChromaticPSF(psf, Nx=100, Ny=300, saturation=1000)
>>> params = s0.generate_test_poly_params()
>>> saturation = params[-1]
>>> data = s0.evaluate(s0.set_pixels(mode="1D"), poly_params=params)
Expand Down
Loading

0 comments on commit 1ab853e

Please sign in to comment.