Package ComboCode :: Package cc :: Package modeling :: Package codes :: Module Gastronoom :: Class Gastronoom
[hide private]
[frames] | no frames]

Class Gastronoom

source code


Class that includes all methods required for creating a GATRoNOoM model.

Instance Methods [hide private]
 
__init__(self, path_gastronoom='runTest', vic=None, sphinx=0, replace_db_entry=0, cool_db=None, ml_db=None, sph_db=None, skip_cooling=0, recover_sphinxfiles=0, new_entries=[], single_session=0)
Initializing an instance of a GASTRoNOoM modeling session.
source code
 
addTransInProgress(self, trans)
Remember a transition in progress.
source code
 
addMolecInProgress(self, molec)
Remember a molecule in progress.
source code
 
execGastronoom(self, filename, subcode)
Execute a subprocess of GASTRoNOoM: cooling, mline or sphinx
source code
 
makeIdLog(self, new_id, molec_id=None)
Make a text file with the original cooling id in it.
source code
 
updateModel(self, model_id=None)
Updating model name in command list, eg in case mline or sphinx require a new model_id, different from the cooling model_id.
source code
 
deleteCoolingId(self, model_id)
Delete everything from all databases that has anything to do with this cooling id.
source code
bool
checkCoolingDatabase(self, molec_dict)
Checking cooling database.
source code
list[bool]
checkMlineDatabase(self)
Check mline database.
source code
 
checkSphinxDatabase(self)
Check Sphinx database.
source code
 
copyOutput(self, entry, old_id, new_id)
Copy modelling output based on model_id.
source code
 
doCooling(self, star)
Run Cooling.
source code
 
doMline(self, star)
Run mline.
source code
 
doSphinx(self, star)
Run Sphinx.
source code
 
finalizeSphinx(self)
Check if at least one of the transitions has been calculated correctly.
source code
 
checkSphinxOutput(self, trans)
Check if sphinx output is complete and update the database with calculated models.
source code
bool
setCommandKey(self, comm_key, star, star_key=None, alternative=None)
Try setting a key in the command_list from a star instance.
source code
 
doGastronoom(self, star)
Run GASTRoNOoM-cooling.
source code

Inherited from cc.modeling.codes.ModelingSession.ModelingSession: cCL, compareCommandLists, makeNewId

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, path_gastronoom='runTest', vic=None, sphinx=0, replace_db_entry=0, cool_db=None, ml_db=None, sph_db=None, skip_cooling=0, recover_sphinxfiles=0, new_entries=[], single_session=0)
(Constructor)

source code 

Initializing an instance of a GASTRoNOoM modeling session.

A single cooling model and a given set of molecules and transitions are calculated here or are retrieved from the databases.

Parameters:
  • path_gastronoom (string) - modeling folder in GASTRoNOoM home

    (default: 'runTest')

  • vic (Vic()) - the vic manager for running sphinx models on VIC3

    (default: None)

  • sphinx (bool) - Running Sphinx?

    (default: 0)

  • replace_db_entry (bool) - replace an entry in the databases with a newly calculated model with a new model id (e.g. if some general data not included in the inputfiles is changed)

    (default: 0)

  • new_entries (list[str]) - The new model_ids when replace_db_entry is 1 of other models in the grid. These are not replaced!

    (default: [])

  • skip_cooling (bool) - Skip running cooling in case a model is not found in the database, for instance if it is already known that the model will fail

    (default: 0)

  • recover_sphinxfiles (bool) - Try to recover sphinx files from the disk in case they were correctly calculated, but not saved to the database for one reason or another.

    (default: 0)

  • cool_db (Database()) - the cooling database

    (default: None)

  • ml_db (Database()) - the mline database

    (default: None)

  • sph_db (Database()) - the sphinx database

    (default: None)

  • single_session (bool) - If this is the only CC session. Speeds up db check.

    (default: 0)

Overrides: object.__init__

addTransInProgress(self, trans)

source code 

Remember a transition in progress. They will be checked at the end of a VIC run to see if they have been correctly calculated. If being calculated in another CC session, they will not be checked. But the user can always reload.

Parameters:
  • trans (Transition()) - The transition in progress

addMolecInProgress(self, molec)

source code 

Remember a molecule in progress. The model manager will wait until it is finished.

Parameters:
  • molec (Molecule()) - The molecule in progress

execGastronoom(self, filename, subcode)

source code 

Execute a subprocess of GASTRoNOoM: cooling, mline or sphinx

Parameters:
  • filename (string) - the full path+filename of the inputfile
  • subcode (string) - one of ['cooling','mline','sphinx'], the code to run

makeIdLog(self, new_id, molec_id=None)

source code 

Make a text file with the original cooling id in it.

This is used when creating a Transition() from a sphinx outputfilename.

Parameters:
  • new_id (string) - the new id for either mline or sphinx
  • molec_id (string) - if given, an mline_id.log will be made including the mline id to which molecules are linked

    (default: None)

updateModel(self, model_id=None)

source code 

Updating model name in command list, eg in case mline or sphinx require a new model_id, different from the cooling model_id.

Parameters:
  • model_id (string) - if None the instance's model_id is taken, otherwise this one is used

    (default: None)

deleteCoolingId(self, model_id)

source code 

Delete everything from all databases that has anything to do with this cooling id.

The databases on the hard disk are updated as well!

Parameters:
  • model_id (string) - the cooling model_id

checkCoolingDatabase(self, molec_dict)

source code 

Checking cooling database.

Parameters:
  • molec_dict (dict()) - molecule info for this cooling model, ie CO and H2O
Returns: bool
The presence of the cooling model in the database

checkMlineDatabase(self)

source code 

Check mline database.

Returns: list[bool]
The presence of mline models in the database, equivalent with self.molec_list

checkSphinxDatabase(self)

source code 

Check Sphinx database.

The presence of the sphinx models in the database is saved in self.trans_bools, equivalent to self.trans_list

copyOutput(self, entry, old_id, new_id)

source code 

Copy modelling output based on model_id.

Parameters:
  • entry (Molecule() or Transition()) - the modeling object for which output is copied
  • old_id (string) - The old model_id
  • new_id (string) - the new_model_id

doCooling(self, star)

source code 

Run Cooling.

First, database is checked for retrieval of old model.

Parameters:
  • star (Star()) - The parameter set for this session

doMline(self, star)

source code 

Run mline.

First, database is checked for retrieval of old models.

Parameters:
  • star (Star()) - The parameter set for this session

doSphinx(self, star)

source code 

Run Sphinx.

First, database is checked for retrieval of old models.

Parameters:
  • star (Star()) - The parameter set for this session

finalizeSphinx(self)

source code 

Check if at least one of the transitions has been calculated correctly.

if not, self.model_id is set to "".

checkSphinxOutput(self, trans)

source code 

Check if sphinx output is complete and update the database with calculated models.

Requires model_id and path defined in Gastronoom instance.

Parameters:
  • trans (Transition()) - the transition that is being checked

setCommandKey(self, comm_key, star, star_key=None, alternative=None)

source code 

Try setting a key in the command_list from a star instance.

If the key is unknown, it is left open and will be filled in from the standard gastronoom inputfile.

Parameters:
  • comm_key (string) - the name of the keyword in the command list
  • star (Star()) - Parameter set for this session
  • star_key (string) - the name of the keyword in Star() (minus '_%s' %key_type (DUST or GAS), which is added as well in a second attempt if the first without the addition is not found). If None, it's equal to comm_key

    (default: None)

  • alternative (string) - a default value passed from the standard inputfile that is used if the keyword or the keyword + '_%s'%key_type is not found in Star().

    (default: None)

Returns: bool
Success?
Overrides: cc.modeling.codes.ModelingSession.ModelingSession.setCommandKey

doGastronoom(self, star)

source code 

Run GASTRoNOoM-cooling.

The input parameter list is prepared here.

Parameters:
  • star (Star()) - Parameter set for this session