king-michael / simulation_database

Apache License 2.0
1 stars 1 forks source link

API: function that creates the details for a simulation in a metadata object. #14

Open king-michael opened 5 years ago

king-michael commented 5 years ago

Simple function to create the data for simulation details. Just a wrapper that one can get a uniform naming in the database. An the user see's what is there.

def create_simulation_details(entry_id, n_steps=None, time_step=None, ..., **kwargs):
   """
   Function that create simulation details for a given entry_id 
  and stores them into the database.

   Note
   ------
   If the value of an argument is None,
   it will **not** be stored into the database.

   Parameters:
   ----------------
   entry_id : str
     Rendered description for parameters so they are in the docs
   """
   input_args = locals()

   list_dropped_keys = [k for k,v in input_args.items() if v is None]
   for k in list_dropped_keys:
     del input_args[k]   

   ... create entry with the rest of the keywords ...
  return whatever