diff --git a/.napari/DESCRIPTION.md b/.napari/DESCRIPTION.md index 9e9c586..afe94e9 100644 --- a/.napari/DESCRIPTION.md +++ b/.napari/DESCRIPTION.md @@ -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. diff --git a/HISTORY.md b/HISTORY.md index 9a45a4b..97ece4c 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,7 +1,10 @@ ## 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 -* new widget: yt-napari timeseries slicer +* 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 diff --git a/README.md b/README.md index 761e2aa..fc6e347 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,8 @@ nbscreenshot(viewer) `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 `yt-napari` provides two ways to sample a yt dataset and load in an image layer into a Napari viewer: the yt Reader plugin and json file specification. @@ -110,6 +112,13 @@ 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: @@ -117,16 +126,16 @@ You can add multiple selections and load them all at once or adjust values and c ```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" + }] } ``` diff --git a/assets/images/readme_ex_004_gui_timeseries.gif b/assets/images/readme_ex_004_gui_timeseries.gif new file mode 100644 index 0000000..100bc70 Binary files /dev/null and b/assets/images/readme_ex_004_gui_timeseries.gif differ diff --git a/docs/quickstart.rst b/docs/quickstart.rst index 566de28..ed74c9d 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -61,13 +61,13 @@ loading a json file from the napari gui .. code-block:: json {"$schema": "https://yt-napari.readthedocs.io/en/latest/_static/yt-napari_latest.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": {"value": [460.0, 460.0, 460.0], "unit": "kpc"}, - "right_edge": {"value": [560.0, 560.0, 560.0], "unit": "kpc"}, - "resolution": [600, 600, 600] + "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": {"value": [460.0, 460.0, 460.0], "unit": "kpc"}, + "right_edge": {"value": [560.0, 560.0, 560.0], "unit": "kpc"}, + "resolution": [600, 600, 600] }]} }] } @@ -95,6 +95,16 @@ The use the yt Reader plugin, from a Napari viewer, select "Plugins -> yt-napari The reader plugin does its best to align new selections of data with existing yt-napari image layers and should be able to properly align selections from different yt datasets (please submit a bug report if it fails!). +The yt-napari yt Time Series Reader: +#################################### + +This reader will apply a spatial selection to a set of files, similar to working with a yt `DataSeries` object. You specify +the spatial selections and a list of files or file pattern to match. Note that while the operation is in a non-blocking +thread, if your simulation data is large it may take a few minutes to load in your selections. Also note that 3D region +selections can easily exceed available memory if you're not careful... for improving load times and working with +bigger-than-memory arrays, you can instead use the jupyter notebook interface for napari with the `yt_napari.timeseries` +module of helper functions to distribute the timestep selections using dask. See the example notebooks for usage. + .. _configfile: Configuring yt-napari diff --git a/src/yt_napari/_widget_reader.py b/src/yt_napari/_widget_reader.py index c06bfb2..b0a8850 100644 --- a/src/yt_napari/_widget_reader.py +++ b/src/yt_napari/_widget_reader.py @@ -284,6 +284,6 @@ def process_timeseries_layers(self, layer_list): @thread_worker(progress=True) -def time_series_load(model, worker_id): +def time_series_load(model): _, layer_list = _model_ingestor._process_validated_model(model) - return layer_list, worker_id + return layer_list