Provided by: cpl-plugin-muse-doc_2.8.7+dfsg-3_all bug

NAME

       muse_twilight - Combine several twilight skyflats into one cube, compute correction factors for each IFU,
       and create a smooth 3D illumination correction.

SYNOPSIS

       esorex muse_twilight [OPTIONS] FILE.sof

DESCRIPTION

       Processing first handles each raw input image separately: it trims the raw data and records the  overscan
       statistics,  subtracts  the  bias (taking account of the overscan, if --overscan is not "none"), converts
       the images from adu to count, subtracts the  dark,  divides  by  the  flat-field  and  combines  all  the
       exposures  using  input  parameters.  The  input calibrations geometry table, trace table, and wavelength
       calibration table are used to assign 3D coordinates to each CCD-based pixel,  thereby  creating  a  pixel
       table  from  the master sky-flat. These pixel tables are then cut in wavelength using the --lambdamin and
       --lambdamax parameters. The integrated flux in each IFU is computed as the sum of the data in  the  pixel
       table,  and saved in the header, to be used later as estimate for the relative throughput of each IFU. If
       an ILLUM exposure was given as input, it is then used to correct the relative  illumination  between  all
       slices  of  one IFU. For this, the data of each slice within the pixel table of each IFU is multiplied by
       the normalized median flux of that slice in the ILLUM exposure. The pixel tables of  all  IFUs  are  then
       merged,  using  the  integrated  fluxes  as inverse scaling factors, and a cube is reconstructed from the
       merged dataset, using given parameters. A white-light image is created from the cube. This  skyflat  cube
       is then saved to disk, with the white-light image as one extension. To construct a smooth 3D illumination
       correction, the cube is post-processed in the following way: the white-light image is used  to  create  a
       mask  of  the illuminated area. From this area, the optional vignetting mask is removed. The smoothing is
       then computed for each plane of the cube: the illuminated area is smoothed  (by  a  5x7  median  filter),
       normalized,  fit  with a 2D polynomial (of given polynomial orders), and normalized again. A smooth white
       image is then created by collapsing the smooth cube. If a vignetting  mask  was  given  or  NFM  data  is
       processed,  an  area  close  to  the  edge  of  the MUSE field is used to compute a 2D correction for the
       vignetted area: the original unsmoothed white-light image is  corrected  for  large  scale  gradients  by
       dividing  it with the smooth white image. The residuals in the edge area (as defined by the input mask or
       hardcoded for NFM) are then smoothed using input parameters. This smoothed vignetting correction  is  the
       multiplied  onto  each plane of the smooth cube, normalizing each plane again. This twilight cube is then
       saved to disk.

OPTIONS

       --overscan <str>
              If this is "none", stop when detecting discrepant overscan levels (see ovscsigma), for "offset" it
              assumes  that  the  mean  overscan  level  represents  the  real  offset in the bias levels of the
              exposures involved, and adjusts the data accordingly; for "vpoly", a  polynomial  is  fit  to  the
              vertical  overscan  and subtracted from the whole quadrant. (str; default: ´vpoly´). The full name
              of this option for the EsoRex configuration file is muse.muse_twilight.overscan [default = vpoly].

       --ovscreject <str>
              This influences how values are rejected when computing overscan statistics. Either no rejection at
              all  ("none"), rejection using the DCR algorithm ("dcr"), or rejection using an iterative constant
              fit ("fit"). (str; default: ´dcr´). The full name of this option for the EsoRex configuration file
              is muse.muse_twilight.ovscreject [default = dcr].

       --ovscsigma <float>
              If  the  deviation  of  mean  overscan levels between a raw input image and the reference image is
              higher than |ovscsigma x stdev|, stop the processing. If overscan="vpoly", this is used  as  sigma
              rejection  level  for  the  iterative polynomial fit (the level comparison is then done afterwards
              with |100 x stdev| to guard against incompatible settings).  Has no effect for  overscan="offset".
              (float;  default:  30.0).  The  full  name  of  this  option  for the EsoRex configuration file is
              muse.muse_twilight.ovscsigma [default = 30.0].

       --ovscignore <int>
              The number of pixels of the overscan adjacent to the data section of the CCD that are ignored when
              computing  statistics  or  fits.  (int;  default:  3). The full name of this option for the EsoRex
              configuration file is muse.muse_twilight.ovscignore [default = 3].

       --combine <str>
              Type of combination to use (str; default: ´sigclip´). The full name of this option for the  EsoRex
              configuration file is muse.muse_twilight.combine [default = sigclip].

       --nlow <int>
              Number of minimum pixels to reject with minmax (int; default: 1). The full name of this option for
              the EsoRex configuration file is muse.muse_twilight.nlow [default = 1].

       --nhigh <int>
              Number of maximum pixels to reject with minmax (int; default: 1). The full name of this option for
              the EsoRex configuration file is muse.muse_twilight.nhigh [default = 1].

       --nkeep <int>
              Number  of  pixels  to  keep  with  minmax (int; default: 1). The full name of this option for the
              EsoRex configuration file is muse.muse_twilight.nkeep [default = 1].

       --lsigma <float>
              Low sigma for pixel rejection with sigclip (float; default: 3.0). The full name of this option for
              the EsoRex configuration file is muse.muse_twilight.lsigma [default = 3.0].

       --hsigma <float>
              High  sigma  for  pixel rejection with sigclip (float; default: 3.0). The full name of this option
              for the EsoRex configuration file is muse.muse_twilight.hsigma [default = 3.0].

       --scale <bool>
              Scale the individual images to a common exposure  time  before  combining  them.  (bool;  default:
              False). The full name of this option for the EsoRex configuration file is muse.muse_twilight.scale
              [default = False].

       --resample <str>
              The resampling technique to use for the final output cube. (str;  default:  ´drizzle´).  The  full
              name  of  this  option for the EsoRex configuration file is muse.muse_twilight.resample [default =
              drizzle].

       --crtype <str>
              Type of statistics used for detection of cosmic rays during  final  resampling.  "iraf"  uses  the
              variance  information,  "mean" uses standard (mean/stdev) statistics, "median" uses median and the
              median median of the absolute median deviation. (str; default: ´median´). The full  name  of  this
              option for the EsoRex configuration file is muse.muse_twilight.crtype [default = median].

       --crsigma <float>
              Sigma rejection factor to use for cosmic ray rejection during final resampling. A zero or negative
              value switches cosmic ray rejection off. (float; default: 50.0). The full name of this option  for
              the EsoRex configuration file is muse.muse_twilight.crsigma [default = 50.0].

       --lambdamin <float>
              Minimum  wavelength  for  twilight reconstruction. (float; default: 5000.0). The full name of this
              option for the EsoRex configuration file is muse.muse_twilight.lambdamin [default = 5000.0].

       --lambdamax <float>
              Maximum wavelength for twilight reconstruction. (float; default: 9000.0). The full  name  of  this
              option for the EsoRex configuration file is muse.muse_twilight.lambdamax [default = 9000.0].

       --dlambda <float>
              Sampling  for  twilight reconstruction, this should result in planes of equal wavelength coverage.
              (float; default: 250.0). The full name of  this  option  for  the  EsoRex  configuration  file  is
              muse.muse_twilight.dlambda [default = 250.0].

       --xorder <int>
              Polynomial order to use in x direction to fit the full field of view.  (int; default: 2). The full
              name of this option for the EsoRex configuration file is muse.muse_twilight.xorder [default = 2].

       --yorder <int>
              Polynomial order to use in y direction to fit the full field of view.  (int; default: 2). The full
              name of this option for the EsoRex configuration file is muse.muse_twilight.yorder [default = 2].

       --vignmaskedges <float>
              Pixels  on  edges stronger than this fraction in the normalized image are excluded from the fit to
              the vignetted area. Set to non-positive number to include them in the fit. This has no effect  for
              NFM  skyflats.  (float;  default: 0.02). The full name of this option for the EsoRex configuration
              file is muse.muse_twilight.vignmaskedges [default = 0.02].

       --vignsmooth <str>
              Type of smoothing to use for the vignetted region given by the VIGNETTING_MASK (for  WFM,  or  the
              internal mask, for NFM); gaussian uses (vignxpar + vignypar)/2 as FWHM. (str; default: ´polyfit´).
              The full name of this option for the EsoRex configuration  file  is  muse.muse_twilight.vignsmooth
              [default = polyfit].

       --vignxpar <int>
              Parameter  used  by  the  vignetting  smoothing:  x  order  for  polyfit (default, recommended 4),
              parameter that influences the FWHM for the gaussian (recommended: 10), or x  dimension  of  median
              filter  (recommended  5). If a negative value is found, the default is taken.  (int; default: -1).
              The full name of this option for the  EsoRex  configuration  file  is  muse.muse_twilight.vignxpar
              [default = -1].

       --vignypar <int>
              Parameter  used  by  the  vignetting  smoothing:  y  order  for  polyfit (default, recommended 4),
              parameter that influences the FWHM for the gaussian (recommended: 10), or y  dimension  of  median
              filter  (recommended  5). If a negative value is found, the default is taken.  (int; default: -1).
              The full name of this option for the  EsoRex  configuration  file  is  muse.muse_twilight.vignypar
              [default = -1].

       --vignnfmmask <int>
              The height of the vignetted region at the top of the MUSE field in NFM. This is the region modeled
              separately (the final vignetting model might be smaller). (int; default: 22).  The  full  name  of
              this option for the EsoRex configuration file is muse.muse_twilight.vignnfmmask [default = 22].

       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 muse pipeline can be downloaded as a PDF file using the following URL:

              ftp://ftp.eso.org/pub/dfs/pipelines/muse/muse-pipeline-cookbook-2.8.7.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  muse   pipeline   are   muse_ampl(7),   muse_astrometry(7),   muse_bias(7),
       muse_create_sky(7), muse_dark(7), muse_exp_align(7), muse_exp_combine(7), muse_flat(7), muse_geometry(7),
       muse_illum(7),  muse_lingain(7),   muse_lsf(7),   muse_qi_mask(7),   muse_scibasic(7),   muse_scipost(7),
       muse_scipost_apply_astrometry(7),    muse_scipost_calibrate_flux(7),   muse_scipost_combine_pixtables(7),
       muse_scipost_correct_dar(7),            muse_scipost_correct_rv(7),            muse_scipost_make_cube(7),
       muse_scipost_raman(7),         muse_scipost_subtract_sky(7),         muse_scipost_subtract_sky_simple(7),
       muse_standard(7), muse_wavecal(7)

VERSION

       muse_twilight 2.8.7

AUTHOR

       Peter Weilbacher <https://support.eso.org>

BUG REPORTS

       Please report any problems to https://support.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 MUSE Instrument Pipeline Copyright (C) 2005, 2019 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., 51 Franklin St, Fifth Floor, Boston, MA  02111-1307  USA