Skip to content

Commit

Permalink
Function of input casting #9
Browse files Browse the repository at this point in the history
Define castingParametersFromCmd to cast the parameters
passed through command line and and put them into parameters
dictionary.

It will allow automatic tests for the algorithm
  • Loading branch information
Dirack committed Oct 4, 2020
1 parent 0e28fc0 commit fabed2f
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions experiments/algorithmVelocityInversion/SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,25 @@ from rsf.proj import *
from diffSimulationAndMigration import diffmig
from diffSimulationAndMigration import diffsimul

def castingParametersFromCmd(param):
'''
casting of the parameters from
command line
:global ARGLIST: list of parameters passed through comand line in scons
:param param: dictionary, parameters dictionary you want to cast
'''
global ARGLIST

for k, v in ARGLIST:
if k in param.keys():
if type(param[k]) is float:
param[k] = float(v)
elif type(param[k]) is int:
param[k] = int(v)
else:
param[k] = v


# Iterative picking - Loop over reflectors
numberOfReflectors = 2
section = '../modelingAndStack/stackedSection.rsf'
Expand Down Expand Up @@ -56,6 +75,11 @@ param = {'diffSimulatedSection': 'diffSimulatedSection',
'nout':2048,
'vx0':None}

# substitute parameters passed through command line
# in parameters dictionaries
castingParametersFromCmd(param)

print(param)
# Diffraction simulation in an iterative picking loop
diffsimul(section,
param['diffSimulatedSection'],
Expand Down

0 comments on commit fabed2f

Please sign in to comment.