---
name: "xsh_lingain"
section: "7"
platform: "linux"
package: "cpl-plugin-xshoo-doc"
version: "3.5.0+dfsg-4"
release: "Debian 11 (Bullseye)"
platforms: ["linux"]
url: "https://new.carta.tech/xsh_lingain"
---

# xsh\_lingain(7)

Computes detector's gain/linearity-map

## NAME

xsh\_lingain - Computes detector's gain/linearity-map

## SYNOPSIS

esorex **xsh\_lingain** \[OPTIONS\] FILE.sof

## DESCRIPTION

This recipe computes detector linearity coefficients and gain Input Frames : \
   arm = UVB-VIS: \
   \- A set of n RAW linearity frames (Format=RAW, n \>=8, Tag = LINEARITY\_arm\_ON)\
   \- A set of n RAW bias frames (Format=RAW, n \>=1, Tag = LINEARITY\_arm\_OFF)\
   arm = NIR:\
   \- A set of n RAW linearity on frames (Format=RAW, n \>=8, Tag = LINEARITY\_arm\_ON)\
   \- A set of n RAW linearity off frames (Format=RAW, n \>=8, Tag = LINEARITY\_arm\_OFF)\
   \- \[OPTIONAL\] a static bad pixel map (PRO.CATG=BP\_MAP\_RP\_arm) \
   Note: on and off frames are taken in pairs sequence: OFF-ON-ON-OFF, \
   at least 16 frames.

Products : \
   \- A linearity map table, PRO.CATG = BP\_MAP\_LIN\_NIR\
   \- A gain table, PRO.CATG = GAIN\_INFO\
   \- A cube cointaining the linearity coefficients, PRO.CATG = COEFFS\_CUBE\_arm\
   \- A linearity map image (RAW format), PRO.CATG = RAW\_BP\_MAP\_NL\_arm\
   \- A linearity map image (PRE format), PRO.CATG = BP\_MAP\_NL\_arm

## OPTIONS

- **--keep-temp** *\<str\>*

  If ´no´, temporary files are deleted. (str; default: ´no´). The full name of this option for the EsoRex configuration file is **xsh.xsh\_lingain.keep-temp** \[default = *no*\].

- **--debug-level** *\<str\>*

  Additional xshooter debug level. One of ´none´, ´low´, ´medium´, ´high´ (str; default: ´none´). The full name of this option for the EsoRex configuration file is **xsh.xsh\_lingain.debug-level** \[default = *none*\].

- **--time-stamp** *\<bool\>*

  Add timestamp to product file name. (bool; default: False). The full name of this option for the EsoRex configuration file is **xsh.xsh\_lingain.time-stamp** \[default = *False*\].

- **--decode-bp** *\<int\>*

  Integer representation of the bits to be considered bad when decoding the bad pixel mask pixel values.   Most frequent codes relevant for the user:   0: good pixel,   8: pick-up noise,   16: cosmic-ray removed,   32: cosmic-ray unremoved,   128: calibration file defect, 256: hot pixel,   512: dark pixel,   4096: A/D converted saturation, 32768: non linear pixel,   1048576: extrapolated flux in NIR, 4194304: Interpolated flux during extraction. (int; default: 2144337919). The full name of this option for the EsoRex configuration file is **xsh.xsh\_lingain.decode-bp** \[default = *2144337919*\].

- **--method** *\<str\>*

  Method to be used when computing GAIN. Methods appliable: \<PTC \| MED\>. By default PTC method will be applied. (str; default: ´PTC´). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.method** \[default = *PTC*\].

- **--order** *\<int\>*

  Polynomial order for the fit (Linearity) (int; default: 3). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.order** \[default = *3*\].

- **--kappa** *\<float\>*

  Kappa value for the kappa-sigma clipping (Gain) (float; default: 3.0). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.kappa** \[default = *3.0*\].

- **--niter** *\<int\>*

  Number of iterations to compute rms (Gain) (int; default: 5). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.niter** \[default = *5*\].

- **--llx** *\<int\>*

  x coordinate of the lower-left point of the region of interest. If not modified, default value will be 1. (int; default: -1). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.llx** \[default = *-1*\].

- **--lly** *\<int\>*

  y coordinate of the lower-left point of the region of interest. If not modified, default value will be 1. (int; default: -1). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.lly** \[default = *-1*\].

- **--urx** *\<int\>*

  x coordinate of the upper-right point of the region of interest. If not modified, default value will be X dimension of the input image. (int; default: -1). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.urx** \[default = *-1*\].

- **--ury** *\<int\>*

  y coordinate of the upper-right point of the region of interest. If not modified, default value will be Y dimension of the input image. (int; default: -1). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.ury** \[default = *-1*\].

- **--ref\_level** *\<int\>*

  User reference level (int; default: 10000). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.ref\_level** \[default = *10000*\].

- **--intermediate** *\<bool\>*

  De-/Activate intermediate products (bool; default: False). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.intermediate** \[default = *False*\].

- **--autocorr** *\<bool\>*

  De-/Activate the autocorr option (bool; default: False). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.autocorr** \[default = *False*\].

- **--collapse** *\<bool\>*

  De-/Activate the collapse option (bool; default: True). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.collapse** \[default = *True*\].

- **--rescale** *\<bool\>*

  De-/Activate the image rescale option (bool; default: True). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.rescale** \[default = *True*\].

- **--pix2pix** *\<bool\>*

  De-/Activate the computation with pixel to pixel accuracy (bool; default: True). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.pix2pix** \[default = *True*\].

- **--bpmbin** *\<bool\>*

  De-/Activate the binary bpm option (bool; default: False). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.bpmbin** \[default = *False*\].

- **--m** *\<int\>*

  Maximum x-shift for the autocorr (int; default: 26). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.m** \[default = *26*\].

- **--filter** *\<int\>*

  Upper limit of Median flux to be filtered (int; default: -1). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.filter** \[default = *-1*\].

- **--n** *\<int\>*

  Maximum y-shift for the autocorr (int; default: 26). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.n** \[default = *26*\].

- **--tolerance** *\<float\>*

  Tolerance for pair discrimination (float; default: 0.1). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.tolerance** \[default = *0.1*\].

- **--pafgen** *\<bool\>*

  Generate PAF file (bool; default: False). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.pafgen** \[default = *False*\].

- **--pafname** *\<str\>*

  Specific name for PAF file (str; default: ´xsh\_lingain´). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.pafname** \[default = *xsh\_lingain*\].

- **--exts** *\<int\>*

  Activate the multi-exts option. Choose -1 to process all extensions. Choose an extension number to process the appropriate extension. (int; default: 0). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.exts** \[default = *0*\].

- **--fpn\_method** *\<str\>*

  Method for computing Fixed Pattern Noise (SMOOTH or HISTOGRAM) (str; default: ´HISTOGRAM´). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.fpn\_method** \[default = *HISTOGRAM*\].

- **--fpn\_smooth** *\<int\>*

  template size in pixels for smoothing during FPN computation (only for SMOOTH method) (int; default: 13). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.fpn\_smooth** \[default = *13*\].

- **--saturation\_limit** *\<float\>*

  all frames with mean saturation above the limit would not be used in linearity calculation (float; default: 65535.0). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.saturation\_limit** \[default = *65535.0*\].

- **--gain\_threshold** *\<float\>*

  all frames with mean flux above the threshold would not be used in gain calculation (float; default: 65535.0). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.gain\_threshold** \[default = *65535.0*\].

- **--coeffs\_cube\_split** *\<bool\>*

  if TRUE, the recipe writes as many COEFFS\_CUBE\_Pi (i=0..order) as the value of the order parameter in a separate file (bool; default: False). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.coeffs\_cube\_split** \[default = *False*\].

- **--llx1** *\<int\>*

  x coord of the lower-left point of the first field used for contamination measurement. If not modified, default value will be 1. (int; default: -1). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.llx1** \[default = *-1*\].

- **--lly1** *\<int\>*

  y coord of the lower-left point of the first field used for contamination measurement. If not modified, default value will be 1. (int; default: -1). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.lly1** \[default = *-1*\].

- **--urx1** *\<int\>*

  x coord of the upper-right point of the first field used for contamination measurement. If not modified, default value will be X dimension of the input image. (int; default: -1). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.urx1** \[default = *-1*\].

- **--ury1** *\<int\>*

  y coord of the upper-right point of the first field used for contamination measurement. If not modified, default value will be Y dimension of the input image. (int; default: -1). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.ury1** \[default = *-1*\].

- **--llx2** *\<int\>*

  x coord of the lower-left point of the second field used for contamination measurement. If not modified, default value will be 1. (int; default: -1). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.llx2** \[default = *-1*\].

- **--lly2** *\<int\>*

  y coord of the lower-left point of the second field used for contamination measurement. If not modified, default value will be 1. (int; default: -1). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.lly2** \[default = *-1*\].

- **--urx2** *\<int\>*

  x coord of the upper-right point of the second field used for contamination measurement. If not modified, default value will be half of the X dimension of the input image. (int; default: -1). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.urx2** \[default = *-1*\].

- **--ury2** *\<int\>*

  y coord of the upper-right point of the second field used for contamination measurement. If not modified, default value will be half of the Y dimension of the input image. (int; default: -1). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.ury2** \[default = *-1*\].

- **--llx3** *\<int\>*

  x coord of the lower-left point of the third field used for contamination measurement. If not modified, default value will be 1. (int; default: -1). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.llx3** \[default = *-1*\].

- **--lly3** *\<int\>*

  y coord of the lower-left point of the third field used for contamination measurement. If not modified, default value will be half of the Y dimension of the input image. (int; default: -1). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.lly3** \[default = *-1*\].

- **--urx3** *\<int\>*

  x coord of the upper-right point of the third field used for contamination measurement. If not modified, default value will be half of X dimension of the image. (int; default: -1). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.urx3** \[default = *-1*\].

- **--ury3** *\<int\>*

  y coord of the upper-right point of the third field used for contamination measurement. If not modified, default value will be Y dimension of the image. (int; default: -1). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.ury3** \[default = *-1*\].

- **--llx4** *\<int\>*

  x coord of the lower-left point of the fourth field used for contamination measurement. If not modified, default value will be half of X dimension of the image. (int; default: -1). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.llx4** \[default = *-1*\].

- **--lly4** *\<int\>*

  y coord of the lower-left point of the fourth field used for contamination measurement. If not modified, default value will be half of the Y dimension of the input image. (int; default: -1). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.lly4** \[default = *-1*\].

- **--urx4** *\<int\>*

  x coord of the upper-right point of the fourth field used for contamination measurement. If not modified, default value will be X dimension of the image. (int; default: -1). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.urx4** \[default = *-1*\].

- **--ury4** *\<int\>*

  y coord of the upper-right point of the fourth field used for contamination measurement. If not modified, default value will be Y dimension of the input image. (int; default: -1). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.ury4** \[default = *-1*\].

- **--llx5** *\<int\>*

  x coord of the lower-left point of the fifth field used for contamination measurement. If not modified, default value will be half of the X dimension of the input image. (int; default: -1). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.llx5** \[default = *-1*\].

- **--lly5** *\<int\>*

  y coord of the lower-left point of the fifth field used for contamination measurement. If not modified, default value will be 1. (int; default: -1). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.lly5** \[default = *-1*\].

- **--urx5** *\<int\>*

  x coord of the upper-right point of the fifth field used for contamination measurement. If not modified, default value will be X dimension of the image. (int; default: -1). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.urx5** \[default = *-1*\].

- **--ury5** *\<int\>*

  y coord of the upper-right point of the fifth field used for contamination measurement. If not modified, default value will be half of Y dimension of the input image. (int; default: -1). The full name of this option for the EsoRex configuration file is **xshoo.xsh\_lingain.ury5** \[default = *-1*\].

Note that it is possible to create a configuration file containing these options, along with suitable default values. Please refer to the details provided by the 'esorex --help' command.

## SEE ALSO

The full documentation for the xshoo pipeline can be downloaded as  a PDF file using the following URL:

-

  **ftp://ftp.eso.org/pub/dfs/pipelines/xshoo/xshoo-pipeline-manual-12.1.pdf**

An overview over the existing ESO pipelines can be found on the web page **https://www.eso.org/sci/software/pipelines/**.

Basic documentation about the EsoRex program can be found at the esorex (1)  man page.

It is possible to call the pipelines from python using the python-cpl package. See **https://packages.python.org/python-cpl/index.html** for further information.

The other recipes of the xshoo pipeline are [*xsh\_2dmap*(7)](/xsh_2dmap/7.md), [*xsh\_cfg\_recover*(7)](/xsh_cfg_recover/7.md), [*xsh\_flexcomp*(7)](/xsh_flexcomp/7.md), [*xsh\_geom\_ifu*(7)](/xsh_geom_ifu/7.md), [*xsh\_mbias*(7)](/xsh_mbias/7.md), [*xsh\_mdark*(7)](/xsh_mdark/7.md), [*xsh\_mflat*(7)](/xsh_mflat/7.md), [*xsh\_orderpos*(7)](/xsh_orderpos/7.md), [*xsh\_predict*(7)](/xsh_predict/7.md), [*xsh\_respon\_slit\_nod*(7)](/xsh_respon_slit_nod/7.md), [*xsh\_respon\_slit\_offset*(7)](/xsh_respon_slit_offset/7.md), [*xsh\_respon\_slit\_stare*(7)](/xsh_respon_slit_stare/7.md), [*xsh\_scired\_ifu\_offset*(7)](/xsh_scired_ifu_offset/7.md), [*xsh\_scired\_ifu\_offset\_drl*(7)](/xsh_scired_ifu_offset_drl/7.md), [*xsh\_scired\_ifu\_stare*(7)](/xsh_scired_ifu_stare/7.md), [*xsh\_scired\_ifu\_stare\_drl*(7)](/xsh_scired_ifu_stare_drl/7.md), [*xsh\_scired\_slit\_nod*(7)](/xsh_scired_slit_nod/7.md), [*xsh\_scired\_slit\_offset*(7)](/xsh_scired_slit_offset/7.md), [*xsh\_scired\_slit\_stare*(7)](/xsh_scired_slit_stare/7.md), [*xsh\_util\_physmod*(7)](/xsh_util_physmod/7.md), [*xsh\_wavecal*(7)](/xsh_wavecal/7.md)

## VERSION

xsh\_lingain 3.5.0

## AUTHOR

Lander de Bilbao,A.Modigliani \<amodigli@eso.org\>

## BUG REPORTS

Please report any problems to amodigli@eso.org. Alternatively, you may send a report to the ESO User Support Department \<usd-help@eso.org\>.

## LICENSE

This file is part of the X-shooter Instrument Pipeline Copyright (C) 2006 European Southern Observatory

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,  MA  02111-1307  USA
