8000 Faster IM Calc for Obs data by joelridden · Pull Request #181 · ucgmsim/IM_calculation · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Faster IM Calc for Obs data #181

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

Merged
merged 11 commits into from
Apr 14, 2025
Merged

Faster IM Calc for Obs data #181

merged 11 commits into from
Apr 14, 2025

Conversation

joelridden
Copy link
Contributor

Speed up improvements by allowing the use of no numexpr.
Deals with pykooh multiprocessing performance issues by switching back to old method of producing KO matrix files.
Improve FAS calculation speed under different scenarios of cores / number of stations to compute for.

Test on all IM's for a single waveform
Before time taken: 21.5s
After time taken: 6.79 s

@joelridden joelridden requested a review from Copilot April 7, 2025 22:53
Copy link
@Copilot 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.

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (3)

IM/ko_matrices.py:29

  • [nitpick] The filename format here (using size - 1) may not match the naming convention used in the KO matrix generator script; consider verifying the consistency between file creation and retrieval.
ko_matrix_file = directory / f"KO_{size - 1}.npy"

IM/ims.py:125

  • [nitpick] Consider annotating the 'out' parameter as Optional[np.ndarray] for clarity, ensuring its intended nullable nature is explicitly documented.
def rotate_components(step_000: np.ndarray, step_090: np.ndarray, theta: np.ndarray, out: np.ndarray =None, use_numexpr: bool =True):

IM/im_calculation.py:189

  • [nitpick] The raised error message for a missing KO directory could be reworded to more clearly indicate that a valid path must be provided when FAS calculations are required.
if ko_directory is None and IM.FAS in ims_list:

@joelridden joelridden requested a review from Copilot April 7, 2025 23:05
Copy link
@Copilot 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.

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (2)

IM/ko_matrices.py:29

  • Ensure that using 'size - 1' in the filename is intentional and consistent with how the KO matrices are generated (in gen_ko_matrix.py, the filename is based on the generated 'n' value).
ko_matrix_file = directory / f"KO_{size - 1}.npy"

IM/im_calculation.py:141

  • The default value for 'use_numexpr' is False here, while other functions and tests often use True. Consider unifying the default values to avoid unexpected performance differences.
use_numexpr: bool = False,

Copy link
Contributor
@lispandfound lispandfound left a comment

Choose a reason for hiding this comment

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

How are we handling the differing dt values? To my understanding of this setup, we are generating KO matrices with dt = 0.005 by default, are you just resampling the waveforms at that dt?

@joelridden
Copy link
Contributor Author

How are we handling the differing dt values? To my understanding of this setup, we are generating KO matrices with dt = 0.005 by default, are you just resampling the waveforms at that dt?

As a note, dt does not matter for us when generating the KO matrix using numpy rfft

@joelridden joelridden requested a review from lispandfound April 8, 2025 01:49
Co-authored-by: Jake Faulkner <jakefaulkn@gmail.com>
Copy link
@Copilot 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.

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (2)

IM/ko_matrices.py:29

  • Ensure that the file naming offset (using size - 1) matches the generated filename pattern from gen_ko_matrix.py. If the intention is to use the matrix dimension 'n' directly, adjust the file naming accordingly.
ko_matrix_file = directory / f"KO_{size - 1}.npy"

IM/im_calculation.py:140

  • [nitpick] There is an inconsistency in the default value for use_numexpr between calculate_ims (defaulting to False) and the lower-level functions (defaulting to True). Verify that this discrepancy is intentional and aligns with the desired performance tuning.
ko_directory: Path = None,

@joelridden joelridden merged commit a0a5a4f into master Apr 14, 2025
5 checks passed
@joelridden joelridden deleted the fast_obs branch April 14, 2025 23:30
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.

3 participants
0