Skip to content

Commit

Permalink
Add quicklook schema update.
Browse files Browse the repository at this point in the history
  • Loading branch information
ktlim committed Jun 24, 2024
1 parent 149f0ce commit 46127ba
Showing 1 changed file with 360 additions and 0 deletions.
360 changes: 360 additions & 0 deletions alembic/lsstcomcamsim/versions/6d5561651761_update_quicklook.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,360 @@
"""update quicklook
Revision ID: 6d5561651761
Revises: da2d84e3d50f
Create Date: 2024-06-13 18:02:52.416218+00:00
"""

from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
from sqlalchemy.dialects import oracle

# revision identifiers, used by Alembic.
revision: str = "6d5561651761"
down_revision: Union[str, None] = "da2d84e3d50f"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.add_column(
"ccdvisit1_quicklook",
sa.Column(
"zero_point",
sa.FLOAT()
.with_variant(mysql.FLOAT(), "mysql")
.with_variant(oracle.BINARY_FLOAT(), "oracle")
.with_variant(sa.FLOAT(), "postgresql"),
nullable=True,
comment="Photometric zero point.",
),
schema="cdb_lsstcomcamsim",
)
op.add_column(
"ccdvisit1_quicklook",
sa.Column(
"seeing_zenith_500nm",
sa.DOUBLE()
.with_variant(mysql.DOUBLE(asdecimal=True), "mysql")
.with_variant(oracle.BINARY_DOUBLE(), "oracle")
.with_variant(sa.DOUBLE_PRECISION(), "postgresql"),
nullable=True,
comment="Measured PSF sigma, corrected to 500nm and an airmass of 1.",
),
schema="cdb_lsstcomcamsim",
)
op.add_column(
"ccdvisit1_quicklook",
sa.Column(
"mean_var",
sa.FLOAT()
.with_variant(mysql.FLOAT(), "mysql")
.with_variant(oracle.BINARY_FLOAT(), "oracle")
.with_variant(sa.FLOAT(), "postgresql"),
nullable=True,
comment="Mean of the variance plane.",
),
schema="cdb_lsstcomcamsim",
)
op.alter_column(
"ccdvisit1_quicklook",
"photometric_calib",
existing_type=sa.DOUBLE_PRECISION(precision=53),
comment="Conversion from DN to nanojansky.",
existing_comment="Conversion from DN to nanojansky for CCD.",
existing_nullable=True,
schema="cdb_lsstcomcamsim",
)
op.drop_column("ccdvisit1_quicklook", "seeing", schema="cdb_lsstcomcamsim")
op.add_column(
"visit1_quicklook",
sa.Column(
"seeing_zenith_500nm_min",
sa.DOUBLE()
.with_variant(mysql.DOUBLE(asdecimal=True), "mysql")
.with_variant(oracle.BINARY_DOUBLE(), "oracle")
.with_variant(sa.DOUBLE_PRECISION(), "postgresql"),
nullable=True,
comment="Measured PSF sigma, corrected to 500nm and an airmass of 1 (minimum across all detectors).",
),
schema="cdb_lsstcomcamsim",
)
op.add_column(
"visit1_quicklook",
sa.Column(
"seeing_zenith_500nm_max",
sa.DOUBLE()
.with_variant(mysql.DOUBLE(asdecimal=True), "mysql")
.with_variant(oracle.BINARY_DOUBLE(), "oracle")
.with_variant(sa.DOUBLE_PRECISION(), "postgresql"),
nullable=True,
comment="Measured PSF sigma, corrected to 500nm and an airmass of 1 (maximum across all detectors).",
),
schema="cdb_lsstcomcamsim",
)
op.add_column(
"visit1_quicklook",
sa.Column(
"seeing_zenith_500nm_median",
sa.DOUBLE()
.with_variant(mysql.DOUBLE(asdecimal=True), "mysql")
.with_variant(oracle.BINARY_DOUBLE(), "oracle")
.with_variant(sa.DOUBLE_PRECISION(), "postgresql"),
nullable=True,
comment="Measured PSF sigma, corrected to 500nm and an airmass of 1 (median across all detectors).",
),
schema="cdb_lsstcomcamsim",
)
op.alter_column(
"visit1_quicklook",
"eff_time_psf_sigma_scale_min",
existing_type=sa.DOUBLE_PRECISION(precision=53),
comment="Effective exposure time, PSF sigma scale (minimum across all detectors).",
existing_comment="Eff time PSF sigma scale (minimum across all detectors).",
existing_nullable=True,
schema="cdb_lsstcomcamsim",
)
op.alter_column(
"visit1_quicklook",
"eff_time_psf_sigma_scale_max",
existing_type=sa.DOUBLE_PRECISION(precision=53),
comment="Effective exposure time, PSF sigma scale (maximum across all detectors).",
existing_comment="Eff time PSF sigma scale (maximum across all detectors).",
existing_nullable=True,
schema="cdb_lsstcomcamsim",
)
op.alter_column(
"visit1_quicklook",
"eff_time_psf_sigma_scale_median",
existing_type=sa.DOUBLE_PRECISION(precision=53),
comment="Effective exposure time, PSF sigma scale (median across all detectors).",
existing_comment="Eff time PSF sigma scale (median across all detectors).",
existing_nullable=True,
schema="cdb_lsstcomcamsim",
)
op.alter_column(
"visit1_quicklook",
"eff_time_sky_bg_scale_min",
existing_type=sa.DOUBLE_PRECISION(precision=53),
comment="Effective exposure time, sky background scale (minimum across all detectors).",
existing_comment="Eff time sky background scale (minimum across all detectors).",
existing_nullable=True,
schema="cdb_lsstcomcamsim",
)
op.alter_column(
"visit1_quicklook",
"eff_time_sky_bg_scale_max",
existing_type=sa.DOUBLE_PRECISION(precision=53),
comment="Effective exposure time, sky background scale (maximum across all detectors).",
existing_comment="Eff time sky background scale (maximum across all detectors).",
existing_nullable=True,
schema="cdb_lsstcomcamsim",
)
op.alter_column(
"visit1_quicklook",
"eff_time_sky_bg_scale_median",
existing_type=sa.DOUBLE_PRECISION(precision=53),
comment="Effective exposure time, sky background scale (median across all detectors).",
existing_comment="Eff time sky background scale (median across all detectors).",
existing_nullable=True,
schema="cdb_lsstcomcamsim",
)
op.alter_column(
"visit1_quicklook",
"eff_time_zero_point_scale_min",
existing_type=sa.DOUBLE_PRECISION(precision=53),
comment="Effective exposure time, zero point scale (minimum across all detectors).",
existing_comment="Eff time zero point scale (minimum across all detectors).",
existing_nullable=True,
schema="cdb_lsstcomcamsim",
)
op.alter_column(
"visit1_quicklook",
"eff_time_zero_point_scale_max",
existing_type=sa.DOUBLE_PRECISION(precision=53),
comment="Effective exposure time, zero point scale (maximum across all detectors).",
existing_comment="Eff time zero point scale (maximum across all detectors).",
existing_nullable=True,
schema="cdb_lsstcomcamsim",
)
op.alter_column(
"visit1_quicklook",
"eff_time_zero_point_scale_median",
existing_type=sa.DOUBLE_PRECISION(precision=53),
comment="Effective exposure time, zero point scale (median across all detectors).",
existing_comment="Eff time zero point scale (median across all detectors).",
existing_nullable=True,
schema="cdb_lsstcomcamsim",
)
op.alter_column(
"visit1_quicklook",
"mean_var_min",
existing_type=sa.DOUBLE_PRECISION(precision=53),
comment="Mean of the variance plane (minimum across all detectors).",
existing_comment="Mean var (minimum across all detectors).",
existing_nullable=True,
schema="cdb_lsstcomcamsim",
)
op.alter_column(
"visit1_quicklook",
"mean_var_max",
existing_type=sa.DOUBLE_PRECISION(precision=53),
comment="Mean of the variance plane (maximum across all detectors).",
existing_comment="Mean var (maximum across all detectors).",
existing_nullable=True,
schema="cdb_lsstcomcamsim",
)
op.alter_column(
"visit1_quicklook",
"mean_var_median",
existing_type=sa.DOUBLE_PRECISION(precision=53),
comment="Mean of the variance plane (median across all detectors).",
existing_comment="Mean var (median across all detectors).",
existing_nullable=True,
schema="cdb_lsstcomcamsim",
)
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column(
"visit1_quicklook",
"mean_var_median",
existing_type=sa.DOUBLE_PRECISION(precision=53),
comment="Mean var (median across all detectors).",
existing_comment="Mean of the variance plane (median across all detectors).",
existing_nullable=True,
schema="cdb_lsstcomcamsim",
)
op.alter_column(
"visit1_quicklook",
"mean_var_max",
existing_type=sa.DOUBLE_PRECISION(precision=53),
comment="Mean var (maximum across all detectors).",
existing_comment="Mean of the variance plane (maximum across all detectors).",
existing_nullable=True,
schema="cdb_lsstcomcamsim",
)
op.alter_column(
"visit1_quicklook",
"mean_var_min",
existing_type=sa.DOUBLE_PRECISION(precision=53),
comment="Mean var (minimum across all detectors).",
existing_comment="Mean of the variance plane (minimum across all detectors).",
existing_nullable=True,
schema="cdb_lsstcomcamsim",
)
op.alter_column(
"visit1_quicklook",
"eff_time_zero_point_scale_median",
existing_type=sa.DOUBLE_PRECISION(precision=53),
comment="Eff time zero point scale (median across all detectors).",
existing_comment="Effective exposure time, zero point scale (median across all detectors).",
existing_nullable=True,
schema="cdb_lsstcomcamsim",
)
op.alter_column(
"visit1_quicklook",
"eff_time_zero_point_scale_max",
existing_type=sa.DOUBLE_PRECISION(precision=53),
comment="Eff time zero point scale (maximum across all detectors).",
existing_comment="Effective exposure time, zero point scale (maximum across all detectors).",
existing_nullable=True,
schema="cdb_lsstcomcamsim",
)
op.alter_column(
"visit1_quicklook",
"eff_time_zero_point_scale_min",
existing_type=sa.DOUBLE_PRECISION(precision=53),
comment="Eff time zero point scale (minimum across all detectors).",
existing_comment="Effective exposure time, zero point scale (minimum across all detectors).",
existing_nullable=True,
schema="cdb_lsstcomcamsim",
)
op.alter_column(
"visit1_quicklook",
"eff_time_sky_bg_scale_median",
existing_type=sa.DOUBLE_PRECISION(precision=53),
comment="Eff time sky background scale (median across all detectors).",
existing_comment="Effective exposure time, sky background scale (median across all detectors).",
existing_nullable=True,
schema="cdb_lsstcomcamsim",
)
op.alter_column(
"visit1_quicklook",
"eff_time_sky_bg_scale_max",
existing_type=sa.DOUBLE_PRECISION(precision=53),
comment="Eff time sky background scale (maximum across all detectors).",
existing_comment="Effective exposure time, sky background scale (maximum across all detectors).",
existing_nullable=True,
schema="cdb_lsstcomcamsim",
)
op.alter_column(
"visit1_quicklook",
"eff_time_sky_bg_scale_min",
existing_type=sa.DOUBLE_PRECISION(precision=53),
comment="Eff time sky background scale (minimum across all detectors).",
existing_comment="Effective exposure time, sky background scale (minimum across all detectors).",
existing_nullable=True,
schema="cdb_lsstcomcamsim",
)
op.alter_column(
"visit1_quicklook",
"eff_time_psf_sigma_scale_median",
existing_type=sa.DOUBLE_PRECISION(precision=53),
comment="Eff time PSF sigma scale (median across all detectors).",
existing_comment="Effective exposure time, PSF sigma scale (median across all detectors).",
existing_nullable=True,
schema="cdb_lsstcomcamsim",
)
op.alter_column(
"visit1_quicklook",
"eff_time_psf_sigma_scale_max",
existing_type=sa.DOUBLE_PRECISION(precision=53),
comment="Eff time PSF sigma scale (maximum across all detectors).",
existing_comment="Effective exposure time, PSF sigma scale (maximum across all detectors).",
existing_nullable=True,
schema="cdb_lsstcomcamsim",
)
op.alter_column(
"visit1_quicklook",
"eff_time_psf_sigma_scale_min",
existing_type=sa.DOUBLE_PRECISION(precision=53),
comment="Eff time PSF sigma scale (minimum across all detectors).",
existing_comment="Effective exposure time, PSF sigma scale (minimum across all detectors).",
existing_nullable=True,
schema="cdb_lsstcomcamsim",
)
op.drop_column("visit1_quicklook", "seeing_zenith_500nm_median", schema="cdb_lsstcomcamsim")
op.drop_column("visit1_quicklook", "seeing_zenith_500nm_max", schema="cdb_lsstcomcamsim")
op.drop_column("visit1_quicklook", "seeing_zenith_500nm_min", schema="cdb_lsstcomcamsim")
op.add_column(
"ccdvisit1_quicklook",
sa.Column(
"seeing",
sa.DOUBLE_PRECISION(precision=53),
autoincrement=False,
nullable=True,
comment="Mean measured FWHM of the PSF.",
),
schema="cdb_lsstcomcamsim",
)
op.alter_column(
"ccdvisit1_quicklook",
"photometric_calib",
existing_type=sa.DOUBLE_PRECISION(precision=53),
comment="Conversion from DN to nanojansky for CCD.",
existing_comment="Conversion from DN to nanojansky.",
existing_nullable=True,
schema="cdb_lsstcomcamsim",
)
op.drop_column("ccdvisit1_quicklook", "mean_var", schema="cdb_lsstcomcamsim")
op.drop_column("ccdvisit1_quicklook", "seeing_zenith_500nm", schema="cdb_lsstcomcamsim")
op.drop_column("ccdvisit1_quicklook", "zero_point", schema="cdb_lsstcomcamsim")
# ### end Alembic commands ###

0 comments on commit 46127ba

Please sign in to comment.