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

U/jrbogart/remove sncosmo #105

Merged
merged 5 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions cfg/object_types.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ object_types :
internal_extinction: CCM
MW_extinction: F19
spatial_model: knots

star:
file_template: 'pointsource_(?P<healpix>\d+).parquet'
flux_file_template: 'pointsource_flux_(?P<healpix>\d+).parquet'
Expand All @@ -77,15 +77,6 @@ object_types :
sed_file_root_env_var: SIMS_SED_LIBRARY_DIR
MW_extinction: F19
internal_extinction: None
sncosmo:
file_template: 'pointsource_(?P<healpix>\d+).parquet'
data_file_type: parquet
area_partition:
{ type: healpix, ordering: ring, nside: 32}

sed_model: sncosmo
MW_extinction: F19
internal_extinction: None
gaia_star:
data_file_type: butler_refcat
butler_parameters:
Expand Down
2 changes: 1 addition & 1 deletion etc/conda_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

stackvana>=0.2023.32
gitpython
sncosmo
# sncosmo
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ dependencies = [
'astropy',
'pyarrow',
'pandas',
'sncosmo',
]
requires-python = ">=3.7" # For setuptools >= 61.0 support

Expand Down
269 changes: 123 additions & 146 deletions skycatalogs/catalog_creator.py

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion skycatalogs/data/ci_sample/skyCatalog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ object_types:
provenance:
inputs:
galaxy_truth: cosmodc2_v1.1.4_image_addon_knots
sn_truth: /global/cfs/cdirs/lsst/groups/SSim/DC2/cosmoDC2_v1.1.4/sne_cosmoDC2_v1.1.4_MS_DDF_healpix.db
star_truth: /global/cfs/cdirs/lsst/groups/SSim/DC2/dc2_stellar_healpixel.db
skyCatalogs_repo:
git_branch: master
Expand Down
1 change: 0 additions & 1 deletion skycatalogs/data/ci_sample/skyCatalog_top.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ object_types:
provenance:
inputs:
galaxy_truth: cosmodc2_v1.1.4_image_addon_knots
sn_truth: /global/cfs/cdirs/lsst/groups/SSim/DC2/cosmoDC2_v1.1.4/sne_cosmoDC2_v1.1.4_MS_DDF_healpix.db
star_truth: /global/cfs/cdirs/lsst/groups/SSim/DC2/dc2_stellar_healpixel.db
skyCatalogs_repo:
git_branch: master
Expand Down
57 changes: 0 additions & 57 deletions skycatalogs/objects/sncosmo_object.py

This file was deleted.

11 changes: 2 additions & 9 deletions skycatalogs/skyCatalogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@
from skycatalogs.objects.gaia_object import GaiaObject, GaiaCollection
from skycatalogs.objects.sso_object import SsoObject, SsoCollection
from skycatalogs.objects.sso_object import EXPOSURE_DEFAULT
# from skycatalogs.objects.sso_object import find_sso_files
from skycatalogs.readers import ParquetReader
from skycatalogs.utils.sed_tools import TophatSedFactory, DiffskySedFactory
from skycatalogs.utils.sed_tools import SsoSedFactory
from skycatalogs.utils.sed_tools import MilkyWayExtinction
from skycatalogs.utils.config_utils import Config
from skycatalogs.utils.shapes import Box, Disk, PolygonalRegion
from skycatalogs.utils.shapes import compute_region_mask
from skycatalogs.objects.sncosmo_object import SncosmoObject, SncosmoCollection
from skycatalogs.objects.star_object import StarObject
from skycatalogs.objects.galaxy_object import GalaxyObject
from skycatalogs.objects.diffsky_object import DiffskyObject
Expand Down Expand Up @@ -347,11 +345,6 @@ def __init__(self, config, mp=False, skycatalog_root=None, verbose=False,
object_class=GaiaObject,
collection_class=GaiaCollection,
custom_load=True)
if 'sncosmo' in config['object_types']:
self.cat_cxt.register_source_type(
'sncosmo',
object_class=SncosmoObject,
collection_class=SncosmoCollection)
if 'star' in config['object_types']:
self.cat_cxt.register_source_type('star',
object_class=StarObject)
Expand Down Expand Up @@ -660,7 +653,7 @@ def get_object_type_by_hp(self, hp, object_type, region=None, mjd=None,
elif object_type in ['snana']:
columns = ['id', 'ra', 'dec', 'start_mjd', 'end_mjd']
id_name = 'id'
elif object_type in ['star', 'sncosmo']:
elif object_type in ['star']:
columns = ['object_type', 'id', 'ra', 'dec']
id_name = 'id'
elif object_type in ['sso']:
Expand Down Expand Up @@ -810,4 +803,4 @@ def open_catalog(config_file, mp=False, skycatalog_root=None, verbose=False):

config_dict = open_config_file(config_file)
return SkyCatalog(config_dict, skycatalog_root=skycatalog_root, mp=mp,
verbose=verbose)
verbose=verbose)
1 change: 0 additions & 1 deletion skycatalogs/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@
from .exceptions import *
from .parquet_schema_utils import *
from .sed_tools import *
from .sn_tools import *
from .shapes import *
from .creator_utils import *
38 changes: 3 additions & 35 deletions skycatalogs/utils/parquet_schema_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import logging

__all__ = ['make_galaxy_schema', 'make_galaxy_flux_schema',
'make_pointsource_schema', 'make_star_flux_schema']
'make_star_schema', 'make_star_flux_schema']


def _add_roman_fluxes(fields):
Expand Down Expand Up @@ -140,19 +140,10 @@ def make_star_flux_schema(logname, include_roman_flux=False):
return pa.schema(fields)


def make_pointsource_schema():
def make_star_schema():
'''
Ultimately should handle stars both static and variable, SN, and AGN
For now add everything needed for SN and put in some additional
star fields, but not structs for star variability models
Just for "regular" stars.
'''

salt2_fields = [
pa.field('z', pa.float64(), True),
pa.field('t0', pa.float64(), True),
pa.field('x0', pa.float64(), True),
pa.field('x1', pa.float64(), True),
pa.field('c', pa.float64(), True)]
fields = [pa.field('object_type', pa.string(), False),
pa.field('id', pa.string(), False),
pa.field('ra', pa.float64(), False),
Expand All @@ -167,28 +158,5 @@ def make_pointsource_schema():
pa.field('radial_velocity', pa.float64(), True),
pa.field('parallax', pa.float64(), True),
pa.field('variability_model', pa.string(), True),
pa.field('salt2_params', pa.struct(salt2_fields), True)
]
return pa.schema(fields)


def make_pointsource_flux_schema(logname, include_roman_flux=False):
'''
Will make a separate parquet file with lsst flux for each band
and id for joining with the main star file.
For static sources mjd field could be -1. Or the field could be
made nullable.
'''
logger = logging.getLogger(logname)
logger.debug('Creating pointsource flux schema')
fields = [pa.field('id', pa.string()),
pa.field('lsst_flux_u', pa.float32(), True),
pa.field('lsst_flux_g', pa.float32(), True),
pa.field('lsst_flux_r', pa.float32(), True),
pa.field('lsst_flux_i', pa.float32(), True),
pa.field('lsst_flux_z', pa.float32(), True),
pa.field('lsst_flux_y', pa.float32(), True),
pa.field('mjd', pa.float64(), True)]
if include_roman_flux:
fields = _add_roman_fluxes(fields)
return pa.schema(fields)
43 changes: 0 additions & 43 deletions skycatalogs/utils/sn_tools.py

This file was deleted.

Loading