Skip to content

Commit

Permalink
Merge pull request #72 from chrishavlin/time_slicing
Browse files Browse the repository at this point in the history
add timeseries processing
  • Loading branch information
chrishavlin committed Aug 18, 2023
2 parents 459ef84 + cfc5818 commit f16d16e
Show file tree
Hide file tree
Showing 45 changed files with 4,532 additions and 122 deletions.
2 changes: 1 addition & 1 deletion .napari/DESCRIPTION.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@ yt-napari provides plugins to help load data from [yt](https://yt-project.org/)

![](https://raw.githubusercontent.com/data-exp-lab/yt-napari/main/docs/_static/nb_iso_galaxy_T_rho.png)

See the [full documentation](https://yt-napari.readthedocs.io) for more details.
See the [full documentation](https://yt-napari.readthedocs.io/en/stable/) for more details.
13 changes: 13 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
## v0.2.0

This release includes some non-backwards compatible changes to the schema. Old
json files will need to be updated to use with yt-napari >= v0.2.0

### New Features
* timeseries loading: a new widget, yt-napari timeseries slicer, is available from the napari gui and json files can also specify timeseries selections. Additionally, there is a new `yt_napari.timeseries` module for jupyter notebook interaction.

### Breaking changes

Breaking schema updates:
* the top level `data` attribute has been renamed `datasets` to distinguish between loading selections from a single timestep and the new `timeseries` selection

## v0.1.0

This release includes some non-backwards compatible changes to the schema. Old
Expand Down
36 changes: 24 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ To install the latest development version of the plugin instead, use:

pip install git+https://github.com/data-exp-lab/yt-napari.git

Note that if you are working off the development version, be sure to use the latest documentation
for reference: https://yt-napari.readthedocs.io/en/latest/

## Quick Start

After [installation](#Installation), there are three modes of using `yt-napari`:
Expand Down Expand Up @@ -93,7 +96,9 @@ nbscreenshot(viewer)

![Loading a subset of a yt dataset in napari from a Jupyter notebook](./assets/images/readme_ex_001.png)

`yt_scene.add_to_viewer` accepts any of the keyword arguments allowed by `viewer.add_image`. See the full documentation (https://yt-napari.readthedocs.io/en/stable/) for more examples, including additional helper methods for linking layer appearance.
`yt_scene.add_to_viewer` accepts any of the keyword arguments allowed by `viewer.add_image`. See the full documentation ([yt-napari.readthedocs.io]) for more examples, including additional helper methods for linking layer appearance.

Additionally, with `yt_napari`>= v0.2.0, you can use the `yt_napari.timeseries` module to help sample and load in selections from across datasets.

### loading a selection from a yt dataset interactively

Expand All @@ -107,23 +112,30 @@ To use the yt Reader plugin, click on `Plugins -> yt-napari: yt Reader`. From th

You can add multiple selections and load them all at once or adjust values and click "Load" again.

#### using the yt Time Series Reader plugin

To use the yt Time Series Reader plugin, click on `Plugins -> yt-napari: yt Time Series Reader`. Specify your file matching: use `file_pattern` to enter glob expressions or use `file_list` to enter a list of specific files.
Then add a slice or region to sample for each matched dataset file (note: be careful of memory here!):

![Loading timeseries selections from the napari viewer](./assets/images/readme_ex_004_gui_timeseries.gif)

#### using a json file and schema

`yt-napari` also provides the ability to load json that contain specifications for loading a file. Properly formatted files can be loaded from the napari GUI as you would load any image file (`File->Open`). The json file describes the selection process for a dataset as described by a json-schema. The following json file results in similar layers as the above examples:


```json
{"$schema": "https://raw.githubusercontent.com/data-exp-lab/yt-napari/main/src/yt_napari/schemas/yt-napari_0.0.1.json",
"data": [{"filename": "IsolatedGalaxy/galaxy0030/galaxy0030",
"selections": {"regions": [{
"fields": [{"field_name": "Temperature", "field_type": "enzo", "take_log": true},
{"field_name": "Density", "field_type": "enzo", "take_log": true}],
"left_edge": [460.0, 460.0, 460.0],
"right_edge": [560.0, 560.0, 560.0],
"resolution": [600, 600, 600]
}]},
"edge_units": "kpc"
}]
"datasets": [{"filename": "IsolatedGalaxy/galaxy0030/galaxy0030",
"selections": {"regions": [{
"fields": [{"field_name": "Temperature", "field_type": "enzo", "take_log": true},
{"field_name": "Density", "field_type": "enzo", "take_log": true}],
"left_edge": [460.0, 460.0, 460.0],
"right_edge": [560.0, 560.0, 560.0],
"resolution": [600, 600, 600]
}]},
"edge_units": "kpc"
}]
}
```

Expand Down Expand Up @@ -244,7 +256,7 @@ https://napari.org/plugins/stable/index.html
[Apache Software License 2.0]: http://www.apache.org/licenses/LICENSE-2.0
[Mozilla Public License 2.0]: https://www.mozilla.org/media/MPL/2.0/index.txt
[cookiecutter-napari-plugin]: https://github.com/napari/cookiecutter-napari-plugin
[yt-napari.readthedocs.io]: https://yt-napari.readthedocs.io/
[yt-napari.readthedocs.io]: https://yt-napari.readthedocs.io/en/stable/

[file an issue]: https://github.com/data-exp-lab/yt-napari/issues

Expand Down
Binary file added assets/images/readme_ex_004_gui_timeseries.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ coverage:
default:
target: 98% # the required coverage value
threshold: 0.1% # the leniency in hitting the target
patch:
default:
target: 98%
threshold: 0.1%
Loading

0 comments on commit f16d16e

Please sign in to comment.