Skip to content

Commit 56ba38d

Browse files
committed
heart: replace nprocs by nthreads for pyrocko compatibility
1 parent 5f64395 commit 56ba38d

File tree

4 files changed

+13
-14
lines changed

4 files changed

+13
-14
lines changed

beat/covariance.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ def model_prediction_sensitivity(engine, *args, **kwargs):
465465
kwargs["source_params"] = args[2]
466466

467467
request = kwargs.pop("request", None)
468-
nprocs = kwargs.pop("nprocs", 1)
468+
nthreads = kwargs.pop("nthreads", 1)
469469
source_params = kwargs.pop("source_params", None)
470470
h = kwargs.pop("h", None)
471471

@@ -505,7 +505,7 @@ def model_prediction_sensitivity(engine, *args, **kwargs):
505505
]
506506

507507
response = engine.process(
508-
sources=calc_sources, targets=request.targets, nprocs=nprocs
508+
sources=calc_sources, targets=request.targets, nthreads=nthreads
509509
)
510510

511511
for i_k in range(len(request.targets)):

beat/heart.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3570,7 +3570,7 @@ def seis_synthetics(
35703570
filterer=None,
35713571
reference_taperer=None,
35723572
plot=False,
3573-
nprocs=1,
3573+
nthreads=1,
35743574
outmode="array",
35753575
pre_stack_cut=False,
35763576
taper_tolerance_factor=0.0,
@@ -3597,9 +3597,8 @@ def seis_synthetics(
35973597
filterer : :class:`Filterer`
35983598
plot : boolean
35993599
flag for looking at traces
3600-
nprocs : int
3601-
number of processors to use for synthetics calculation
3602-
--> currently no effect !!!
3600+
nthreads : int
3601+
number of threads to use for synthetics calculation
36033602
outmode : string
36043603
output format of synthetics can be 'array', 'stacked_traces',
36053604
'data' returns traces unstacked including post-processing,
@@ -3656,7 +3655,7 @@ def seis_synthetics(
36563655

36573656
t_2 = time()
36583657
try:
3659-
response = engine.process(sources=sources, targets=targets, nprocs=nprocs)
3658+
response = engine.process(sources=sources, targets=targets, nthreads=nthreads)
36603659
t_1 = time()
36613660
except IndexError:
36623661
for source in sources:
@@ -4157,7 +4156,7 @@ def fft_transforms(
41574156

41584157

41594158
def geo_synthetics(
4160-
engine, targets, sources, outmode="stacked_array", plot=False, nprocs=1
4159+
engine, targets, sources, outmode="stacked_array", plot=False, nthreads=1
41614160
):
41624161
"""
41634162
Calculate synthetic displacements for a given static fomosto Greens
@@ -4173,9 +4172,8 @@ def geo_synthetics(
41734172
containing :class:`pyrocko.gf.seismosizer.Target` Objects
41744173
plot : boolean
41754174
flag for looking at synthetics - not implemented yet
4176-
nprocs : int
4177-
number of processors to use for synthetics calculation
4178-
--> currently no effect !!!
4175+
nthreads : int
4176+
number of threads to use for synthetics calculation
41794177
outmode : string
41804178
output format of synthetics can be: 'array', 'arrays',
41814179
'stacked_array','stacked_arrays'
@@ -4199,7 +4197,7 @@ def geo_synthetics(
41994197
for target in targets:
42004198
print(target)
42014199

4202-
response = engine.process(sources, targets)
4200+
response = engine.process(sources, targets, nthreads=nthreads)
42034201

42044202
ns = len(sources)
42054203
nt = len(targets)

beat/models/geodetic.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,7 @@ def get_synthetics(self, point):
716716
targets=self.targets,
717717
sources=self.sources,
718718
outmode="stacked_arrays",
719+
nthreads=4,
719720
)
720721

721722
synths = []

beat/models/seismic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ def get_synthetics(self, point, **kwargs):
859859
outmode = kwargs.pop("outmode", "stacked_traces")
860860
chop_bounds = kwargs.pop("chop_bounds", ["a", "d"])
861861
order = kwargs.pop("order", "list")
862-
nprocs = kwargs.pop("nprocs", 4)
862+
nthreads = kwargs.pop("nthreads", 4)
863863
force = kwargs.pop("force", False)
864864

865865
self.point2sources(point)
@@ -914,7 +914,7 @@ def get_synthetics(self, point, **kwargs):
914914
arrival_times=arrival_times,
915915
outmode=outmode,
916916
chop_bounds=chop_bounds,
917-
nprocs=nprocs,
917+
nthreads=nthreads,
918918
# plot=True,
919919
**kwargs,
920920
)

0 commit comments

Comments
 (0)