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

Attrs refactor #219

Merged
merged 36 commits into from
Aug 18, 2023
Merged

Attrs refactor #219

merged 36 commits into from
Aug 18, 2023

Conversation

d-chambers
Copy link
Contributor

@d-chambers d-chambers commented Aug 12, 2023

Description

This PR refactors how attributes work in DASCore and fixes a few other small issues.

Admittedly, this PR got a bit too large as I was working without internet on a roadtrip which made it harder to do a series of smaller PRs.

Here are the highlights:

  1. Rather than containing {dim}_min, {dim}max, d{dim} there is now a coordinate dictionary attached to the attributes. This allows for arbitrarily named dimensions to be tracked rather than just time and distance.

  2. In light of 1, attrs.{dim}min, attrs.{dim}max, attrs.d{dim} are still accessible, but they are just properties which fetch the correct attributes from the coordinates dictionary. attrs.d{dim} is deprecated in favor of attrs.{dim}_step which is more clear and fits better when attribute names are sorted.

  3. PatchSummary is no longer a public facing class, but PatchAttrs can just be to summarize a patch.

  4. Now only time is used to index a patch by DirectorySpool and other dimensional queries are fully supported.

  5. DASCore's DirectorySpool now keeps track of where index files for each directory, so if a non-default index is specified it will be used with each new DirectroySpool without having to specify it. Also, if the user can't write to the data directory, a new, suitable location is chosen automatically.

  6. Patch.__init__ and Patch.new now behave in a more structured way.

  7. Fixes Time axis label in waterfall plots #213

  8. Fixes Better unit display #209

  9. Fixes support for datetime and timedelta #207

  10. Fixes Can't get gauge length from attributes - PRODML v. 2.0 format #194

  11. Fixes DASCore index to support missing time or distance values #163

  12. Fixes Could not index PRODML v. 2.0 format #221

Checklist

I have (if applicable):

  • referenced the GitHub issue this PR closes.
  • documented the new feature with docstrings or appropriate doc page.
  • included a test. See testing guidelines.
  • your name has been added to the contributors page (docs/contributors.md).
  • added the "ready_for_review" tag once the PR is ready to be reviewed.

@codecov
Copy link

codecov bot commented Aug 12, 2023

Codecov Report

Merging #219 (36b9bea) into master (1bee2e4) will increase coverage by 0.07%.
The diff coverage is 99.48%.

@@            Coverage Diff             @@
##           master     #219      +/-   ##
==========================================
+ Coverage   98.80%   98.88%   +0.07%     
==========================================
  Files          77       75       -2     
  Lines        5778     5997     +219     
==========================================
+ Hits         5709     5930     +221     
+ Misses         69       67       -2     
Flag Coverage Δ
unittests 98.88% <99.48%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
dascore/io/pickle/core.py 100.00% <ø> (ø)
dascore/io/plugin.py 0.00% <ø> (ø)
dascore/proc/detrend.py 100.00% <ø> (ø)
dascore/transform/differentiate.py 100.00% <ø> (ø)
dascore/transform/strain.py 100.00% <ø> (ø)
dascore/utils/docs.py 100.00% <ø> (ø)
dascore/utils/downloader.py 94.73% <ø> (ø)
dascore/utils/mapping.py 92.59% <ø> (ø)
dascore/utils/transformatter.py 100.00% <ø> (ø)
dascore/viz/core.py 0.00% <ø> (ø)
... and 53 more

@d-chambers d-chambers marked this pull request as draft August 16, 2023 00:21
@d-chambers d-chambers added the no_ci disables CI label Aug 16, 2023
@d-chambers d-chambers removed the no_ci disables CI label Aug 18, 2023
@d-chambers d-chambers marked this pull request as ready for review August 18, 2023 21:03
@d-chambers
Copy link
Contributor Author

Merging for now, I am feeling much better about DASCore's internals. Hopefully no more huge PRs like this one.

@d-chambers d-chambers merged commit b0d7ac2 into master Aug 18, 2023
12 checks passed
@d-chambers d-chambers deleted the attrs_refactor branch August 23, 2023 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant