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

Class ModelingSession

source code


The basic modeling environment. Inherited by MCMax() and Gastronoom().

Instance Methods [hide private]
 
__init__(self, code, path, replace_db_entry=0, new_entries=[], single_session=0)
Initializing an instance of ModelingSession.
source code
 
makeNewId(self)
Make a new model_id based on the current UTC in seconds since 1970.
source code
bool
setCommandKey(self, comm_key, star, key_type, star_key=None, alternative=None, make_int=0, exp_not=0)
Try setting a key in the command_list from a star instance.
source code
bool
compareCommandLists(self, this_list, modellist, code, ignoreAbun=0, extra_dict=None, check_keys=[])
Comparing a command_list with a database entry.
source code
 
cCL(self, *args, **kwargs)
Short-hand helper function for compareCommandLists.
source code

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, code, path, replace_db_entry=0, new_entries=[], single_session=0)
(Constructor)

source code 

Initializing an instance of ModelingSession.

Parameters:
  • code (string) - code for which the modelingsession is created
  • path (string) - modeling output folder in the code's home folder
  • replace_db_entry (bool) - replace an entry in the database with a newly calculated model with a new model id (eg 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: [])

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

    (default: 0)

Overrides: object.__init__

setCommandKey(self, comm_key, star, key_type, star_key=None, alternative=None, make_int=0, exp_not=0)

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()) - The parameter set
  • key_type (string) - the type of the keyword, either 'DUST' or 'GAS'
  • star_key (string) - the name of the keyword in the star instance (minus '_%s'%key_type, which is added as well in a second attempt if the first without the addition is not found), if None, it is 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)

  • make_int (boolean) - make an integer before converting to string for this keyword.

    (default: 0)

  • exp_not (bool) - Convert to exponential notation in a string

    (default: 0)

Returns: bool
True if successful, otherwise False.

compareCommandLists(self, this_list, modellist, code, ignoreAbun=0, extra_dict=None, check_keys=[])

source code 

Comparing a command_list with a database entry.

Parameters:
  • this_list (dict) - parameters in this modeling session
  • modellist (dict) - parameters from database model
  • code (string) - The GASTRoNOoM subcode
  • ignoreAbun (bool) - only relevant for mline: ignore the 4 abundance parameters (such as for co)

    (default: 0)

  • extra_dict (dict) - if not None this gives extra dictionary entries to be used in the comparison on top of this_list. The extra entries are assumed present in modellist otherwise the comparison will return False.

    (default: None)

  • check_keys (list[str]) - Only check keys given in this list. If empty, the standard keyword lists are used.

    (default: [])

Returns: bool
Comparison between the two parameter sets