Build parameters from enviromental variables

17 views
Skip to first unread message

Livia Barazzetti

unread,
Aug 8, 2015, 9:51:35 AM8/8/15
to sumatra-users
Hi, 
I recently started  using Sumatra and I like very much its functionality. I am trying the parameters functionality. In my python script I use 

parameters = sumatra.parameteres.build_parameters(parmeters_file)

Is it possible to build (or update) the parameters with the value of some enviromental variables? 

Thank you
Best Regards
Livia Barazzetti

Andrew Davison

unread,
Sep 1, 2015, 9:16:06 AM9/1/15
to sumatra-users
Dear Livia,

Many apologies for not replying sooner. This somehow slipped by during my summer vacation. 

On Saturday, 8 August 2015 15:51:35 UTC+2, Livia Barazzetti wrote: 
I recently started  using Sumatra and I like very much its functionality. I am trying the parameters functionality. In my python script I use 

parameters = sumatra.parameteres.build_parameters(parmeters_file)

Is it possible to build (or update) the parameters with the value of some enviromental variables? 

Yes. All the Sumatra `ParameterSet` subclasses behave in many ways like normal Python dictionaries. So for example you could do:

  parameters.update(home=os.environ['HOME'], path=os.environ['PATH'])

or equivalently

  parameters.update({'home': os.environ['HOME'], 'path': os.environ['PATH']})

Best regards,

Andrew




Reply all
Reply to author
Forward
0 new messages