Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions .schemalintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module.exports = {
{ name: "private" },
{ name: "public" },
{ name: "rawdata" },
{ name: "spectroscopy" },
],
rules: {
"name-casing": ["error", "snake"],
Expand Down
8 changes: 8 additions & 0 deletions app/adminapi/domain/catalogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@
model.RawCatalog.PHOTOMETRY__TOTAL: ("Photometry (total)", "Total magnitudes per band and method."),
model.RawCatalog.PHOTOMETRY__ISOPHOTAL: ("Photometry (isophotal)", "Isophotal magnitudes per band and level."),
model.RawCatalog.GEOMETRY: ("Geometry", "Isophotal ellipse geometry."),
model.RawCatalog.SPECTROSCOPY__INTEGRATED_FLUX_DENSITY: (
"Spectroscopy (integrated flux density)",
"Integrated spectral line flux densities.",
),
model.RawCatalog.SPECTROSCOPY__ENERGY_FLUX: (
"Spectroscopy (energy flux)",
"Spectral line energy fluxes.",
),
model.RawCatalog.NOTE: ("Note", "Free-text notes attached to records."),
}

Expand Down
6 changes: 6 additions & 0 deletions app/data/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
RedshiftRecord,
)
from app.data.model.redshift import RedshiftCatalogObject
from app.data.model.spectroscopy import (
SpectroscopyEnergyFluxCatalogObject,
SpectroscopyIntegratedFluxDensityCatalogObject,
)
from app.data.model.table import (
CatalogProgress,
ColumnDescription,
Expand Down Expand Up @@ -61,6 +65,8 @@
"PhotometryTotalCatalogObject",
"PhotometryIsophotalCatalogObject",
"GeometryCatalogObject",
"SpectroscopyIntegratedFluxDensityCatalogObject",
"SpectroscopyEnergyFluxCatalogObject",
"NoteCatalogObject",
"get_catalog_object_type",
"Bibliography",
Expand Down
6 changes: 5 additions & 1 deletion app/data/model/helpers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from app.data.model import designation, geometry, icrs, interface, nature, note, photometry, redshift
from app.data.model import designation, geometry, icrs, interface, nature, note, photometry, redshift, spectroscopy

_CATALOG_OBJECT_TYPES: dict[interface.RawCatalog, type[interface.CatalogObject]] = {
interface.RawCatalog.DESIGNATION: designation.DesignationCatalogObject,
Expand All @@ -8,6 +8,10 @@
interface.RawCatalog.PHOTOMETRY__TOTAL: photometry.PhotometryTotalCatalogObject,
interface.RawCatalog.PHOTOMETRY__ISOPHOTAL: photometry.PhotometryIsophotalCatalogObject,
interface.RawCatalog.GEOMETRY: geometry.GeometryCatalogObject,
interface.RawCatalog.SPECTROSCOPY__INTEGRATED_FLUX_DENSITY: (
spectroscopy.SpectroscopyIntegratedFluxDensityCatalogObject
),
interface.RawCatalog.SPECTROSCOPY__ENERGY_FLUX: spectroscopy.SpectroscopyEnergyFluxCatalogObject,
interface.RawCatalog.NOTE: note.NoteCatalogObject,
}

Expand Down
2 changes: 2 additions & 0 deletions app/data/model/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class RawCatalog(enum.Enum):
PHOTOMETRY__TOTAL = "photometry_total"
PHOTOMETRY__ISOPHOTAL = "photometry_isophotal"
GEOMETRY = "geometry"
SPECTROSCOPY__INTEGRATED_FLUX_DENSITY = "spectroscopy_integrated_flux_density"
SPECTROSCOPY__ENERGY_FLUX = "spectroscopy_energy_flux"
NOTE = "note"


Expand Down
59 changes: 59 additions & 0 deletions app/data/model/spectroscopy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
from typing import Any, final

from app.data.model import interface


@final
class SpectroscopyIntegratedFluxDensityCatalogObject(interface.CatalogObject):
def __init__(
self,
line_id: str,
flux: float,
e_flux: float | None = None,
method: str = "sum",
quality: str = "regular",
**kwargs: Any,
) -> None:
self.line_id = line_id
self.flux = flux
self.e_flux = e_flux
self.method = method
self.quality = quality

def catalog(self) -> interface.RawCatalog:
return interface.RawCatalog.SPECTROSCOPY__INTEGRATED_FLUX_DENSITY

@classmethod
def layer1_table(cls) -> str:
return "spectroscopy.integrated_flux_density"

@classmethod
def layer1_primary_keys(cls) -> list[str]:
return ["record_id", "line_id", "method"]


@final
class SpectroscopyEnergyFluxCatalogObject(interface.CatalogObject):
def __init__(
self,
line_id: str,
flux: float,
e_flux: float | None = None,
quality: str = "regular",
**kwargs: Any,
) -> None:
self.line_id = line_id
self.flux = flux
self.e_flux = e_flux
self.quality = quality

def catalog(self) -> interface.RawCatalog:
return interface.RawCatalog.SPECTROSCOPY__ENERGY_FLUX

@classmethod
def layer1_table(cls) -> str:
return "spectroscopy.energy_flux"

@classmethod
def layer1_primary_keys(cls) -> list[str]:
return ["record_id", "line_id"]
21 changes: 0 additions & 21 deletions postgres/drafts/17_modify_common_types.sql
Original file line number Diff line number Diff line change
@@ -1,26 +1,5 @@
BEGIN;

ALTER TYPE common.quality RENAME VALUE 'ok' TO 'regular' ;
ALTER TYPE common.quality RENAME VALUE 'lowsnr' TO 'low_snr' ;
ALTER TYPE common.quality RENAME VALUE 'sus' TO 'suspected' ;
ALTER TYPE common.quality RENAME VALUE '>' TO 'lower_limit' ;
ALTER TYPE common.quality RENAME VALUE '<' TO 'upper_limit' ;

ALTER TYPE common.quality RENAME TO qualityType ;

COMMENT ON TYPE common.QualityType IS '{
"description": "Quality flag of the measurement",
"values": {
"regular": "regular measurement",
"low_snr": "low signal-to-noise",
"suspected": "suspected measurement",
"lower_limit": "lower limit",
"upper_limit": "upper limit",
"wrong": "wrong measurement"
}
}' ;


CREATE TYPE common.VelocityConventionType AS ENUM ( 'optical', 'radio', 'relativistic' ) ;

COMMENT ON TYPE common.VelocityConventionType IS '{
Expand Down
123 changes: 0 additions & 123 deletions postgres/drafts/18_add_spectroscopy.sql

This file was deleted.

Loading
Loading