mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
|
Process an angular differential imaging (ADI) observation.
Angular differential imaging (ADI) uses sky rotation to differentiate real objects from speckles.
realT | is the floating point type in which to do calculations |
_derotFunctObj | is the derotation object with the following minimum interface: template<typename _realT>
struct derotF
{
typedef _realT realT;
//Vector of keywords to extract from the fits headers
std::vector<std::string> keywords;
//Vector(s) to hold the keyword values
std::vector<realT> keyValue1;
///To allow ADIobservation to check for errors.
bool isSetup()
{
if( <any condition indicating not set up>) return false;
return true;
}
//Method called by HCIobservation to get keyword-values
void extractKeywords(vector<fitsHeader> & heads)
{
keyValue1 = headersToValues<float>(heads, "KEYWORD1");
}
//Calculate the derotation angle for a given image number
realT derotAngle(size_t imno) const
{
return some_function_of(keyValue1[imno]); //This function uses keyValue1[imno] to produce the derotation angle in radians.
}
};
|
Definition at line 93 of file ADIobservation.hpp.
#include <improc/ADIobservation.hpp>
Public Member Functions | |
ADIobservation (const std::string &dir, const std::string &prefix, const std::string &ext) | |
ADIobservation (const std::string &fileListFile) | |
ADIobservation (const std::string &dir, const std::string &prefix, const std::string &ext, const std::string &RDIdir, const std::string &RDIprefix, const std::string &RDIext="") | |
ADIobservation (const std::string &fileListFile, const std::string &RDIfileListFile) | |
int | readFiles () |
Read in the target files. More... | |
virtual int | postReadFiles () |
Post target read actions, including fake injection. More... | |
virtual int | postCoadd () |
Post target coadd actions. More... | |
int | readRDIFiles () |
Read in the RDI files. More... | |
virtual int | postRDIReadFiles () |
Post reference read actions, including fake injection. More... | |
virtual int | postRDICoadd () |
Post reference coadd actions. More... | |
int | readPSFSub (const std::string &dir, const std::string &prefix, const std::string &ext, size_t nReductions) |
Read in already PSF-subtracted files. More... | |
virtual void | makeMaskCube () |
Populate the mask cube which is used for post-processing. Derived classes can do this as appropriate, e.g. by rotating the mask. More... | |
void | derotate () |
De-rotate the PSF subtracted images. More... | |
Public Member Functions inherited from mx::improc::HCIobservation< _realT > | |
int | readPSFSub (const std::string &dir, const std::string &prefix, const std::string &ext, size_t nReductions) |
Read in already PSF-subtracted files. More... | |
HCIobservation () | |
Default c'tor. More... | |
HCIobservation (const std::string &dir, const std::string &prefix, const std::string &ext) | |
Construct and load the target file list. More... | |
HCIobservation (const std::string &fileListFile) | |
Construct using a file containing the target file list. More... | |
HCIobservation (const std::string &dir, const std::string &prefix, const std::string &ext, const std::string &RDIdir, const std::string &RDIprefix, const std::string &RDIext="") | |
Construct and load the target file list and the RDI file list. More... | |
HCIobservation (const std::string &fileListFile, const std::string &RDIfileListFile) | |
Construct using a file containing the target file list and a file containing the RDI target file list. More... | |
void | load_fileList (const std::string &dir, const std::string &prefix, const std::string &ext) |
Load the file list. More... | |
void | load_fileList (const std::string &fileListFile) |
Load the file list from a file. More... | |
void | load_RDIfileList (const std::string &dir, const std::string &prefix, const std::string &ext) |
Load the RDI basis file list. More... | |
void | load_RDIfileList (const std::string &fileListFile) |
Load the RDI basis file list from a file. More... | |
int | threshold (std::vector< std::string > &fileList, const std::string &qualityFile, realT qualityThreshold) |
Read the image qualities from a qualityFile and apply the threshold to a fileList. More... | |
int | readFiles () |
Read the list of files, cut to size, and preprocess. More... | |
int | readRDIFiles () |
Read the list of reference files, cut to size, and preprocess. More... | |
void | coaddImages (int coaddCombineMethod, int coaddMaxImno, int coaddMaxTime, std::vector< std::string > &coaddKeywords, std::vector< double > &imageMJD, std::vector< fits::fitsHeader > &heads, eigenCube< realT > &ims) |
Coadd the images. More... | |
void | readMask () |
Read the mask file, resizing to imSize if needed. More... | |
void | preProcess (eigenCube< realT > &ims) |
Do the pre-processing. More... | |
int | readWeights () |
Read the image weights from m_weightFile. More... | |
void | combineFinim () |
Combine the images into a single final image. More... | |
void | outputPreProcessed () |
Output the pre-processed target images. More... | |
void | outputRDIPreProcessed () |
Output the pre-processed reference images. More... | |
void | stdFitsHeader (fits::fitsHeader &head) |
Fill in the HCIobservation standard FITS header. More... | |
void | writeFinim (fits::fitsHeader *addHead=0) |
Write the final combined image to disk. More... | |
void | outputPSFSub (fits::fitsHeader *addHead=0) |
Write the PSF subtracted images to disk. More... | |
Fake Planets | |
int | m_fakeMethod {HCI::single} |
Method for reading fake files, either HCI::single or HCI::list. More... | |
std::string | m_fakeFileName |
FITS file containing the fake planet PSF to inject or a list of fake images. More... | |
std::string | m_fakeScaleFileName |
One-column text file containing a scale factor for each point in time. More... | |
std::vector< realT > | m_fakeSep |
Separation(s) of the fake planet(s) More... | |
std::vector< realT > | m_fakePA |
Position angles(s) of the fake planet(s) More... | |
std::vector< realT > | m_fakeContrast |
Contrast(s) of the fake planet(s) More... | |
realT | m_RDIFluxScale {1} |
Flux scaling to apply to fake planets injected in RDI. Would depend on the assumed spectrum in SDI. More... | |
realT | m_RDISepScale {1} |
Scaling to apply to fake planet separation in RDI. Would be ratio of wavelengths for SDI. More... | |
int | injectFake (eigenCube< realT > &ims, std::vector< std::string > &fileList, derotFunctObj &derotF, realT RDIfluxScale, realT RDISepScale) |
Inect the fake plants. More... | |
int | injectFake (eigenImageT &fakePSF, eigenCube< realT > &ims, int image_i, realT derotAngle, realT PA, realT sep, realT contrast, realT scale, realT RDIfluxScale, realT RDISepScale) |
Additional Inherited Members | |
Public Types inherited from mx::improc::HCIobservation< _realT > | |
typedef _realT | realT |
The arithmetic type used for calculations. Does not have to match the type in images on disk. More... | |
typedef Eigen::Array< realT, Eigen::Dynamic, Eigen::Dynamic > | eigenImageT |
The Eigen image array type basted on realT. More... | |
Public Attributes inherited from mx::improc::HCIobservation< _realT > | |
eigenCube< realT > | m_tgtIms |
The target image cube. More... | |
int | m_Nims {0} |
Number of images in m_tgtIms. More... | |
int | m_Nrows {0} |
Number of rows of the images in m_tgtIms. More... | |
int | m_Ncols {0} |
Number of columns of the images in m_tgtIms. More... | |
int | m_Npix {0} |
Pixels per image, that is Nrows*Ncols. More... | |
std::vector< double > | m_imageMJD |
Vector of target image times, in MJD. More... | |
std::vector< fits::fitsHeader > | m_heads |
Vector of FITS headers, one per file, populated with the values for the keywords. More... | |
bool | m_filesRead {false} |
Whether or not the m_fileList has been read. More... | |
bool | m_filesDeleted {false} |
Whether or not the specified files have been deleted from m_fileList. More... | |
std::vector< realT > | m_comboWeights |
Vector to hold the image weights read from the m_weightFile. More... | |
eigenCube< realT > | m_refIms |
The optional reference image cube. More... | |
std::vector< double > | m_RDIimageMJD |
Vector of reference image times, in MJD. More... | |
std::vector< fits::fitsHeader > | m_RDIheads |
Vector of FITS headers, one per reference file, populated with the values for the keywords. More... | |
bool | m_RDIfilesRead {false} |
Whether or not the reference files have been read. More... | |
bool | m_RDIfilesDeleted {false} |
Whether or not the specified files have been deleted from m_RDIfileList. More... | |
std::vector< eigenCube< realT > > | m_psfsub |
The PSF subtracted images. More... | |
eigenCube< realT > | m_finim |
The final combined images, one for each cube in psfsub. More... | |
std::vector< std::string > | m_fileList |
The list of files to read in. More... | |
int | m_deleteFront {0} |
Specify how many files from m_fileList to delete from the front of the list. More... | |
int | m_deleteBack {0} |
Specify how many files from m_fileList to delete from the back of the list. More... | |
std::string | m_qualityFile |
File containing 2 space-delimited columns of fileVame qualityValue pairs. More... | |
realT | m_qualityThreshold {0} |
Threshold to apply to qualityValues read from qualityFile. More... | |
bool | m_thresholdOnly {false} |
Just prints the names and qualities of the files which pass threshold, and stop. More... | |
std::string | m_MJDKeyword {"DATE-OBS"} |
Name of the keyword to use for the image date. More... | |
bool | m_MJDisISO8601 {true} |
Whether or not the date is in ISO 8601 format. More... | |
realT | m_MJDUnits {1.0} |
If the date is not ISO 8601, this specifies the conversion to Julian Days (i.e. seconds to days) More... | |
std::vector< std::string > | m_keywords |
Vector of FITS header keywords to read from the files in m_fileList. More... | |
int | m_imSize {0} |
Set the image size. Images are cut down to this size after reading. More... | |
std::vector< std::string > | m_RDIfileList |
The list of files to read in for the RDI basis. More... | |
int | m_RDIdeleteFront {0} |
Specify how many files from m_RDIfileList to delete from the front of the list. More... | |
int | m_RDIdeleteBack {0} |
Specify how many files from m_RDIfileList to delete from the back of the list. More... | |
std::string | m_RDIqualityFile |
File containing 2 space-delimited columns of fileMame qualityValue pairs for the reference images. More... | |
realT | m_RDIqualityThreshold {0} |
Threshold to apply to qualityValues read from qualityFile. More... | |
std::vector< std::string > | m_RDIkeywords |
Vector of FITS header keywords to read from the files in m_fileList. More... | |
int | m_coaddCombineMethod {HCI::noCombine} |
Determine how to coadd the raw images. More... | |
int | m_coaddMaxImno {0} |
Maximum number of images to coadd. More... | |
realT | m_coaddMaxTime {0} |
Maximum elapsed time over which to coadd the images. More... | |
std::vector< std::string > | m_coaddKeywords |
The values of these keywords will be averaged and replaced. More... | |
std::string | m_maskFile |
Specify a mask file to apply. More... | |
eigenImageT | m_mask |
The mask. More... | |
eigenCube< realT > | m_maskCube |
A cube of masks, one for each input image, which may be modified versions (e.g. rotated) of mask. More... | |
bool | m_skipPreProcess {false} |
Don't do any of the pre-processing steps (including coadding). More... | |
bool | m_preProcess_beforeCoadd {false} |
controls whether pre-processing takes place before or after coadding More... | |
bool | m_preProcess_mask {true} |
If true, the mask is applied during each pre-processing step. More... | |
bool | m_preProcess_subradprof {false} |
If true, a radial profile is subtracted from each image. More... | |
realT | m_preProcess_azUSM_azW {0} |
Azimuthal boxcar width for azimuthal unsharp mask [pixels]. More... | |
realT | m_preProcess_azUSM_maxAz {45} |
Mazimum azimuthal boxcar width for azimuthal unsharp mask [degrees]. More... | |
realT | m_preProcess_azUSM_radW {0} |
Radial boxcar width for azimuthal unsharp mask [pixels]. More... | |
int | m_preProcess_medianUSM_fwhm {0} |
Kernel FWHM for symmetric box median unsharp mask (USM) More... | |
realT | m_preProcess_gaussUSM_fwhm {0} |
Kernel FWHM for symmetric Gaussian unsharp mask (USM) More... | |
std::string | m_preProcess_outputPrefix |
Set path and file prefix to output the pre-processed images. More... | |
bool | m_preProcess_only {false} |
If true, then we stop after pre-processing. More... | |
int | m_combineMethod {HCI::meanCombine} |
Determine how to combine the PSF subtracted images. More... | |
std::string | m_weightFile |
Specifies a file containing the image weights, for combining with weighted mean. More... | |
realT | m_sigmaThreshold {0} |
The standard deviation threshold used if combineMethod == HCI::sigmaMeanCombine. More... | |
realT | m_minGoodFract {0.0} |
The minimum fraction of good (un-masked) pixels to include in the final combination (0.0 to 1.0). If not met, then the pixel will be NaN-ed. More... | |
int | m_doWriteFinim {1} |
Set whether the final combined image is written to disk. More... | |
std::string | m_outputDir |
The directory where to write output files. More... | |
std::string | m_finimName {"finim_"} |
The base file name of the output final image. More... | |
bool | m_exactFinimName {false} |
Use m_finimName exactly as specified, without appending a number or an extension. More... | |
bool | m_doOutputPSFSub {false} |
Controls whether or not the individual PSF subtracted images are written to disk. More... | |
std::string | m_PSFSubPrefix |
Prefix of the FITS file names used to write individual PSF subtracted images to disk if m_doOutputPSFSub is true. More... | |
mx::improc::ADIobservation< _realT, _derotFunctObj >::ADIobservation | ( | const std::string & | dir, |
const std::string & | prefix, | ||
const std::string & | ext | ||
) |
[in] | dir | the directory to search. |
[in] | prefix | the initial part of the file name. Can be empty "". |
[in] | ext | the extension to append to the file name, must include the '.'. |
Definition at line 225 of file ADIobservation.hpp.
|
explicit |
[in] | fileListFile | a file name path to read. |
Definition at line 233 of file ADIobservation.hpp.
mx::improc::ADIobservation< _realT, _derotFunctObj >::ADIobservation | ( | const std::string & | dir, |
const std::string & | prefix, | ||
const std::string & | ext, | ||
const std::string & | RDIdir, | ||
const std::string & | RDIprefix, | ||
const std::string & | RDIext = "" |
||
) |
[in] | dir | the directory to search. |
[in] | prefix | the initial part of the file name. Can be empty "". |
[in] | ext | the extension to append to the file name, must include the '.'. |
[in] | RDIdir | the directory to search for the reference files. |
[in] | RDIprefix | the initial part of the file name for the reference files. Can be empty "". |
[in] | RDIext | [optional] the extension to append to the RDI file name, must include the '.'. If empty "" then same extension as target files is used. |
Definition at line 238 of file ADIobservation.hpp.
mx::improc::ADIobservation< _realT, _derotFunctObj >::ADIobservation | ( | const std::string & | fileListFile, |
const std::string & | RDIfileListFile | ||
) |
[in] | fileListFile | a file name path to read for the target file names. |
[in] | RDIfileListFile | a file name path to read for the reference file names. |
Definition at line 249 of file ADIobservation.hpp.
void mx::improc::ADIobservation< _realT, _derotFunctObj >::derotate |
De-rotate the PSF subtracted images.
Definition at line 608 of file ADIobservation.hpp.
References mx::sys::get_curr_time(), and mx::improc::imageRotate().
int mx::improc::ADIobservation< _realT, _derotFunctObj >::injectFake | ( | eigenCube< realT > & | ims, |
std::vector< std::string > & | fileList, | ||
derotFunctObj & | derotF, | ||
realT | RDIfluxScale, | ||
realT | RDISepScale | ||
) |
Inect the fake plants.
ims | [in.out] the image cube in which to inject the fakes. | |
[in] | fileList | a list of file paths used for per-image fake PSFs. If empty, then m_fakeFileName is used. |
[in] | RDIfluxScale | the flux scaling for RDI. In SDI, this is from the planet spectrum. |
[in] | RDISepScale | the separation scale for RDI. In SDI, this is the ratio of wavlengths after lambda/D scaling. |
Definition at line 438 of file ADIobservation.hpp.
References mx::sys::get_curr_time(), mx::improc::HCI::list, mx::ioutils::pathFilename(), mx::fits::fitsFile< dataT >::read(), mx::ioutils::readColumns(), and mx::improc::HCI::single.
|
virtual |
Populate the mask cube which is used for post-processing. Derived classes can do this as appropriate, e.g. by rotating the mask.
Reimplemented from mx::improc::HCIobservation< _realT >.
Definition at line 581 of file ADIobservation.hpp.
References mx::improc::rotateMask(), and mx::fits::fitsFile< dataT >::write().
|
virtual |
Post target coadd actions.
Here updates derotation for new average values.
Reimplemented from mx::improc::HCIobservation< _realT >.
Definition at line 293 of file ADIobservation.hpp.
|
virtual |
Post reference coadd actions.
Here updates derotation for new average values.
Reimplemented from mx::improc::HCIobservation< _realT >.
Definition at line 336 of file ADIobservation.hpp.
|
virtual |
Post reference read actions, including fake injection.
Reimplemented from mx::improc::HCIobservation< _realT >.
Definition at line 323 of file ADIobservation.hpp.
|
virtual |
Post target read actions, including fake injection.
Reimplemented from mx::improc::HCIobservation< _realT >.
Definition at line 279 of file ADIobservation.hpp.
int mx::improc::ADIobservation< _realT, _derotFunctObj >::readFiles |
Read in the target files.
First sets up the keywords, then calls HCIobservation readFiles
Definition at line 256 of file ADIobservation.hpp.
int mx::improc::ADIobservation< _realT, _derotFunctObj >::readPSFSub | ( | const std::string & | dir, |
const std::string & | prefix, | ||
const std::string & | ext, | ||
size_t | nReductions | ||
) |
Read in already PSF-subtracted files.
Used to take up final processing after applying some non-klipReduce processing steps to PSF-subtracted images.
Definition at line 346 of file ADIobservation.hpp.
References mx::fits::fitsHeader::count(), mx::ioutils::getFileNames(), mx::ioutils::parseStringVector(), and mx::fits::fitsFile< dataT >::read().
int mx::improc::ADIobservation< _realT, _derotFunctObj >::readRDIFiles |
Read in the RDI files.
First sets up the keywords, then calls HCIobservation readRDIFiles
Definition at line 300 of file ADIobservation.hpp.
std::vector<realT> mx::improc::ADIobservation< _realT, _derotFunctObj >::m_fakeContrast |
Contrast(s) of the fake planet(s)
Definition at line 176 of file ADIobservation.hpp.
std::string mx::improc::ADIobservation< _realT, _derotFunctObj >::m_fakeFileName |
FITS file containing the fake planet PSF to inject or a list of fake images.
Definition at line 170 of file ADIobservation.hpp.
int mx::improc::ADIobservation< _realT, _derotFunctObj >::m_fakeMethod {HCI::single} |
Method for reading fake files, either HCI::single or HCI::list.
Definition at line 168 of file ADIobservation.hpp.
std::vector<realT> mx::improc::ADIobservation< _realT, _derotFunctObj >::m_fakePA |
Position angles(s) of the fake planet(s)
Definition at line 175 of file ADIobservation.hpp.
std::string mx::improc::ADIobservation< _realT, _derotFunctObj >::m_fakeScaleFileName |
One-column text file containing a scale factor for each point in time.
Definition at line 172 of file ADIobservation.hpp.
std::vector<realT> mx::improc::ADIobservation< _realT, _derotFunctObj >::m_fakeSep |
Separation(s) of the fake planet(s)
Definition at line 174 of file ADIobservation.hpp.
realT mx::improc::ADIobservation< _realT, _derotFunctObj >::m_RDIFluxScale {1} |
Flux scaling to apply to fake planets injected in RDI. Would depend on the assumed spectrum in SDI.
Definition at line 178 of file ADIobservation.hpp.
realT mx::improc::ADIobservation< _realT, _derotFunctObj >::m_RDISepScale {1} |
Scaling to apply to fake planet separation in RDI. Would be ratio of wavelengths for SDI.
Definition at line 179 of file ADIobservation.hpp.