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

Pyadjoint v0.2.0 #9

Merged
merged 44 commits into from
Jan 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
7d38ad7
renamed doc -> docs
bch0w Dec 21, 2022
90ee55c
fixed up formatting and removed py2 backwards compatibility from all …
bch0w Dec 21, 2022
4374741
bombed out old test directory, started new test directory
bch0w Dec 21, 2022
90dae23
reformatted docstrings in dpss to match rest of package
bch0w Dec 21, 2022
a4681d6
moved calculate adjoint source funtion to new 'main' script to clean …
bch0w Dec 21, 2022
f319227
cleaned up main processing script, updated readme, updated .gitignore
bch0w Dec 21, 2022
9d690e2
waveform misfit update: adjusted how the actual integration is perfor…
bch0w Dec 21, 2022
ec8dc6b
finished waveform misfit update with new 'windows' return value added…
bch0w Dec 21, 2022
3120736
reformatting cc_traveltime_misfit file to be clearer what the main fu…
bch0w Dec 21, 2022
5232bf6
added window stats to cc_traveltime_misfit function, moved cc_error a…
bch0w Dec 22, 2022
6425126
overhauling and cleaning up mtm class, in progress, large sweeping ch…
bch0w Dec 22, 2022
a7b4810
removed .idea directory and .swp file
bch0w Dec 22, 2022
f19ce8a
finished rough cleanup of MTM but still needs work
bch0w Dec 22, 2022
525fb1e
finished up MTM overhaul. renamed mtm util back to 'dpss' as it wasn'…
bch0w Dec 22, 2022
28921f5
moved log messages into main mtm caluclate function for easier readab…
bch0w Dec 22, 2022
ce954ef
baselined both waveform misft and cctm against Princeton/Mines versio…
bch0w Dec 23, 2022
c5edb67
bug fix boolean check min cycle in windows to match old code
bch0w Jan 1, 2023
c515bd3
multitaper adjoint source bugfixes and tests passing, windowed stats …
bch0w Jan 1, 2023
e91e0a9
added exponentiated phase misfit copied from rdno version, cleaned up…
bch0w Jan 1, 2023
e2698e8
test passing for exponentiated phase misfit
bch0w Jan 1, 2023
59dccdf
added double difference measurement directly into waveform misfit fun…
bch0w Jan 1, 2023
3297a68
amended calculate_adjoint_source main function to accomodate double d…
bch0w Jan 1, 2023
827284e
removed plotting from all underlying adjoint sources and moved into m…
bch0w Jan 1, 2023
22e767a
removed boolean flags for adjsrc and window stats from all files
bch0w Jan 3, 2023
b7061c1
added DD capability to CCTM and added test to basic cover it
bch0w Jan 4, 2023
e334e0f
started work on DD MTM
bch0w Jan 4, 2023
10d6f0a
finished including bulk of DD MTM measurement capabilities. still req…
bch0w Jan 5, 2023
4eefa53
bugfix incorrect sign for < check
bch0w Jan 6, 2023
de108d6
fixed MTM test
bch0w Jan 6, 2023
6a7df81
running and passing test for DD MTM misfit
bch0w Jan 6, 2023
bea1673
removed old documentation style and moved all descriptions and docume…
bch0w Jan 7, 2023
876f27f
removed 'adjsrc_type' variable from the main calculate function as it…
bch0w Jan 7, 2023
2fefd92
moved config docstrings into main class to get sphinx autoapi to reco…
bch0w Jan 7, 2023
c80714f
adding usage code snippets to each of the misfit functions. added cit…
bch0w Jan 7, 2023
1d20e98
added disclaimers for math in all documentation and pointed to releva…
bch0w Jan 10, 2023
67a8ecb
finished double difference documentation. copped out on MTM because e…
bch0w Jan 10, 2023
cd2753c
moved warnings for double difference docs to the top of page to dissu…
bch0w Jan 10, 2023
4377b03
remove manifest file
bch0w Jan 10, 2023
cc46f33
all tests now passing
bch0w Jan 10, 2023
53d0947
waveform doc example force choice to be waveform
bch0w Jan 10, 2023
da39a16
minor package updates for v0.1.0 release
bch0w Jan 10, 2023
0d2bbd5
Merge pull request #8 from adjtomo/package_refactor
bch0w Jan 10, 2023
ea7e2c3
Update README.md
bch0w Jan 10, 2023
fc409c9
Update CHANGELOG.md
bch0w Jan 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
177 changes: 165 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,167 @@
*.egg-info
*.pyc
*/__pycache__
/doc/index.rst
/doc/example_dataset.rst
/doc/adjoint_sources/
/doc/_build/*
/doc/index_files/*
/doc/example_dataset_files/*
*.ipynb_checkpoints*
dist/*
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
htmlcov
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Misc.
pyadjoint/tests/**png
pyadjoint/tests/baseline_images/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Mac OS
.DS_Store

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/
4 changes: 2 additions & 2 deletions .travis-update-gh-pages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
git config --global user.name "Travis"

# Using token clone gh-pages branch. Pipe to /dev/null to avoid printing the decrypted key.
git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/krischer/pyadjoint gh-pages > /dev/null
git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/adjtomo/pyadjoint gh-pages > /dev/null

# Go there, and overwrite everything with the freshly built contents.
cd gh-pages
rm -rf *
cp -Rf $TRAVIS_BUILD_DIR/doc/_build/html/* .
cp -Rf $TRAVIS_BUILD_DIR/docs/_build/html/* .

# add, commit and push files
git add -f .
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ install:

script:
- coverage run --source=src/pyadjoint -m pyadjoint.tests
- if [[ $TRAVIS_PYTHON_VERSION == '3.5' ]]; then cd $TRAVIS_BUILD_DIR/doc; make html ; fi
- if [[ $TRAVIS_PYTHON_VERSION == '3.5' ]]; then cd $TRAVIS_BUILD_DIR/docs; make html ; fi

after_success:
- cd $TRAVIS_BUILD_DIR; coveralls
Expand Down
83 changes: 81 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,81 @@
Changelog
---------
# Change Log
## v0.1.0
### Package structure
- Renamed 'pyadjoint/doc/' -> 'pyadjoint/docs'
- Renamed 'pyadjoint/src/' -> 'pydjoint/pyadjoint'
- Removed 'setup.py' in favor of new 'pyproject.toml'
- Updated setup URLs for dev team and website
- Reorganized main dir structure to include a utils/ directory which now
houses `dpss` and `utils`. Utils script split into multiple files for
increased organization.
- Revamped documentation, removed the old notebook and source-code bundled
documentation, moved all docs-related info out of source code and into the
upper-level docs/ directory.
- New documentation pages for each of the double difference misfit functions, and exponentiated phase
- New 'furo' theme for documentation

### Bug fixes
- Plotting: changed `ylim` of figure to max of waveform and not whole plot
because windows were plotted much larger than waveforms

### New features
- Double difference capabilities added.
- These are placed directly into the respective adjoint sources rather than
separately (as in Princenton/Mines version) to cut down on redundant code
- Controlled with string flag ``choice``=='double_difference'. Requires
additional waveforms and windows (``observed_dd``, ``synthetic_dd``,
``windows_dd``)
- Main caculate function will return two adjoint sources if
``double_difference`` is set True
- Waveform misfit has four choices which include: ``waveform``, ``convolution``, ``waveform_dd`` and ``convolution_dd``
- New Misfit Functions:
- Exponentiated phase
- Convolved waveform difference
- Waveform double difference
- Convolved waveform double difference
- Multitaper double difference
- Config class:
- Introduces individual Configs for each misfit function (as in Princeton v)
- New `get_config` function which provides single entry point to grab
Config objects by name

### Code architecture
- New ``main.py`` script which now holds all the main processing scripts for
discovering, calculating and plotting adjoint sources
- Changed `window` -> `windows` for list of tuples carrying window information
- Moved plotting functions out of individual adjoint sources and into the
main call function
- All adjoint sources baselined with test data against Princeton/Mines version
of code
- Removed plot capability for User to provide their own Figure object
- Removed boolean return flag for adjoint source and measurements because these
are calculated regardless so might as well return them. May re-introduce if requested.
- Config now carries information on `adjsrc_type`, removed this from the main
calculate_adjoint_source function, as it was redundant to have it in multiple places.

### Class/Function specific
- AdjointSource class:
- New `window` attribute which holds information about input windows used
to build the adjoint source, and their individual misfit values
- Print statement now deals with `window attribute`
- Write function cleaned up to include both SPECFEM and ASDF write functions
- Waveform Misfit adjoint source:
- Edited calculation of Simpsons rule integration to match Princeton ver.
Now has a factor of 1/2 introduced so misfit is 1/2 original value.
- Baselined with test data against Priceton/Mines version of code
- Cross-correlation Traveltime Misfit:
- Moves bulk of utility/calculation functions to ``pyadjoint.utils.cctm``
so that MTM can use them allowing for less redundant code
- Multitaper Misfit:
- Overhauled function into a class to avoid the excessive parameter passing
between functions, removed unncessary parameter renaming in-function
- Renamed many of the internal variables and functions for clarity
- Removed redundant CCTM misfit definitions, instead switched to import of
functions from CCTM utility
- Moved 'frequency_limit' function into 'mtm' utils and cleaned up. Removed
unncessary functions which were passing too many variables, and included
doc string. Changed some internal parameter names to match the Config
- Bugfix frequency limit search was not returning a `search` parameter flag
which is meant to stop the search (from Princeton version)


2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2015, Lion Krischer
Copyright (c) 2022, adjTomo Dev Team
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
3 changes: 0 additions & 3 deletions MANIFEST.in

This file was deleted.

13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
Pyadjoint
=========
# Pyadjoint

PyAdjoint is a Python tool for calculating a variety of adjoint sources for the full waveform inversion problem.

[Documentation](http://adjtomo.github.io/pyadjoint/) contains details on installation, usage and API.

### Misfit measurement and adjoint source generation

- Pyadjoint is a small misfit measurement package that calculates misfit and adjoint sources on time series
- [Documentation](https://adjtomo.github.io/pyadjoint) for Pyadjoint can be found on GitHub
- Can be used standlone, but is also wrapped in [Pyatoa](https://github.com/adjtomo/pyatoa) (alongside
[Pyflex](https://github.com/adjtomo/pyflex))
- Pyadjoint is part of the [adjTomo ecosystem](https://github.com/adjtomo) of tools for
adjoint tomography and full waveform inversion
37 changes: 0 additions & 37 deletions doc/README.md

This file was deleted.

9 changes: 0 additions & 9 deletions doc/adjoint_source.rst

This file was deleted.

Loading