Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Goodness-of-Fit Scoring, QOL, and Functional Updates #22

Merged
merged 29 commits into from
Sep 24, 2024

Conversation

xia-fr
Copy link
Collaborator

@xia-fr xia-fr commented Sep 24, 2024

New Content:

  • Ported goodness-of-fit (GoF) scoring system from Seismosoil (Matlab version) to PySeismoSoil.
  • Batch calculation for GoF scoring.

Functional Changes:

  • Added warning for unrealistic rho calculation due to unrealistic overburden pressure for surface layer if it is too thin.
  • Rho calculation now uses the depth of the midpoint of layers.
  • Filter kernel for signal processing now uses the recommended 'sos' output type.
  • Added option in batch simulation class to capture ValueErrors, so a single erroneous simulation doesn't interrupt a batch run.
  • Added option in batch simulation class to use the forkserver context of spawning subprocesses (for Unix systems). This is recommended to prevent slow code in use cases where additional modules and variables other than the ones associated with PySeismoSoil are present in a code.

Addressing Errors:

  • For nonlinear simulations, the dummy curves for ggmax and xi are now created separately from their corresponding calibrated parameters. The values contained in these dummy curves are not consequential for the simulations, but previously both the dummy ggmax and dummy xi curves were generated off of only the ggmax parameters. This would occasionally trigger a ValueError related to unrealistic damping values, since the ggmax parameters are only calibrated to guarantee the shape of the ggmax curve.
  • For hh calibration, added handling for edge cases because the algorithm searches extremely large or small values of 'a'. This prevents RuntimeWarning due to extremely large/small exponentials.

QOL:

  • Multiple curve plotting (in class_curves) now plots all curves on one plot, instead of creating a new plot for every curve.
  • If verbose=False, the outputs from the nonlinear NLHH executables and the other simulation classes are fully suppressed. This prevents flooding of the console when running 1000+ simulations in batch.

Remove mandatory creation of new fig and ax in Multiple_Curves.plot() to allow for superclass Curve's plot() function to handle plotting according to documentation
Remove mandatory creation of new fig and ax in Multiple_Curves.plot() to make functionality consistent with documentation
Prevent unphysical rho calculations due to low overburden pressure for a thin surface layer
As per scipy.signal.butter, "If the transfer function form [b, a] is requested, numerical problems can occur since the conversion between roots and the polynomial coefficients is a numerically sensitive operation"
Even though the dummy curves are not simulation significant, since the ggmax and damping parameters are calibrated separately, allows for the proper curves to be created by their corresponding calibrated parameters to avoid triggering a ValueError related to unrealistic damping curves created from the parameters calibrated for the ggmax curves
…ol verbosity settings

Adds option to capture ValueErrors when running batch simulation, so a single failed simulation won't halt the entire batch process. In addition, adjusts the verbose settings to capture output if verbose is false, so multiple parallel processes won't all be printing the nonlinear simulation progress bar over each other.
Handles situations in which the optimizer searches very large or small values of the 'a' parameter, which may result in a RuntimeWarning due to the exponential in the expression
Class file and file to hold helper functions
Added option to use the forkserver context for spawning subprocesses using the multiprocessing module.
Added forkserver example usage
Updated documentation of new code to meet contribution requirements. Updated tests to reflect minor changes in code. Updated formatting to meet tox requirements.
Fixed filepath error, updated to match recent changes
Added relevant files to docs/
@xia-fr xia-fr merged commit 976a63a into Caltech-geoquake:main Sep 24, 2024
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant