Configuration - EranOfek/AstroPack GitHub Wiki
Class Hierarchy: handle -> Configuration
The Configuration singleton class is a container for configuration parameters, pipelines default arguments, and additional data required by some AstroPack functions. The Configuration class generates a singleton object. This means only that one copy of the object exists in the MATLAB session. Whenever the user generates a new Configuration object, they will get a pointer for the single copy of this object.
The data in the Configuration object is loaded from the config/ directory in the AstroPack/ directory.
The Configuration object provides a simple and safe way to use global variables.
Any file in the config/ directory will be loaded, on demand, to the Configuration object. In addition, the config/ directory contains a local/ directory. The local directory has a .gitignore file and therefore its content is ignored by git. Any private data, can be stored in the local/ directory and it will not be uploaded to github.
The files in the config/ directory are stored in yml format and have the .yml extension.
The file names in the config/ directory have names like: Header.Synonyms.KeyNames.yml or Header.Synonyms.KeyVal.IMTYPE.yml or WCS.ProjType.yml. These files will be uploaded as a structure to the Data property in the Configuration object. For example, the content of the: Header.Synonyms.KeyNames.yml file will be stored, as a structure, under Object.Data.Header.Synonyms.KeyNames.
The BitMask.Image.Default.yml config file contains the default bit mask dictionary used by the image processing pipeline.
Saturated : [0 , 'Pixel is saturated']
LowRN : [1 , 'Pixel noise is low (Var<median(Var).*0.05) (probably dead)']
HighRN : [2 , 'Pixel noise is high (Var>10*median(Var)) (noisy pixel)']
DarkHighVal : [3 , 'Pixel bias/dark value is high (>2*Mean)']
DarkLowVal : [4 , 'Pixel bias/dark value is low (<0.2*Mean)']
BiasFlaring : [5 , 'Pixel is possibly flaring (>20 sigma)']
NaN : [6 , 'Pixel is NaN due to illegal arithmatics']
FlatHighStd : [7 , 'Flat Std/sqrt(N) is high (Std/sqrt(N)>0.01)']
FlatLowVal : [8 , 'Flat normalized value is low (<0.1)']
LowQE : [9 , 'Pixel with low QE (<0.5 from the nominal)']
Negative : [10 , 'Negative pixel after processing']
Interpolated : [11 , 'Pixel with interpolated value']
Hole : [12 , 'Hole (anti-star)']
Spike : [13 , 'Diffraction spike']
CR_DeltaHT : [14 , 'CR identified using HT to delta function']
CR_Laplacian : [15 , 'CR identified using laplacian filter']
CR_Streak : [16 , 'CR streak']
Ghost : [17 , 'Ghost']
Persistent : [18 , 'Persistent charge']
Xtalk : [19 , 'Cross talk']
Streak : [20 , 'Streak']
ColumnLow : [21 , 'Bad column low values']
ColumnHigh : [22 , 'Bad column high values']
NearEdge : [23 , 'Near image edge']
NonLinear : [24 , 'Non linear']
Bleeding : [25 , 'Possible bleeding/blooming']
Overlap : [26 , 'In overlap region']
SrcNoiseDominated: [27 , 'S/N is source dominated (Val-Back)>Back']
GainHigh : [28 , 'In duel gain-detectors: Gain is high']
CoaddLessImages : [29 , 'Number of images in coadd is less than X percent']
SrcDetected : [30 , 'Source detected (all pixels within 1xFWHM radius from detected source)']
You can also store anonymous functions in a config file. For example, the Header.Time.KeyNames.yml file contains instructions on how to convert various header keyword values to JD:
MIDJD : ['@(Time,Exp) Time']
MIDMJD : ['@(Time,Exp) convert.time(Time,''MJD'',''JD'')']
JD : ['@(Time,Exp) Time + 0.5.*Exp./86400']
MJD : ['@(Time,Exp) convert.time(Time,''MJD'',''JD'') + 0.5.*Exp./86400']
DATEOBS: ['@(Time,Exp) convert.time(Time,''StrDate'',''JD'') + 0.5.*Exp./86400']
TIMEOBS: ['@(Time,Exp) convert.time(Time,''StrDate'',''JD'') + 0.5.*Exp./86400']
DATE : ['@(Time,Exp) convert.time(Time,''StrDate'',''JD'') + 0.5.*Exp./86400']
These will be stored as anonymous functions and can be executed by MATLAB.
To generate Singelton Configuration object:
C=Configuration.getSingleton;
A Configuration object is generated and linked to any class that inherits from the Component class. For example, the AstroImage class contains a Configuration object in the Config property.
AI = AstroImage;
AI.Config
In case the config/ directory was updated, you may want to reload its content (this will not happen automatically):
Configuration.reloadSysConfig()
To upload additional file to a Configuration object:
MyConfig = Configuration();
MyConfig.loadFile('C:/Temp/MyConfig.yml');
Alternatively, you can load all the files in a directory:
MyConfig = Configuration();
MyConfig.loadFile('C:/Temp/MyConfigFolder');