Home | Trees | Indices | Help |
---|
|
Environment with several tools to load and save a database for Radio data.
|
|||
new empty dictionary |
|
||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
dict |
|
||
|
|||
Inherited from Inherited from Inherited from Inherited from |
|
|||
Inherited from |
|
|||
Inherited from |
|
Initializing an instance of Radio. Inherits from the Database class and adds a bit of functionality for the particular case of radio data. Initializing this object returns a Database() class that can contain radio data in the given path. If no db is already present, a new one is created from scratch at given location. The name of the database is radio_data.db by default. Can be changed if needed, but ComboCode does not work with this other name. If nothing more is requested, a new database is essentially empty. The option to parse the content of the target folder is available: This will add entries to the database for the stars in the folder and the 'simple' molecules and transitions. Once a db is created, you can perform several methods on the database specific to radio data management. Examples: For data located in dradio in Path.dat >>> from cc.data import Radio >>> db = Radio.Radio() >>> db.sync() This will create a database, automatically search your data folder for data files that the script can recognize, and save them in the database. The final command ( .sync() ) will then save the database to your hard disk in the same folder, under 'radio_data.db'. Later when you run Radio.Radio() again, it will load that same database that still contains all those datafiles and TRANSITION references. The database is structured per star_name and per transition definition. So for instance, you will find the file whya_co32_APEX.fits in a dict under db['whya']['TRANSITION=12C16O 0 3 0 0 0 2 0 0 APEX 0.0'] where you will find dict([('whya_co32_APEX.fits',None)]) The None refers to the value of the dictionary entry for that file. This is replaced by the fit results of the line when >>> db.fitLP(filename='whya_co32_Maercker_new_JCMT.fits') is ran. The method redoes the fit by default, regardless of there being an entry for it already. Any required fitting parameters can be passed along to the function (see LPTools.fitLP()). CC loads fit results from the database. If multiple data files are available for the same star, the same transition and the same telescope, the multiple data files will also be contained in this dict. Note that the transition definition is quite specific: 1 space between entries, and 11 entries total. It is identical to the input in your combocode inputfile (excluding the final number n_quad, which is model input and has nothing to do with your data). Lastly, you can do multiple things with this database. >>> db.addData(star_name='whya', trans='TRANSITION=12C16O 0 3 0 0 0 2 0 0 JCMT 0.0', filename='whya_co32_Maercker_new_JCMT.fits') will add a new entry to the database if it is not there. This is useful for those molecules/filenames which have not been automatically found by the parseFolder method, because with this method you can still add them whichever way you want. >>> db.removeData(star_name='whya', trans='TRANSITION=12C16O 0 3 0 0 0 2 0 0 JCMT 0.0') removes a whole transition from the database. Alternatively >>> db.removeData(star_name='whya', filename='whya_co32_Maercker_new_JCMT.fits') removes a single filename from the database. (does not delete the file) And if you want to know which datafiles in your data folder are not yet in the database (so you know which you have to add manually): >>> db.checkFolder() prints them out for you. Remember, every time you add or remove data or do a parseFolder(), you have to save the contents of your database in python to the hard disk by doing: >>> db.sync() As long as you don't do this, the hard disk version of the datafile will remain unchanged.
|
Parse the db folder and add filenames to recognized transitions. Includes:
Particularly excludes: (because no naming convention/too complex)
|
Add a new star to the database. A check is ran to see if the requested star is known in ~/ComboCode/usr/Star.dat.
|
Add a new file to the database with given transition definition. If the transition is already present in the database for this particular star, the filename is added to the dictionary for that transition. A single transition for a star can thus have multiple filenames associated with it! Note that this method does NOT automatically sync (ie save changes to the hard disk) the database. That must be done through an additional flag to avoid excess overhead. The transition definition is checked for correctness: single spaces between entries in the defintion, and a total of 11 entries: 1 molecule (shorthand) 8 quantum numbers, 1 offset The fit is not done here. Instead the filename key is added to the transition's dictionary with value None.
|
Remove filenames or transition definitions from the database for a given star_name. Either filename or trans must be given.
|
Filter out the fit results from the contents of the database, eg for printing purposes. If star_name is given, only the star will be printed. Otherwise the full database is printed.
|
Fit the data line profiles with a soft parabola or a Gaussian according to LPTools.fitLP() (see that method for further details). Input keywords require one of these:
The fit is NOT redone by default, if there is an entry in db already. You can force a replacement fit by turning replace on. Note that this method does NOT automatically sync (ie save changes to the hard disk) the database. That must be done through an additional flag to avoid excess overhead.
|
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Mon Nov 7 18:01:56 2016 | http://epydoc.sourceforge.net |