Skip to content

Commit

Permalink
smurf: Allow following flat to be used via a parameter
Browse files Browse the repository at this point in the history
Defaults to current behaviour and the parameter is not sticky.
  • Loading branch information
timj committed Aug 29, 2012
1 parent 31e2cb7 commit b3431dc
Show file tree
Hide file tree
Showing 11 changed files with 184 additions and 1 deletion.
23 changes: 22 additions & 1 deletion applications/smurf/libsmf/smf_find_science.c
Expand Up @@ -165,6 +165,8 @@
* 2012-04-03 (TIMJ):
* No longer set status to bad if we have a bad flat. Report the problem
* and rely on downstream to complain.
* 2012-08-29 (TIMJ):
* Allow the user to control whether the following flat should be used.
* Copyright:
* Copyright (C) 2008-2011 Science and Technology Facilities Council.
Expand Down Expand Up @@ -212,6 +214,8 @@
#include "ast.h"
#include "star/one.h"
#include "prm_par.h"
#include "par_err.h"
#include "par.h"

/* SMURF routines */
#include "smf.h"
Expand Down Expand Up @@ -571,6 +575,7 @@ void smf_find_science(const Grp * ingrp, Grp **outgrp, int reverttodark,
size_t ngood = 0;
int itemp;
int utdate = 0;
int ratioFlats = 0;

/* Get the UT date - we do not compare flatfields after
the time we enabled heater tracking at each sequence. */
Expand All @@ -580,8 +585,24 @@ void smf_find_science(const Grp * ingrp, Grp **outgrp, int reverttodark,
astMapGet0I( infomap, "NGOOD", &itemp );
ngood = itemp;

/* Decide if we want to do the ratio test. We default to
not doing it between 20110901 and 20120827 which is
the period when we did mini-heater tracks before each
flat. ! indicates that we choose based on date. */
if (*status == SAI__OK) {
parGet0l( "FLATUSENEXT", &ratioFlats, status );
if ( *status == PAR__NULL ) {
errAnnul( status );
if (utdate >= 20110901 || utdate <= 20120827 ) {
ratioFlats = 0;
} else {
ratioFlats = 1;
}
}
}

/* Can we compare with the next flatfield? */
if (ngood < SMF__MINSTATSAMP || utdate >= 20110901 ) {
if (ngood < SMF__MINSTATSAMP || !ratioFlats ) {
/* no point doing all the ratio checking for this */
} else if ( nelem - nf >= 2 ) {
AstKeyMap * nextmap = kmaps[nf+1];
Expand Down
8 changes: 8 additions & 0 deletions applications/smurf/libsmurf/smurf_calcnoise.c
Expand Up @@ -89,6 +89,14 @@
* Signal-to-noise ratio threshold to use when filtering the
* responsivity data to determine valid bolometers for the
* flatfield. [3.0]
* FLATUSENEXT = _LOGICAL (Read)
* If true the previous and following flatfield will be used to
* determine the overall flatfield to apply to a sequence. If false
* only the previous flatfield will be used. A null default will
* use both flatfields for data when we did not heater track
* at the end, and will use a single flatfield when we did heater
* track. The parameter value is not sticky and will revert to
* the default unless explicitly over-ridden. [!]
* FLOW = _DOUBLE (Given)
* Frequency to use when determining noise ratio image. The noise
* ratio image is determined by dividing the power at this frequency
Expand Down
8 changes: 8 additions & 0 deletions applications/smurf/libsmurf/smurf_extinction.c
Expand Up @@ -55,6 +55,14 @@
* Signal-to-noise ratio threshold to use when filtering the
* responsivity data to determine valid bolometers for the
* flatfield. [3.0]
* FLATUSENEXT = _LOGICAL (Read)
* If true the previous and following flatfield will be used to
* determine the overall flatfield to apply to a sequence. If false
* only the previous flatfield will be used. A null default will
* use both flatfields for data when we did not heater track
* at the end, and will use a single flatfield when we did heater
* track. The parameter value is not sticky and will revert to
* the default unless explicitly over-ridden. [!]
* HASSKYREM = _LOGICAL (Read)
* Indicate that the data have been sky removed even if the
* fact can not be verified. This is useful for the case where
Expand Down
8 changes: 8 additions & 0 deletions applications/smurf/libsmurf/smurf_flatfield.c
Expand Up @@ -52,6 +52,14 @@
* Signal-to-noise ratio threshold to use when filtering the
* responsivity data to determine valid bolometers for the
* flatfield. [3.0]
* FLATUSENEXT = _LOGICAL (Read)
* If true the previous and following flatfield will be used to
* determine the overall flatfield to apply to a sequence. If false
* only the previous flatfield will be used. A null default will
* use both flatfields for data when we did not heater track
* at the end, and will use a single flatfield when we did heater
* track. The parameter value is not sticky and will revert to
* the default unless explicitly over-ridden. [!]
* IN = NDF (Read)
* Input files to be uncompressed and flatfielded. Any darks provided
* will be ignored.
Expand Down
8 changes: 8 additions & 0 deletions applications/smurf/libsmurf/smurf_makemap.c
Expand Up @@ -120,6 +120,14 @@
* Signal-to-noise ratio threshold to use when filtering the
* responsivity data to determine valid bolometers for the
* flatfield. [3.0]
* FLATUSENEXT = _LOGICAL (Read)
* If true the previous and following flatfield will be used to
* determine the overall flatfield to apply to a sequence. If false
* only the previous flatfield will be used. A null default will
* use both flatfields for data when we did not heater track
* at the end, and will use a single flatfield when we did heater
* track. The parameter value is not sticky and will revert to
* the default unless explicitly over-ridden. [!]
* FTL( ) = _DOUBLE (Write)
* Sky coordinates (radians) of the top left corner of the
* output map (the corner with the smallest PIXEL dimension for
Expand Down
8 changes: 8 additions & 0 deletions applications/smurf/libsmurf/smurf_remsky.c
Expand Up @@ -47,6 +47,14 @@
* Signal-to-noise ratio threshold to use when filtering the
* responsivity data to determine valid bolometers for the
* flatfield. [3.0]
* FLATUSENEXT = _LOGICAL (Read)
* If true the previous and following flatfield will be used to
* determine the overall flatfield to apply to a sequence. If false
* only the previous flatfield will be used. A null default will
* use both flatfields for data when we did not heater track
* at the end, and will use a single flatfield when we did heater
* track. The parameter value is not sticky and will revert to
* the default unless explicitly over-ridden. [!]
* GROUP = _LOGICAL (Read)
* If true, group related files together for processing as a
* single data set, else process each file independently. [FALSE]
Expand Down
8 changes: 8 additions & 0 deletions applications/smurf/libsmurf/smurf_sc2clean.c
Expand Up @@ -101,6 +101,14 @@
* Signal-to-noise ratio threshold to use when filtering the
* responsivity data to determine valid bolometers for the
* flatfield. [3.0]
* FLATUSENEXT = _LOGICAL (Read)
* If true the previous and following flatfield will be used to
* determine the overall flatfield to apply to a sequence. If false
* only the previous flatfield will be used. A null default will
* use both flatfields for data when we did not heater track
* at the end, and will use a single flatfield when we did heater
* track. The parameter value is not sticky and will revert to
* the default unless explicitly over-ridden. [!]
* GAI = NDF (Write)
* If COMPREPROCESS is set in the configuration file, the common mode
* is calculated and removed from the bolometer data. The GAI adam
Expand Down
8 changes: 8 additions & 0 deletions applications/smurf/libsmurf/smurf_sc2concat.c
Expand Up @@ -46,6 +46,14 @@
* Signal-to-noise ratio threshold to use when filtering the
* responsivity data to determine valid bolometers for the
* flatfield. [3.0]
* FLATUSENEXT = _LOGICAL (Read)
* If true the previous and following flatfield will be used to
* determine the overall flatfield to apply to a sequence. If false
* only the previous flatfield will be used. A null default will
* use both flatfields for data when we did not heater track
* at the end, and will use a single flatfield when we did heater
* track. The parameter value is not sticky and will revert to
* the default unless explicitly over-ridden. [!]
* IN = NDF (Read)
* Input file(s).
* MAXLEN = _DOUBLE (Read)
Expand Down
8 changes: 8 additions & 0 deletions applications/smurf/libsmurf/smurf_sc2fft.c
Expand Up @@ -61,6 +61,14 @@
* Signal-to-noise ratio threshold to use when filtering the
* responsivity data to determine valid bolometers for the
* flatfield. [3.0]
* FLATUSENEXT = _LOGICAL (Read)
* If true the previous and following flatfield will be used to
* determine the overall flatfield to apply to a sequence. If false
* only the previous flatfield will be used. A null default will
* use both flatfields for data when we did not heater track
* at the end, and will use a single flatfield when we did heater
* track. The parameter value is not sticky and will revert to
* the default unless explicitly over-ridden. [!]
* IN = NDF (Read)
* Input files to be transformed.
* INVERSE = _LOGICAL (Read)
Expand Down
8 changes: 8 additions & 0 deletions applications/smurf/libsmurf/smurf_sc2pca.c
Expand Up @@ -59,6 +59,14 @@
* Signal-to-noise ratio threshold to use when filtering the
* responsivity data to determine valid bolometers for the
* flatfield. [3.0]
* FLATUSENEXT = _LOGICAL (Read)
* If true the previous and following flatfield will be used to
* determine the overall flatfield to apply to a sequence. If false
* only the previous flatfield will be used. A null default will
* use both flatfields for data when we did not heater track
* at the end, and will use a single flatfield when we did heater
* track. The parameter value is not sticky and will revert to
* the default unless explicitly over-ridden. [!]
* IN = NDF (Read)
* Input files to be uncompressed and flatfielded. Any darks provided
* will be subtracted prior to flatfielding.
Expand Down
90 changes: 90 additions & 0 deletions applications/smurf/smurf.ifd.in
Expand Up @@ -674,6 +674,15 @@ package @PACKAGE@ {
helpkey *
}

parameter flatusenext {
type _LOGICAL
vpath DEFAULT
ppath DEFAULT
default !
prompt {Should we compare with following flatfield?}
helpkey *
}

parameter resist {
type LITERAL
access READ
Expand Down Expand Up @@ -888,6 +897,15 @@ package @PACKAGE@ {
helpkey *
}

parameter flatusenext {
type _LOGICAL
vpath DEFAULT
ppath DEFAULT
default !
prompt {Should we compare with following flatfield?}
helpkey *
}

parameter resist {
type LITERAL
access READ
Expand Down Expand Up @@ -1366,6 +1384,15 @@ package @PACKAGE@ {
helpkey *
}

parameter flatusenext {
type _LOGICAL
vpath DEFAULT
ppath DEFAULT
default !
prompt {Should we compare with following flatfield?}
helpkey *
}

parameter resist {
type LITERAL
access READ
Expand Down Expand Up @@ -1803,6 +1830,15 @@ package @PACKAGE@ {
helpkey *
}

parameter flatusenext {
type _LOGICAL
vpath DEFAULT
ppath DEFAULT
default !
prompt {Should we compare with following flatfield?}
helpkey *
}

parameter resist {
type LITERAL
access READ
Expand Down Expand Up @@ -3226,6 +3262,15 @@ package @PACKAGE@ {
helpkey *
}

parameter flatusenext {
type _LOGICAL
vpath DEFAULT
ppath DEFAULT
default !
prompt {Should we compare with following flatfield?}
helpkey *
}

parameter resist {
type LITERAL
access READ
Expand Down Expand Up @@ -3474,6 +3519,15 @@ package @PACKAGE@ {
helpkey *
}

parameter flatusenext {
type _LOGICAL
vpath DEFAULT
ppath DEFAULT
default !
prompt {Should we compare with following flatfield?}
helpkey *
}

parameter resist {
type LITERAL
access READ
Expand Down Expand Up @@ -3643,6 +3697,15 @@ package @PACKAGE@ {
helpkey *
}

parameter flatusenext {
type _LOGICAL
vpath DEFAULT
ppath DEFAULT
default !
prompt {Should we compare with following flatfield?}
helpkey *
}

parameter resist {
type LITERAL
access READ
Expand Down Expand Up @@ -3779,6 +3842,15 @@ package @PACKAGE@ {
helpkey *
}

parameter flatusenext {
type _LOGICAL
vpath DEFAULT
ppath DEFAULT
default !
prompt {Should we compare with following flatfield?}
helpkey *
}

parameter resist {
type LITERAL
access READ
Expand Down Expand Up @@ -3985,6 +4057,15 @@ package @PACKAGE@ {
helpkey *
}

parameter flatusenext {
type _LOGICAL
vpath DEFAULT
ppath DEFAULT
default !
prompt {Should we compare with following flatfield?}
helpkey *
}

parameter resist {
type LITERAL
access READ
Expand Down Expand Up @@ -4271,6 +4352,15 @@ package @PACKAGE@ {
helpkey *
}

parameter flatusenext {
type _LOGICAL
vpath DEFAULT
ppath DEFAULT
default !
prompt {Should we compare with following flatfield?}
helpkey *
}

parameter resist {
type LITERAL
access READ
Expand Down

0 comments on commit b3431dc

Please sign in to comment.