#+ # Name: # _CORRECT_NONLINEARITY_ # # Purpose: # Corrects the raw data for detector non-linearity. # # Language: # Perl5 # # Description: # This primitive corrects the raw data frame for non-linearity # applying a low-order polynomial fit from the # instrument web site # # Notes: # - This primitive is suitable for IRIS2 # - The linear counts (L) are given by the expression # # L = M * (1.0 - 8.81352977E-12*M*M + 3.72642828E-16*M*M*M), # For the IRIS2 original science grade device and # L = M * (1.0 + 8.555607E-12*M*M + 1.6591852E-16*M*M*M). # For the IRIS2 replacement (Mk2) science grade device and # # where M is the measured ADU counts (valid for M=0-50000) # (http://www.aao.gov.au/iris2/iris2_linearity.html) # # Output Data: # - Linearity-corrected frame inheriting the current frame's name # but with the _nl suffix. # # Tasks: # KAPPA: MATHS. # # Authors: # MJC: Malcolm J. Currie (JAC, Starlink) # CGT: Chris Tinney (AAO) - modified to use IRIS2 coefficients # CGT: Chris Tinney (AAO) - modified to do nothing on engineering data # # Copyright: # Copyright (C) 1998-2003 Particle Physics and Astronomy Research # Council. All Rights Reserved. # #- my $mode = $Frm->hdr( "METHOD" ); my $det = $Frm->hdr( "DETECTOR" ); if ( $det =~ /Iris2.*Engineering/i || $det !~ /Iris2.*Science/i) { # # Issue a warning as we haven't worked out the correction yet. # orac_print "WARNING: DETECTOR=$det which is not yet implemented for linearity correction\n"; orac_print "WARNING: No linearity correction performed.\n"; } else { if ( $mode =~ /IRIS_DRM/ ) { # Generate list of input and output filenames. my ( $in, $out ) = $Frm->inout( "_nl" ); # Evaluate the expression that linearises the remianing data. orac_print "$det\n"; if ( $det =~ /Iris2.*Mk2.*Science/i ) { orac_print "IRIS2 Mk2 correction : L=M*(1.0 + 8.555607E-12*M**2 + 1.6591852E-16*M**3).\n"; $Mon{ "kappa_mon" }->obeyw( "maths", "out=$out ia=$in exp='IA*(1.0 + 8.555607E-12*IA*IA + 1.6591852E-16*IA*IA*IA)'" ); } else { orac_print "IRIS2 Mk1 correction : L=M*(1.0 - 8.81352977E-12*M**2 + 3.72642828E-16*M**3).\n"; $Mon{ "kappa_mon" }->obeyw( "maths", "out=$out ia=$in exp='IA*(1.0 - 8.81352977E-12*IA*IA + 3.72642828E-16*IA*IA*IA)'" ); } # Report the processing status. orac_print "Frame $in linearity corrected to form $out.\n"; # Now update the output filename in the Frame object. $Frm->file( $out ); } else { # # Issue a warning if this is MRM data, but proceed on. # orac_print "WARNING: METHOD=$mode which is unusual for IRIS2 imaging data\n"; orac_print "WARNING: No linearity correction of $mode data performed.\n"; } } #orac_print "\n"; # Podule # ====== =head1 NAME _CORRECT_NONLINEARITY_PRE_POST_ -- Corrects the post-pre differenced raw data for detector non-linearity. =head1 DESCRIPTION This primitive corrects the raw data frame for non-linearity applying a low-order polynomial fit for IRIS2. The correction is applied to the raw data. (http://www.aao.gov.au/iris2/iris2_linearity.html) =head1 NOTES =over 4 =item * This primitive is suitable for IRIS2. =back =head1 OUTPUT DATA =over 4 =item * Linearity-corrected frame inheriting the current frame's name but with the _nl suffix. =item * Linear counts (L) are given by the expression L = M * (1.0 - 8.81352977E-12*M*M + 3.72642828E-16*M*M*M), where M are the measured ADU counts (valid for M=0-50000) =back =head1 TASKS KAPPA: MATHS. =head1 AUTHORS MJC: Malcolm J. Currie (JAC, Starlink) CGT: Chris Tinney (AAO) - modified to use IRIS2 coefficients =head1 COPYRIGHT Copyright (C) 1998-2003 Particle Physics and Astronomy Research Council. All Rights Reserved. =cut