-
Notifications
You must be signed in to change notification settings - Fork 15
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
Asdf read speed #514
Open
SolarDrew
wants to merge
13
commits into
DKISTDC:main
Choose a base branch
from
SolarDrew:asdf-read-speed
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Asdf read speed #514
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
40af8bf
Add mechanism for datasets to know if they're a tile
SolarDrew 2d35c18
Stack headers and store canonically on TiledDataset
SolarDrew ec5aaef
Don't save out headers on mosaic tile Datasets
SolarDrew afd6f70
Minor test upgrade
SolarDrew d2d29c0
Pass headers to TiledDataset in simple_tiled_dataset fixture
SolarDrew a4d1efe
Need to stack the headers
SolarDrew 28f19ab
Make TiledDataset converter read and write headers
SolarDrew 3601236
Schema nonsense
SolarDrew 8bb16cc
Merge branch 'main' of github.com:DKISTDC/dkist into asdf-read-speed
SolarDrew 6343fa8
Needed to point the manifest at the right schema
SolarDrew 2b2b125
Replace changes to manifest with new file
SolarDrew 4e42f22
More schema schenanigans
SolarDrew 374526d
Save header table as rec array
SolarDrew 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
This file contains 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 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 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 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 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 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 |
---|---|---|
@@ -1,20 +1,33 @@ | ||
from asdf.extension import Converter | ||
from astropy.table import Table, vstack | ||
|
||
|
||
class TiledDatasetConverter(Converter): | ||
tags = [ | ||
"tag:dkist.nso.edu:dkist/tiled_dataset-0.1.0", | ||
"asdf://dkist.nso.edu/tags/tiled_dataset-1.0.0", | ||
"asdf://dkist.nso.edu/tags/tiled_dataset-1.1.0", | ||
] | ||
types = ["dkist.dataset.tiled_dataset.TiledDataset"] | ||
|
||
def from_yaml_tree(cls, node, tag, ctx): | ||
from dkist.dataset.tiled_dataset import TiledDataset | ||
|
||
return TiledDataset(node["datasets"], node["inventory"]) | ||
for row in node["datasets"]: | ||
for ds in row: | ||
if ds: | ||
ds._is_mosaic_tile = True | ||
|
||
if node.get("headers"): | ||
headers = node["headers"] | ||
else: | ||
headers = vstack([Table(ds.headers) for ds in row for row in node["datasets"]]) | ||
|
||
return TiledDataset(node["datasets"], node["inventory"], headers) | ||
|
||
def to_yaml_tree(cls, tiled_dataset, tag, ctx): | ||
tree = {} | ||
tree["inventory"] = tiled_dataset._inventory | ||
tree["datasets"] = tiled_dataset._data.tolist() | ||
tree["headers"] = tiled_dataset.combined_headers.as_array() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should do this for dataset too. |
||
return tree |
This file contains 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 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,14 @@ | ||
%YAML 1.1 | ||
--- | ||
id: asdf://dkist.nso.edu/manifests/dkist-1.2.0 | ||
extension_uri: asdf://dkist.nso.edu/dkist/extensions/dkist-1.3.0 | ||
title: DKIST extension | ||
description: ASDF schemas and tags for DKIST classes. | ||
|
||
tags: | ||
- schema_uri: "asdf://dkist.nso.edu/schemas/file_manager-1.0.0" | ||
tag_uri: "asdf://dkist.nso.edu/tags/file_manager-1.0.0" | ||
- schema_uri: "asdf://dkist.nso.edu/schemas/dataset-1.2.0" | ||
tag_uri: "asdf://dkist.nso.edu/tags/dataset-1.2.0" | ||
- schema_uri: "asdf://dkist.nso.edu/schemas/tiled_dataset-1.1.0" | ||
tag_uri: "asdf://dkist.nso.edu/tags/tiled_dataset-1.1.0" |
This file contains 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,50 @@ | ||
%YAML 1.1 | ||
--- | ||
$schema: "http://stsci.edu/schemas/yaml-schema/draft-01" | ||
id: "asdf://dkist.nso.edu/schemas/dataset-1.2.0" | ||
|
||
title: | | ||
A DKIST Level 1 Dataset object. | ||
description: | ||
The container for a distributed dataset object. | ||
|
||
type: object | ||
properties: | ||
data: | ||
tag: "asdf://dkist.nso.edu/tags/file_manager-1.0.0" | ||
|
||
wcs: | ||
description: The coordinate system for the complete dataset. | ||
tag: "tag:stsci.edu:gwcs/wcs-1.*" | ||
|
||
mask: | ||
tag: "tag:stsci.edu:asdf/core/ndarray-1.*" | ||
|
||
unit: | ||
tag: "tag:stsci.edu:asdf/unit/unit-1.*" | ||
|
||
meta: | ||
description: Dataset metadata, describing the whole dataset. | ||
type: object | ||
properties: | ||
headers: | ||
description: A table of all the headers for the constituent files. | ||
anyOf: | ||
- tag: "tag:astropy.org:astropy/table/table-1.*" | ||
- tag: 'tag:stsci.edu:asdf/core/ndarray-1.*' | ||
- null: true | ||
|
||
quality: | ||
description: A copy of the quality report of these observations. | ||
type: object | ||
|
||
inventory: | ||
description: A copy of the inventory record for this dataset. | ||
type: object | ||
|
||
required: [headers, inventory] | ||
additionalProperties: true | ||
|
||
required: [data, wcs, unit] | ||
additionalProperties: true | ||
... |
This file contains 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,31 @@ | ||
%YAML 1.1 | ||
--- | ||
$schema: "http://stsci.edu/schemas/yaml-schema/draft-01" | ||
id: "asdf://dkist.nso.edu/schemas/tiled_dataset-1.1.0" | ||
|
||
title: | | ||
A DKIST Tiled Dataset object. | ||
description: | ||
The container for a set of Dataset objects. | ||
|
||
type: object | ||
properties: | ||
datasets: | ||
description: A nested structure of Dataset objects | ||
type: array | ||
items: | ||
type: array | ||
items: | ||
- tag: "asdf://dkist.nso.edu/tags/dataset-1.*" | ||
inventory: | ||
description: A copy of the inventory record for this dataset. | ||
type: object | ||
headers: | ||
description: A table of all the headers for the constituent files. | ||
anyOf: | ||
- tag: "tag:astropy.org:astropy/table/table-1.*" | ||
- tag: 'tag:stsci.edu:asdf/core/ndarray-1.*' | ||
|
||
required: [datasets, inventory, headers] | ||
additionalProperties: false | ||
... |
This file contains 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
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.
That's some promises about ordering I was not intending to make.