-
Notifications
You must be signed in to change notification settings - Fork 1
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 #52 from lsst-dm/tickets/DM-47443
Migrations for recent sdm_schemas: psf, pixelscale, mountjitter, magnitude limits
- Loading branch information
Showing
14 changed files
with
2,299 additions
and
12 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
200 changes: 200 additions & 0 deletions
200
alembic/latiss/versions/47c0b5ce839e_add_psf_pixelscale_mountjitter_to_.py
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,200 @@ | ||
"""Add psf, pixelscale, mountjitter to quicklooks | ||
Revision ID: 47c0b5ce839e | ||
Revises: e9fd2cdb9c12 | ||
Create Date: 2024-11-20 01:32:09.210537+00:00 | ||
""" | ||
|
||
from typing import Sequence, Union | ||
|
||
import sqlalchemy as sa | ||
from sqlalchemy.dialects import mysql | ||
|
||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = "47c0b5ce839e" | ||
down_revision: Union[str, None] = "e9fd2cdb9c12" | ||
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.create_table( | ||
"exposure_quicklook", | ||
sa.Column( | ||
"exposure_id", | ||
sa.BIGINT().with_variant(mysql.BIGINT(), "mysql").with_variant(sa.BIGINT(), "postgresql"), | ||
nullable=False, | ||
comment="Unique identifier.", | ||
), | ||
sa.Column( | ||
"day_obs", | ||
sa.INTEGER().with_variant(mysql.INTEGER(), "mysql").with_variant(sa.INTEGER(), "postgresql"), | ||
nullable=False, | ||
comment="Day of observation.", | ||
), | ||
sa.Column( | ||
"seq_num", | ||
sa.INTEGER().with_variant(mysql.INTEGER(), "mysql").with_variant(sa.INTEGER(), "postgresql"), | ||
nullable=False, | ||
comment="Sequence number.", | ||
), | ||
sa.Column( | ||
"postisr_pixel_median", | ||
sa.FLOAT().with_variant(mysql.FLOAT(), "mysql").with_variant(sa.FLOAT(), "postgresql"), | ||
nullable=True, | ||
comment="Median postISR pixel value.", | ||
), | ||
sa.Column( | ||
"mount_motion_image_degradation", | ||
sa.FLOAT().with_variant(mysql.FLOAT(), "mysql").with_variant(sa.FLOAT(), "postgresql"), | ||
nullable=True, | ||
comment="Image degradation due to mount motion.", | ||
), | ||
sa.Column( | ||
"mount_motion_image_degradation_az", | ||
sa.FLOAT().with_variant(mysql.FLOAT(), "mysql").with_variant(sa.FLOAT(), "postgresql"), | ||
nullable=True, | ||
comment="Image degradation due to mount motion in azimuth.", | ||
), | ||
sa.Column( | ||
"mount_motion_image_degradation_el", | ||
sa.FLOAT().with_variant(mysql.FLOAT(), "mysql").with_variant(sa.FLOAT(), "postgresql"), | ||
nullable=True, | ||
comment="Image degradation due to mount motion in elevation.", | ||
), | ||
sa.Column( | ||
"mount_jitter_rms", | ||
sa.FLOAT().with_variant(mysql.FLOAT(), "mysql").with_variant(sa.FLOAT(), "postgresql"), | ||
nullable=True, | ||
comment="RMS mount jitter.", | ||
), | ||
sa.Column( | ||
"mount_jitter_rms_az", | ||
sa.FLOAT().with_variant(mysql.FLOAT(), "mysql").with_variant(sa.FLOAT(), "postgresql"), | ||
nullable=True, | ||
comment="Azimuth RMS mount jitter.", | ||
), | ||
sa.Column( | ||
"mount_jitter_rms_el", | ||
sa.FLOAT().with_variant(mysql.FLOAT(), "mysql").with_variant(sa.FLOAT(), "postgresql"), | ||
nullable=True, | ||
comment="Elevation RMS mount jitter.", | ||
), | ||
sa.Column( | ||
"mount_jitter_rms_rot", | ||
sa.FLOAT().with_variant(mysql.FLOAT(), "mysql").with_variant(sa.FLOAT(), "postgresql"), | ||
nullable=True, | ||
comment="Rotator RMS mount jitter.", | ||
), | ||
sa.ForeignKeyConstraint( | ||
["day_obs", "seq_num"], | ||
["cdb_latiss.exposure.day_obs", "cdb_latiss.exposure.seq_num"], | ||
name="fk_exposure_quicklook_day_obs_seq_num", | ||
), | ||
sa.ForeignKeyConstraint( | ||
["exposure_id"], ["cdb_latiss.exposure.exposure_id"], name="fk_exposure_quicklook_obs_id" | ||
), | ||
sa.PrimaryKeyConstraint("day_obs", "seq_num"), | ||
schema="cdb_latiss", | ||
mysql_engine="MyISAM", | ||
) | ||
op.add_column( | ||
"ccdvisit1_quicklook", | ||
sa.Column( | ||
"pixel_scale", | ||
sa.FLOAT().with_variant(mysql.FLOAT(), "mysql").with_variant(sa.FLOAT(), "postgresql"), | ||
nullable=True, | ||
comment="Measured detector pixel scale.", | ||
), | ||
schema="cdb_latiss", | ||
) | ||
op.add_column( | ||
"ccdvisit1_quicklook", | ||
sa.Column( | ||
"psf_ap_flux_delta", | ||
sa.FLOAT().with_variant(mysql.FLOAT(), "mysql").with_variant(sa.FLOAT(), "postgresql"), | ||
nullable=True, | ||
comment="Delta (max - min) of model psf aperture flux (with aperture radius of max(2, 3*psfSigma)) values evaluated on a grid of unmasked pixels.", | ||
), | ||
schema="cdb_latiss", | ||
) | ||
op.add_column( | ||
"ccdvisit1_quicklook", | ||
sa.Column( | ||
"psf_ap_corr_sigma_scaled_delta", | ||
sa.FLOAT().with_variant(mysql.FLOAT(), "mysql").with_variant(sa.FLOAT(), "postgresql"), | ||
nullable=True, | ||
comment="Delta (max - min) of psf flux aperture correction factors scaled (divided) by the psfSigma evaluated on a grid of unmasked pixels.", | ||
), | ||
schema="cdb_latiss", | ||
) | ||
op.add_column( | ||
"visit1_quicklook", | ||
sa.Column( | ||
"pixel_scale", | ||
sa.FLOAT().with_variant(mysql.FLOAT(), "mysql").with_variant(sa.FLOAT(), "postgresql"), | ||
nullable=True, | ||
comment="Measured detector pixel scale.", | ||
), | ||
schema="cdb_latiss", | ||
) | ||
op.add_column( | ||
"visit1_quicklook", | ||
sa.Column( | ||
"stats_mag_lim", | ||
sa.FLOAT().with_variant(mysql.FLOAT(), "mysql").with_variant(sa.FLOAT(), "postgresql"), | ||
nullable=True, | ||
comment="Magnitude limit at fixed SNR (default SNR=5) calculated from exposure summary stats.", | ||
), | ||
schema="cdb_latiss", | ||
) | ||
op.add_column( | ||
"visit1_quicklook", | ||
sa.Column( | ||
"psf_ap_flux_delta", | ||
sa.FLOAT().with_variant(mysql.FLOAT(), "mysql").with_variant(sa.FLOAT(), "postgresql"), | ||
nullable=True, | ||
comment="Delta (max - min) of model psf aperture flux (with aperture radius of max(2, 3*psfSigma)) values evaluated on a grid of unmasked pixels.", | ||
), | ||
schema="cdb_latiss", | ||
) | ||
op.add_column( | ||
"visit1_quicklook", | ||
sa.Column( | ||
"psf_ap_corr_sigma_scaled_delta", | ||
sa.FLOAT().with_variant(mysql.FLOAT(), "mysql").with_variant(sa.FLOAT(), "postgresql"), | ||
nullable=True, | ||
comment="Delta (max - min) of psf flux aperture correction factors scaled (divided) by the psfSigma evaluated on a grid of unmasked pixels.", | ||
), | ||
schema="cdb_latiss", | ||
) | ||
op.drop_column("visit1_quicklook", "postisr_pixel_median", schema="cdb_latiss") | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.add_column( | ||
"visit1_quicklook", | ||
sa.Column( | ||
"postisr_pixel_median", | ||
sa.DOUBLE_PRECISION(precision=53), | ||
autoincrement=False, | ||
nullable=True, | ||
comment="Median postISR pixel value.", | ||
), | ||
schema="cdb_latiss", | ||
) | ||
op.drop_column("visit1_quicklook", "psf_ap_corr_sigma_scaled_delta", schema="cdb_latiss") | ||
op.drop_column("visit1_quicklook", "psf_ap_flux_delta", schema="cdb_latiss") | ||
op.drop_column("visit1_quicklook", "stats_mag_lim", schema="cdb_latiss") | ||
op.drop_column("visit1_quicklook", "pixel_scale", schema="cdb_latiss") | ||
op.drop_column("ccdvisit1_quicklook", "psf_ap_corr_sigma_scaled_delta", schema="cdb_latiss") | ||
op.drop_column("ccdvisit1_quicklook", "psf_ap_flux_delta", schema="cdb_latiss") | ||
op.drop_column("ccdvisit1_quicklook", "pixel_scale", schema="cdb_latiss") | ||
op.drop_table("exposure_quicklook", schema="cdb_latiss") | ||
# ### end Alembic commands ### |
Oops, something went wrong.