Skip to content

Add more options for SRF parameters#73

Merged
lispandfound merged 8 commits intopegasusfrom
srf_options
Jan 6, 2026
Merged

Add more options for SRF parameters#73
lispandfound merged 8 commits intopegasusfrom
srf_options

Conversation

@lispandfound
Copy link
Contributor

@lispandfound lispandfound commented Nov 25, 2025

This PR extracts explicitly set SRF parameters, and adds some extra parameters used for subduction sources.

See #78 first! This PR includes its changes to pass tests.

Copilot AI review requested due to automatic review settings November 25, 2025 20:56
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @lispandfound, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the configurability of Synthetic Rupture File (SRF) generation by introducing a comprehensive set of new parameters, many of which are specifically designed for subduction zone source modeling. The changes involve extending the core SRFConfig class, integrating these parameters into default settings across multiple workflow versions, and modifying the SRF generation script to dynamically apply these new options, thereby increasing the flexibility and precision of rupture simulations.

Highlights

  • Expanded SRF Configuration: New parameters such as side_taper, bot_taper, top_taper, alpha_rough, gwid, rvfac_seg, seg_delay, ymag_exp, xmag_exp, kx_corner, and ky_corner have been integrated into the SRFConfig class to provide more detailed control over Synthetic Rupture File generation.
  • Dynamic genslip Command Generation: The script responsible for generating SRF files now dynamically constructs the genslip command, leveraging the newly added parameters from the SRFConfig to enable more flexible and precise SRF creation based on configuration.
  • Updated Default Parameters: Default values for all the new SRF parameters have been added to various defaults.yaml files across different workflow versions, ensuring consistent initial settings for these new options.
  • Improved Schema Validation: New validation rules, including a dedicated _is_proportion function, have been introduced in workflow/schemas.py to enforce the correctness and valid ranges of the newly added SRF parameters.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors SRF parameter handling by extracting hardcoded values into configuration and adding new parameters for subduction sources. The changes are consistent across tests, default configurations, and schema definitions. I've found a high-severity bug in how list parameters are formatted for the genslip command, which will likely cause it to fail. I also have two medium-severity suggestions: one to address the removal of the rup_delay parameter which could alter behavior, and another to remove some redundant code for better maintainability. Addressing these points will improve the correctness and quality of the changes.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extracts explicitly set SRF (Standard Rupture Format) parameters from hardcoded values into configurable fields, and adds support for additional parameters used in subduction source simulations. The changes enable more flexible configuration of genslip parameters for seismic rupture modeling.

Key Changes:

  • Extracts taper, roughness, and segment parameters (previously hardcoded) into configurable SRF fields
  • Adds optional subduction-specific parameters (ymag_exp, xmag_exp, kx_corner, ky_corner)
  • Refactors SRFConfig.to_dict() to use dataclasses.asdict() for more maintainable serialization

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
workflow/scripts/realisation_to_srf.py Updates genslip command construction to use configurable parameters instead of hardcoded values; adds dynamic parameter extension for subduction settings
workflow/schemas.py Adds validation schemas for new SRF parameters with appropriate type constraints; moves comment block for better organization
workflow/realisations.py Extends SRFConfig dataclass with new parameter fields; simplifies to_dict() method using dataclasses.asdict()
workflow/default_parameters/*/defaults.yaml Adds default values for new SRF parameters across all configuration versions
tests/test_realisation.py Updates test expectations to include new SRF parameters

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@lispandfound
Copy link
Contributor Author

Depends on #78

@lispandfound
Copy link
Contributor Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request primarily updates the SRF (Source Rupture File) configuration and related dependencies. The pyproject.toml file was updated to restrict the Python version to <3.14 and to change UCGMSim dependencies from direct git URLs to package names with version constraints. The SRFConfig class in workflow/realisations.py and its corresponding schema in workflow/schemas.py were significantly expanded to include numerous new parameters for controlling slip tapering, roughness, segment delays, slip distribution, and risetime, while removing the explicit genslip_version field. These new SRF parameters were also added to all default parameter YAML files (workflow/default_parameters/*defaults.yaml). Test cases in tests/test_realisation.py were updated to reflect these new SRF configuration parameters. Additionally, workflow/scripts/generate_station_coordinates.py was modified to use a separate Resolution object for calculating grid dimensions and coordinates, ensuring consistency. In workflow/scripts/generate_velocity_model_parameters.py, the pgv_from_rrup and estimate_rrup functions were updated to include a ztor parameter (distance to top of fault), and the max_depth calculation was refined to correctly handle point sources. Type hints and strictness checks were improved in the dict_zip utility function, and a type ignore comment was added in workflow/scripts/hf_sim.py for a longitude parameter. Finally, workflow/scripts/realisation_to_srf.py introduced a new helper function _build_genslip_command to dynamically construct genslip commands based on the new SRFConfig parameters, replacing a hardcoded list of arguments.

@lispandfound lispandfound merged commit 6dd2922 into pegasus Jan 6, 2026
7 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.

4 participants