# Writing routines for COSMOS

# Writing routines for COSMOS

The COSMOS software does not do everything, and may very well not do the things
it does the way you would like. If you would like to customize the processing,
a good starting place would be with the output of **adjust-map**. The mapfile
produced by **adjust-map** provides all the information you need to extract the
spectral data, using any method you may chose. The information necessary to
locate any wavelength and slit position is given as a set of polynomials.

The mapfile has the following format:

Xdispersion = dirflat Fit orders = ord_disp ord_sag ord_tilt ord_sagit ord_len Scale ~ telscale Lambda = lamin lamax SLIT slitnum objectname LENGTH = slitlength CHIP chipnum slmax slmin lammin lammax nfint dispersion polynomial inverse-dispersionn polynomial sag polynomial tilt polynomial sagitta polynomial slit-length polynomial CHIP chipnum slmin slmax lammin lammax nfint . . . SLIT slitnum objectname . . . END

The first 4 lines give general parameters:

#### Xdispersion = *dirflat*

*dirflat* = 1 if the dispersion is along the x direction of the chips (i.e. along
the rows), otherwise *dirflat* = 0.

#### Fit orders = *ord_disp ord_sag ord_tilt ord_sagit ord_leni*

ord_disp | order of the dispersion fit, and the inverse dispersion fit |

ord_sag | order of the spectrum "sag" fit |

ord_tilt | order of the spectrum tilt fit |

ord_sagitta | order of the slit curvature fit |

ord_len | order of the slit length fit |

#### Scale ~ *telscale*

Image scale at CCD focal plane. (Hard-wired into map-spectra.)

#### Lambda = *lamin lamax*

Minimum and maximum wavelengths of spectrum fits in this file

For each slit, there is a line:

#### SLIT *slitnum objectname*

`slitnum`

is the sequence number, and objectname the name given in the SMF file.

Only well-behaved slits have the following data. A well--behaved slit is one in which both ends of the slit fall onto the same chip (the spectrum may well span several slits in the dispersion direction).

#### LENGTH = *slitlength*

`slitlength`

is the nominal length of the slit, in pixels

For each chip that the spectrum traverses, the following data are given:

#### CHIP *chipnum slmax slmin lammin lammax nfint*

chipnum | chip number |

slmin | distance to "left" end of slit from object, in pixels |

slmax | distance to "right" end of slit from object, in pixels |

lammin | minimum wavelength of spectrum on this chip |

lammax | maximum wavelength of spectrum on this chip |

nfint | an almost useless number; ignore |

Then for each chip that the spectrum traverses, SIX polynomial coefficients are given:

- The dispersion solution (wavelength as a polynomial function of pixel coordinate in the dispersion direction)
- The inverse of the dispersion solution (pixel coordinate in the dispersion direction, as a function of wavelength)
- The pixel coordinate orthogonal to the dispersion direction, as a function of wavelength (Note that the pixel coordinate along the slit is equal to the slit center only if the mask design places the object midway along the slit.)
- The tilt of the spectrum, in pixels, (i.e., the line curvature) as a function of wavelength
- Unused
- The slit-length, in pixels, as a function of wavelength