Skip to content

Commit

Permalink
delete set_env_variable
Browse files Browse the repository at this point in the history
  • Loading branch information
AmirMardan committed Nov 22, 2023
1 parent e004111 commit a76ee64
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@
*.pyc
.DS_Store
17 changes: 7 additions & 10 deletions src/PyFWI/wave_propagation.py
Expand Up @@ -15,15 +15,16 @@

class WavePreparation:

def __init__(self, inpa, src, rec_loc, model_shape, components=0, n_well_rec=0, chpr=10, set_env_variable=True):
def __init__(self, inpa, src,
rec_loc, model_shape, components=0,
n_well_rec=0, chpr=10):
'''
A class to prepare the variable and basic functions for wave propagation.
'''
#TODO: work on how ypu specify the acq_type, getting n_well_rec, using that again fpr two .cl files
keys = [*inpa]

self.set_env_variable = set_env_variable
self.dt_scale = np.ceil(inpa['dt']/0.0006)
self.t = inpa['t']
self.dt_ext = inpa['dt']
Expand Down Expand Up @@ -171,11 +172,6 @@ def __init__(self, inpa, src, rec_loc, model_shape, components=0, n_well_rec=0,
device = inpa["device"]
if device >= len(devices):
raise Exception("Bad chosen device. There are {} available device(s).".format(len(devices)))
else:
device = 0
print("Device {} is chosen.".format(device))

if set_env_variable:
os.environ['PYOPENCL_CTX'] = str(platform) + ':' + str(device)
os.environ['PYOPENCL_COMPILER_OUTPUT'] = '1'

Expand Down Expand Up @@ -618,10 +614,11 @@ class WavePropagator(WavePreparation):
component:
Seismic output
"""
def __init__(self, inpa, src, rec_loc, model_shape, components=0, n_well_rec=0, chpr=0, set_env_variable=True):
def __init__(self, inpa, src, rec_loc,
model_shape, components=0,
n_well_rec=0, chpr=0):
WavePreparation.__init__(self, inpa=inpa, src=src, rec_loc=rec_loc, model_shape=model_shape, components=components,
n_well_rec=n_well_rec, chpr=chpr,
set_env_variable=set_env_variable)
n_well_rec=n_well_rec, chpr=chpr)

def forward_propagator(self, model):
""" This function is in charge of forward modelling for acoustic case
Expand Down

0 comments on commit a76ee64

Please sign in to comment.