-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #89 from LSSTDESC/u/jrbogart/yaml-include-class
Eliminate dependence on pyyaml-include by adapting Butler loader
- Loading branch information
Showing
12 changed files
with
182 additions
and
18 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,4 @@ | |
|
||
stackvana>=0.2023.32 | ||
gitpython | ||
dust_extinction | ||
sncosmo |
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 +1 @@ | ||
__version__ = "1.7.0-rc2" | ||
__version__ = "1.7.0-rc3" |
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,7 @@ | ||
# butler refcat available only at SLAC sdf | ||
area_partition: None | ||
butler_parameters: | ||
collections: HSC/defaults | ||
dstype: gaia_dr2_20200414 | ||
data_file_type: butler_refcat | ||
sed_method: use_lut |
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,13 @@ | ||
MW_extinction: F19 | ||
area_partition: | ||
nside: 32 | ||
ordering: ring | ||
type: healpix | ||
data_file_type: parquet | ||
file_template: pointsource_(?P<healpix>\d+).parquet | ||
flux_file_template: pointsource_flux_(?P<healpix>\d+).parquet | ||
internal_extinction: None | ||
sed_file_root_env_var: SIMS_SED_LIBRARY_DIR | ||
sed_model: file_nm | ||
inputs: | ||
star_truth: /global/cfs/cdirs/lsst/groups/SSim/DC2/dc2_stellar_healpixel.db |
11 changes: 11 additions & 0 deletions
11
skycatalogs/data/ci_yamlinclude/subdir/galaxy_include.yaml
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,11 @@ | ||
area_partition: !include subsub/area_partition.yaml | ||
attribute_aliases: | ||
size_knots_true: size_disk_true | ||
size_minor_knots_true: size_minor_disk_true | ||
composite: | ||
bulge: required | ||
disk: required | ||
knots: optional | ||
data_file_type: parquet | ||
file_template: galaxy_(?P<healpix>\d+).parquet | ||
flux_file_template: galaxy_flux_(?P<healpix>\d+).parquet |
3 changes: 3 additions & 0 deletions
3
skycatalogs/data/ci_yamlinclude/subdir/subsub/area_partition.yaml
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,3 @@ | ||
nside: 32 | ||
ordering: ring | ||
type: healpix |
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,18 @@ | ||
catalog_dir: for_imsim_subpixel | ||
catalog_name: skyCatalog | ||
galaxy_magnitude_cut: 29.0 | ||
knots_magnitude_cut: 27.0 | ||
object_types: | ||
gaia_star: !include gaia_sdf.yaml | ||
galaxy: !include subdir/galaxy_include.yaml | ||
star: !include star.yaml | ||
provenance: | ||
skyCatalogs_repo: | ||
git_branch: u/jrbogart/nsides | ||
git_hash: f0539b4397159f87010bc47785d03434b541232d | ||
git_status: | ||
- UNTRACKED_FILES | ||
versioning: | ||
code_version: 1.7.0-rc3 | ||
schema_version: 1.2.0 | ||
skycatalog_root: /pscratch/sd/j/jrbogart/desc/skycatalogs |
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
""" | ||
Test yaml loader which handles !include tag | ||
""" | ||
import unittest | ||
import yaml | ||
import os | ||
from pathlib import Path | ||
|
||
from skycatalogs.utils.config_utils import YamlIncludeLoader | ||
|
||
class skyCatalogsTestCase(unittest.TestCase): | ||
def setUp(self): | ||
# Get directory containing top-level file | ||
self._yaml_dir = os.path.join(Path(__file__).resolve().parents[1], | ||
'skycatalogs', 'data', 'ci_yamlinclude') | ||
def tearDown(self): | ||
pass | ||
|
||
def test_include(self): | ||
# Top level file references to | ||
# file in the same directory | ||
# file in subdirectory | ||
# file which itself has an !include directive | ||
top_path = os.path.join(self._yaml_dir, 'top.yaml') | ||
|
||
# If the load succeeds, all required files have been found | ||
with open(top_path) as f: | ||
data = yaml.load(f, Loader=YamlIncludeLoader) | ||
|
||
# Verify that expected keys exist | ||
assert('object_types' in data.keys()) | ||
objs = data['object_types'] | ||
assert('gaia_star' in objs) | ||
assert('galaxy' in objs) | ||
assert('area_partition' in objs['galaxy']) | ||
assert('nside' in objs['galaxy']['area_partition']) | ||
|
||
print(data) | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |