Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug auxtel #95

Merged
merged 4 commits into from
Apr 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion config/auxtel.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ SPECTRACTOR_COMPUTE_ROTATION_ANGLE = disperser
SPECTRACTOR_DECONVOLUTION_PSF2D = False
# deconvolve spectrogram with full forward model: False, True
SPECTRACTOR_DECONVOLUTION_FFM = True
# value of sigma clip parameter for the spectractor deconvolution process PSF2D and FFM
SPECTRACTOR_DECONVOLUTION_SIGMA_CLIP = 100

[instrument]
# instrument name
Expand All @@ -39,7 +41,7 @@ OBS_QUANTUM_EFFICIENCY = calexp_2020031500162-EMPTY_ronchi90lpmm-det000_auxtel_t
OBS_CAMERA_ROTATION = 0
# Camera (x,y) flip signs with respect to (north-up, east-left) system
OBS_CAMERA_DEC_FLIP_SIGN = 1
OBS_CAMERA_RA_FLIP_SIGN = -1
OBS_CAMERA_RA_FLIP_SIGN = 1

[CCD]
# size of the image in pixel # MFL: this number is wrong, and the CCD is not square
Expand Down
2 changes: 2 additions & 0 deletions config/default.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ SPECTRACTOR_COMPUTE_ROTATION_ANGLE = hessian
SPECTRACTOR_DECONVOLUTION_PSF2D = True
# deconvolve spectrogram with full forward model: False, True
SPECTRACTOR_DECONVOLUTION_FFM = True
# value of sigma clip parameter for the spectractor deconvolution process PSF2D and FFM
SPECTRACTOR_DECONVOLUTION_SIGMA_CLIP = 20

[instrument]
# instrument name
Expand Down
3 changes: 2 additions & 1 deletion spectractor/extractor/chromaticpsf.py
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,8 @@ def fit_chromatic_psf(self, data, bgd_model_func=None, data_errors=None, mode="1
w.set_mask(poly_params=w.poly_params)
# precise fit with sigma clipping
run_minimisation_sigma_clipping(w, method="newton", ftol=1 / (w.Nx * w.Ny), xtol=1e-6, niter=50,
fix=w.fixed, sigma_clip=20, niter_clip=3, verbose=verbose)
fix=w.fixed, sigma_clip=parameters.SPECTRACTOR_DECONVOLUTION_SIGMA_CLIP,
niter_clip=3, verbose=verbose)
else:
raise ValueError(f"Unknown fitting mode={mode}. Must be '1D' or '2D'.")

Expand Down
2 changes: 2 additions & 0 deletions spectractor/extractor/dispersers/holo4_003/NOTES
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- transmission.txt : measurements from LPNHE optical test bench using holo-4-003-diffraction-efficiencies-merged.npy
- ratio_order_2over1.txt : chimera with LPNHE opticl test bench measurements between 430 and 1000nm, then extrapolating with an hologram efficiency model fitted on data
816 changes: 800 additions & 16 deletions spectractor/extractor/dispersers/holo4_003/ratio_order_2over1.txt

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion spectractor/extractor/extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,8 @@ def run_ffm_minimisation(w, method="newton", niter=2):
for i in range(niter):
w.set_mask(psf_poly_params=w.p[w.psf_params_start_index:])
run_minimisation_sigma_clipping(w, "newton", epsilon, w.fixed, xtol=1e-5,
ftol=1 / w.data.size, sigma_clip=20, niter_clip=3)
ftol=1 / w.data.size, niter_clip=3,
sigma_clip=parameters.SPECTRACTOR_DECONVOLUTION_SIGMA_CLIP)
my_logger.info(f"\n\tNewton: total computation time: {time.time() - start}s")

if parameters.DEBUG:
Expand Down
2 changes: 1 addition & 1 deletion spectractor/extractor/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ def load_AUXTEL_image(image): # pragma: no cover
image.humidity = 40
if 'adu' in image.header['BUNIT']:
image.units = 'ADU'
parameters.OBS_CAMERA_ROTATION = 90 - float(image.header["ROTPA"])
parameters.OBS_CAMERA_ROTATION = 270 - float(image.header["ROTPA"])
if parameters.OBS_CAMERA_ROTATION > 360:
parameters.OBS_CAMERA_ROTATION -= 360
if parameters.OBS_CAMERA_ROTATION < -360:
Expand Down
1 change: 1 addition & 0 deletions spectractor/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def __getattr__(name):
SPECTRACTOR_COMPUTE_ROTATION_ANGLE = "hessian" # method to get image rotation angle: False, disperser, hessian
SPECTRACTOR_DECONVOLUTION_PSF2D = True # deconvolve spectrogram with simple 2D PSF analysis: False, True
SPECTRACTOR_DECONVOLUTION_FFM = True # deconvolve spectrogram with full forward model: False, True
SPECTRACTOR_DECONVOLUTION_SIGMA_CLIP = 20 # value of sigma clip parameter for the spectractor deconvolution process PSF2D and FFM

# Paths
mypath = os.path.dirname(__file__)
Expand Down