-
Notifications
You must be signed in to change notification settings - Fork 19
feat: add mccc #217
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
feat: add mccc #217
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -169,11 +169,16 @@ def cli_settings_list( | |||||
| *, | ||||||
| pretty: bool = True, | ||||||
| ) -> None: | ||||||
| """Print a table with default settings used in AIMBAT. | ||||||
| """Print a table with default settings currently in use by AIMBAT. | ||||||
|
|
||||||
| These defaults control the default behavior of AIMBAT within a project. | ||||||
| They can be changed using environment variables of the same name, or by | ||||||
| adding a `.env` file to the current working directory. | ||||||
| Overriding these defaults can be done on a per-project basis in the | ||||||
| fllowing ways (in order of precedence): | ||||||
|
||||||
| fllowing ways (in order of precedence): | |
| following ways (in order of precedence): |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| """Align seismograms using ICCS or MCCC. | ||
|
|
||
| This command aligns seismograms using either the ICCS or MCCC algorithm. Both | ||
| commands update the pick stored in `t1`. If `t1` is `None`, `t0` is used as | ||
| starting point instead, with the resulting pick stored in `t1`. | ||
| """ | ||
|
|
||
| from ._common import GlobalParameters, simple_exception | ||
| from cyclopts import App, Parameter | ||
| from typing import Annotated | ||
|
|
||
| app = App(name="align", help=__doc__, help_format="markdown") | ||
|
|
||
|
|
||
| @app.command(name="iccs") | ||
| @simple_exception | ||
| def cli_iccs_run( | ||
| *, | ||
| autoflip: bool = False, | ||
| autoselect: bool = False, | ||
| global_parameters: GlobalParameters | None = None, | ||
| ) -> None: | ||
| """Run the ICCS algorithm. | ||
|
|
||
| Args: | ||
| autoflip: Whether to automatically flip seismograms (multiply data by -1). | ||
| autoselect: Whether to automatically de-select seismograms. | ||
| """ | ||
| from aimbat.db import engine | ||
| from aimbat.core import create_iccs_instance, run_iccs | ||
| from sqlmodel import Session | ||
|
|
||
| global_parameters = global_parameters or GlobalParameters() | ||
|
|
||
| with Session(engine) as session: | ||
| iccs = create_iccs_instance(session) | ||
| run_iccs(session, iccs, autoflip, autoselect) | ||
|
|
||
|
|
||
| @app.command(name="mccc") | ||
| @simple_exception | ||
| def cli_mccc_run( | ||
| *, | ||
| all_seismograms: Annotated[bool, Parameter(name="all")] = False, | ||
| global_parameters: GlobalParameters | None = None, | ||
| ) -> None: | ||
| """Run the MCCC algorithm. | ||
|
|
||
| Args: | ||
| all_seismograms: Whether to include all seismograms in the MCCC processing, or just the selected ones. | ||
| """ | ||
| from aimbat.db import engine | ||
| from aimbat.core import create_iccs_instance, run_mccc | ||
| from sqlmodel import Session | ||
|
|
||
| global_parameters = global_parameters or GlobalParameters() | ||
|
|
||
| with Session(engine) as session: | ||
| iccs = create_iccs_instance(session) | ||
| run_mccc(session, iccs, all_seismograms) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| app() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use British English spelling in docstrings:
behavior→behaviour.