Skip to content

Commit 7da7816

Browse files
committed
Fixed NumPy compatibility issue in PyNGA, small improvements and typo fixes to other codes
1 parent ced9282 commit 7da7816

9 files changed

Lines changed: 29 additions & 19 deletions

File tree

gmsvtoolkit/metrics/calc_gmpe.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"""
33
BSD 3-Clause License
44
5-
Copyright (c) 2023, University of Southern California
5+
Copyright (c) 2026, University of Southern California
66
All rights reserved.
77
88
Redistribution and use in source and binary forms, with or without
@@ -141,9 +141,6 @@ def parse_arguments(self):
141141
help="output directory")
142142
parser.add_argument("--gmpe-group", dest="gmpe_group", required=True,
143143
help="GMPE group %s" % (self.gmpe_groups))
144-
parser.add_argument("-o", "--output", "--output-file",
145-
dest="output_file",
146-
help="output rd100 file")
147144
parser.add_argument("--station-list", "-s", dest="station_list", required=True,
148145
help="station list for batch processing")
149146
parser.add_argument("--src-file", "--src", dest="src_file", required=True,

gmsvtoolkit/models/pynga/AS08.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ def calc_sigma_tau(self):
710710
2. * alpha * tauB_T * tauB_PGA * self.rho[indT])
711711
sigmaTot = np.sqrt(sigma**2 + tau**2)
712712

713-
return (sigma, tau, sigmaTot)
713+
return (np.float64(sigma[0]), np.float64(tau[0]), np.float64(sigmaTot[0]))
714714

715715
def AS08nga_test(T, CoefTerms):
716716
"""

gmsvtoolkit/models/pynga/BA08.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,9 +434,13 @@ def compute_std(self):
434434
try:
435435
ind = (np.array(self.periods) == self.T).nonzero()[0]
436436
if FT == 'U':
437-
return (self.sigma_TU[ind], self.tau_U[ind], self.sigma0[ind])
437+
return (np.float64(self.sigma_TU[ind][0]),
438+
np.float64(self.tau_U[ind][0]),
439+
np.float64(self.sigma0[ind][0]))
438440
else:
439-
return (self.sigma_TM[ind], self.tau_M[ind], self.sigma0[ind])
441+
return (np.float64(self.sigma_TM[ind][0]),
442+
np.float64(self.tau_M[ind][0]),
443+
np.float64(self.sigma0[ind][0]))
440444
except:
441445
print('inputed T not found in the available periods list, try to do interpolation')
442446
raise ValueError

gmsvtoolkit/models/pynga/CB08.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,10 @@ def sd_calc(self):
526526
sigmaArb = np.sqrt(sigmaT**2 + self.sigma_C[indT]**2)
527527

528528
# standard deviations are in logarithm scale !!!
529-
return (sigma, tau, sigmaT, sigmaArb)
529+
return (np.float64(sigma[0]),
530+
np.float64(tau[0]),
531+
np.float64(sigmaT[0]),
532+
np.float64(sigmaArb[0]))
530533

531534
def CB08nga_test(T, CoefTerms):
532535
"""

gmsvtoolkit/models/pynga/CY08.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,9 @@ def calc_sigma_tau(self):
525525
sigmaT = np.sqrt(sigma**2 + tauNL**2)
526526

527527
#return (sigma, tau, sigmaT)
528-
return (sigma, tauNL, sigmaT)
528+
return (np.float64(sigma[0]),
529+
np.float64(tauNL[0]),
530+
np.float64(sigmaT[0]))
529531

530532
def CY08nga_test(T, CoefTerms):
531533
"""

gmsvtoolkit/plots/plot_gmpe.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
#!/bin/env python
1+
#!/bin/env python3
22
"""
33
BSD 3-Clause License
44
5-
Copyright (c) 2023, University of Southern California
5+
Copyright (c) 2026, University of Southern California
66
All rights reserved.
77
88
Redistribution and use in source and binary forms, with or without

gmsvtoolkit/plots/plot_gmpe_gof.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
"""
33
BSD 3-Clause License
44
5-
Copyright (c) 2023, University of Southern California
5+
Copyright (c) 2026, University of Southern California
66
All rights reserved.
77
88
Redistribution and use in source and binary forms, with or without
@@ -318,9 +318,13 @@ def run():
318318
output_dir = os.path.abspath(output_dir)
319319
station_file = os.path.abspath(args.station_list)
320320

321-
# Plot GMPE GOF plot
322-
plot_title = "Comparison between GMPEs and %s" % (args.comp_label)
321+
# Set up plot title
322+
if args.plot_title is not None:
323+
plot_title = args.plot_title
324+
else:
325+
plot_title = "Comparison between GMPEs and %s" % (args.comp_label)
323326

327+
# Plot GMPE GOF plot
324328
plot_gmpe_gof(station_file, args.gmpe_group, args.comp_label,
325329
plot_title, input_dir, output_dir, args.run_prefix)
326330

gmsvtoolkit/stats/fas_gof.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
"""
33
BSD 3-Clause License
44
5-
Copyright (c) 2023, University of Southern California
5+
Copyright (c) 2026, University of Southern California
66
All rights reserved.
77
88
Redistribution and use in source and binary forms, with or without

gmsvtoolkit/stats/gmpe_gof.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
"""
33
BSD 3-Clause License
44
5-
Copyright (c) 2023, University of Southern California
5+
Copyright (c) 2026, University of Southern California
66
All rights reserved.
77
88
Redistribution and use in source and binary forms, with or without

0 commit comments

Comments
 (0)