/
Option 1: direct conversion from iraf to python
Option 1: direct conversion from iraf to python
Description
Option 1 would consist on implementing this into python. Most of this has been done already. But we probably need to review the code and compare it with this flowchart.
flow chart
This is a flow chart for dsimulator.
Some notes about it.
The input/output in light blue is in the sky plane. The input/output in green is the mask plane.
Iraf procedures are in CAPITAL letters.
The only use of actual distorsions is in LEN_SLITS. This procedure, which is triggered if ADJ_SLIT = YES, only affects the slit edges.
# Open X-Projection mapping
fdx = open (XPROJ_MAP, READ_ONLY, TEXT_FILE)
call gs_ingest (fdx, asfx, asfy)
......
# We will need to recalculate something ...
xlow = X2(sdat,ndx1) + SLIT_GAP(indat)
xupp = X1(sdat,ndx2) - SLIT_GAP(indat)
xcen = 0.5 * (xlow + xupp)
yas = Y2(sdat,ndx1)
dxlow = gseval (asfx, xcen, yas)
yas = Y1(sdat,ndx2)
dxupp = gseval (asfx, xcen, yas)
dxavg = 0.5 * (dxupp + dxlow)
dxlow = dxlow - dxavg
dxupp = dxupp - dxavg
call eprintf ("%6.3f %6.3f\n")
call pargr (dxlow)
call pargr (dxupp)
if (pc1 == CODE_AS) {
del1 = 0.
del2 = X1(sdat,ndx2) - xlow - (dxupp - dxlow)
} else if (pc2 == CODE_AS) {
del1 = xupp - X2(sdat,ndx1) + (dxlow - dxupp)
del2 = 0.
} else {
del1 = xcen - 0.5*SLIT_GAP(indat) - X2(sdat,ndx1) + dxlow
del2 = X1(sdat,ndx2) - (xcen + 0.5*SLIT_GAP(indat)) - dxupp
}
X2(sdat,ndx1) = X2(sdat,ndx1) + del1
if (del1 != 0. && RELPA(sdat,ndx1) != INDEF) {
tana = tan (RELPA(sdat,ndx1))
Y2(sdat,ndx1) = Y2(sdat,ndx1) + del1 * FLIP * tana
}
X1(sdat,ndx2) = X1(sdat,ndx2) - del2
if (del2 != 0. && RELPA(sdat,ndx2) != INDEF) {
tana = tan (RELPA(sdat,ndx2))
Y1(sdat,ndx2) = Y1(sdat,ndx2) - del2 * FLIP * tana
}
The other distorsion (based on an optical model of Keck) is done at GNOM_TO_DPROJ procedure.
#
# GNOM_TO_DPROJ: adjust gnomonic coords to curved surface, take projection
# onto plane, and apply distortion correction, resulting in distortion-
# adjusted projected coords ready for a vertical projection to slitmask.
# Double inputs, outputs; outputs may be the same arguments as inputs.
#
#####
## NB: We assume Sutin's ray trace is already producing radii to curved surface.
####
procedure gnom_to_dproj (xg, yg, xd, yd)
double xg, yg # x,y gnomonic projection
double xd, yd # returned x,y projected on plane (distorted)
double rho # radius of input angle (approx from h)
double cosa, sina # cos, sin of azimuth in image plane
begin
rho= sqrt (xg * xg + yg * yg)
cosa = yg / rho
sina = xg / rho
# Apply map gnomonic projection --> real telescope
rho = rho * (1. + DIST_C0 + DIST_C2 * rho * rho)
xd = rho * sina
yd = rho * cosa
end
In this procedure, DIST_C0 = 0.0e-4 and DIST_C2 = -1.111311e-8
, multiple selections available,
Related content
Option 2 : Implementation based on an empirical approach
Option 2 : Implementation based on an empirical approach
More like this
Calendar year 2022
Calendar year 2022
Read with this
2021-09-20 Meeting notes
2021-09-20 Meeting notes
More like this
2021-12-03 Meeting notes
2021-12-03 Meeting notes
More like this
dsim2 meeting 04/24/20
dsim2 meeting 04/24/20
More like this
2021-08-06 Meeting notes
2021-08-06 Meeting notes
More like this