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
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
"""add filter_u and change accordingly

Revision ID: 5df293bb75f2
Revises: a251bdccb11f
Create Date: 2026-05-20 18:18:28.628076

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '5df293bb75f2'
down_revision = 'a251bdccb11f'
branch_labels = None
depends_on = None


def upgrade():
op.add_column('fluxstd', sa.Column('psf_mag_u', sa.Float(), nullable=True, comment='u-band PSF magnitude (AB mag)'))
op.add_column('fluxstd', sa.Column('psf_mag_error_u', sa.Float(), nullable=True, comment='Error in u-band PSF magnitude (AB mag)'))
op.add_column('fluxstd', sa.Column('psf_flux_u', sa.Float(), nullable=True, comment='u-band PSF flux (nJy)'))
op.add_column('fluxstd', sa.Column('psf_flux_error_u', sa.Float(), nullable=True, comment='Error in u-band PSF flux (nJy)'))
op.add_column('fluxstd', sa.Column('filter_u', sa.String(), nullable=True, comment='u-band filter (u_sdss, u_cfht, etc.)'))
op.create_foreign_key('fluxstd_filter_u_fkey', 'fluxstd', 'filter_name', ['filter_u'], ['filter_name'])
op.add_column('target', sa.Column('fiber_mag_u', sa.Float(), nullable=True, comment='u-band magnitude within a fiber (AB mag)'))
op.add_column('target', sa.Column('psf_mag_u', sa.Float(), nullable=True, comment='u-band PSF magnitude (AB mag)'))
op.add_column('target', sa.Column('psf_mag_error_u', sa.Float(), nullable=True, comment='Error in u-band PSF magnitude (AB mag)'))
op.add_column('target', sa.Column('psf_flux_u', sa.Float(), nullable=True, comment='u-band PSF flux (nJy)'))
op.add_column('target', sa.Column('psf_flux_error_u', sa.Float(), nullable=True, comment='Error in u-band PSF flux (nJy)'))
op.add_column('target', sa.Column('total_flux_u', sa.Float(), nullable=True, comment='u-band total flux (nJy)'))
op.add_column('target', sa.Column('total_flux_error_u', sa.Float(), nullable=True, comment='Error in u-band total flux (nJy)'))
op.add_column('target', sa.Column('filter_u', sa.String(), nullable=True, comment='u-band filter (u_sdss, u_cfht, etc.)'))
op.create_foreign_key('target_filter_u_fkey', 'target', 'filter_name', ['filter_u'], ['filter_name'])


def downgrade():
op.drop_constraint('target_filter_u_fkey', 'target', type_='foreignkey')
op.drop_column('target', 'filter_u')
op.drop_column('target', 'total_flux_error_u')
op.drop_column('target', 'total_flux_u')
op.drop_column('target', 'psf_flux_error_u')
op.drop_column('target', 'psf_flux_u')
op.drop_column('target', 'psf_mag_error_u')
op.drop_column('target', 'psf_mag_u')
op.drop_column('target', 'fiber_mag_u')
op.drop_constraint('fluxstd_filter_u_fkey', 'fluxstd', type_='foreignkey')
op.drop_column('fluxstd', 'filter_u')
op.drop_column('fluxstd', 'psf_flux_error_u')
op.drop_column('fluxstd', 'psf_flux_u')
op.drop_column('fluxstd', 'psf_mag_error_u')
op.drop_column('fluxstd', 'psf_mag_u')
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
"""add filter_v and change accordingly

Revision ID: 31f82c75c58d
Revises: 5df293bb75f2
Create Date: 2026-05-21 09:09:10.662583

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '31f82c75c58d'
down_revision = '5df293bb75f2'
branch_labels = None
depends_on = None


def upgrade():
op.add_column('fluxstd', sa.Column('psf_mag_v', sa.Float(), nullable=True, comment='v-band PSF magnitude (AB mag)'))
op.add_column('fluxstd', sa.Column('psf_mag_error_v', sa.Float(), nullable=True, comment='Error in v-band PSF magnitude (AB mag)'))
op.add_column('fluxstd', sa.Column('psf_flux_v', sa.Float(), nullable=True, comment='v-band PSF flux (nJy)'))
op.add_column('fluxstd', sa.Column('psf_flux_error_v', sa.Float(), nullable=True, comment='Error in v-band PSF flux (nJy)'))
op.add_column('fluxstd', sa.Column('filter_v', sa.String(), nullable=True, comment='v-band filter (v_skymapper, v_splus, etc.)'))
op.alter_column('fluxstd', 'filter_u',
existing_type=sa.VARCHAR(),
comment='u-band filter (u_sdss, u_cfht, u_skymapper, etc.)',
existing_comment='u-band filter (u_sdss, u_cfht, etc.)',
existing_nullable=True)
op.create_foreign_key('fluxstd_filter_v_fkey', 'fluxstd', 'filter_name', ['filter_v'], ['filter_name'])
op.add_column('target', sa.Column('fiber_mag_v', sa.Float(), nullable=True, comment='v-band magnitude within a fiber (AB mag)'))
op.add_column('target', sa.Column('psf_mag_v', sa.Float(), nullable=True, comment='v-band PSF magnitude (AB mag)'))
op.add_column('target', sa.Column('psf_mag_error_v', sa.Float(), nullable=True, comment='Error in v-band PSF magnitude (AB mag)'))
op.add_column('target', sa.Column('psf_flux_v', sa.Float(), nullable=True, comment='v-band PSF flux (nJy)'))
op.add_column('target', sa.Column('psf_flux_error_v', sa.Float(), nullable=True, comment='Error in v-band PSF flux (nJy)'))
op.add_column('target', sa.Column('total_flux_v', sa.Float(), nullable=True, comment='v-band total flux (nJy)'))
op.add_column('target', sa.Column('total_flux_error_v', sa.Float(), nullable=True, comment='Error in v-band total flux (nJy)'))
op.add_column('target', sa.Column('filter_v', sa.String(), nullable=True, comment='v-band filter (v_skymapper, v_splus, etc.)'))
op.alter_column('target', 'filter_u',
existing_type=sa.VARCHAR(),
comment='u-band filter (u_sdss, u_cfht, u_skymapper, etc.)',
existing_comment='u-band filter (u_sdss, u_cfht, etc.)',
existing_nullable=True)
op.create_foreign_key('target_filter_v_fkey', 'target', 'filter_name', ['filter_v'], ['filter_name'])


def downgrade():
op.drop_constraint('target_filter_v_fkey', 'target', type_='foreignkey')
op.alter_column('target', 'filter_u',
existing_type=sa.VARCHAR(),
comment='u-band filter (u_sdss, u_cfht, etc.)',
existing_comment='u-band filter (u_sdss, u_cfht, u_skymapper, etc.)',
existing_nullable=True)
op.drop_column('target', 'filter_v')
op.drop_column('target', 'total_flux_error_v')
op.drop_column('target', 'total_flux_v')
op.drop_column('target', 'psf_flux_error_v')
op.drop_column('target', 'psf_flux_v')
op.drop_column('target', 'psf_mag_error_v')
op.drop_column('target', 'psf_mag_v')
op.drop_column('target', 'fiber_mag_v')
op.drop_constraint('fluxstd_filter_v_fkey', 'fluxstd', type_='foreignkey')
op.alter_column('fluxstd', 'filter_u',
existing_type=sa.VARCHAR(),
comment='u-band filter (u_sdss, u_cfht, etc.)',
existing_comment='u-band filter (u_sdss, u_cfht, u_skymapper, etc.)',
existing_nullable=True)
op.drop_column('fluxstd', 'filter_v')
op.drop_column('fluxstd', 'psf_flux_error_v')
op.drop_column('fluxstd', 'psf_flux_v')
op.drop_column('fluxstd', 'psf_mag_error_v')
op.drop_column('fluxstd', 'psf_mag_v')
12 changes: 11 additions & 1 deletion docs/schema/fluxstd.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,40 @@ Here are the columns in the `fluxstd` table:
| patch | int | Patch defined by, e.g., the HSC pipeline | | | |
| target_type_id | int | `target_type_id` in the `target_type` table (it is `3` for `FLUXSTD`) | | | 3 |
| input_catalog_id | int | `input_catalog_id` in the `input_catalog` table (should be in `[3000, 4999]`) | | | |
| psf_mag_u | float | PSF magnitude in _u_-band | AB mag | | |
| psf_mag_v | float | PSF magnitude in _v_-band | AB mag | | |
| psf_mag_g | float | PSF magnitude in _g_-band | AB mag | | |
| psf_mag_r | float | PSF magnitude in _r_-band | AB mag | | |
| psf_mag_i | float | PSF magnitude in _i_-band | AB mag | | |
| psf_mag_z | float | PSF magnitude in _z_-band | AB mag | | |
| psf_mag_y | float | PSF magnitude in _y_-band | AB mag | | |
| psf_mag_j | float | PSF magnitude in _j_-band | AB mag | | |
| psf_mag_error_u | float | Error in PSF magnitude in _u_-band | AB mag | | |
| psf_mag_error_v | float | Error in PSF magnitude in _v_-band | AB mag | | |
| psf_mag_error_g | float | Error in PSF magnitude in _g_-band | AB mag | | |
| psf_mag_error_r | float | Error in PSF magnitude in _r_-band | AB mag | | |
| psf_mag_error_i | float | Error in PSF magnitude in _i_-band | AB mag | | |
| psf_mag_error_z | float | Error in PSF magnitude in _z_-band | AB mag | | |
| psf_mag_error_y | float | Error in PSF magnitude in _y_-band | AB mag | | |
| psf_mag_error_j | float | Error in PSF magnitude in _j_-band | AB mag | | |
| psf_flux_u | float | PSF flux in _u_-band | nJy | (\*) | |
| psf_flux_v | float | PSF flux in _v_-band | nJy | (\*) | |
| psf_flux_g | float | PSF flux in _g_-band | nJy | (\*) | |
| psf_flux_r | float | PSF flux in _r_-band | nJy | (\*) | |
| psf_flux_i | float | PSF flux in _i_-band | nJy | (\*) | |
| psf_flux_z | float | PSF flux in _z_-band | nJy | (\*) | |
| psf_flux_y | float | PSF flux in _y_-band | nJy | (\*) | |
| psf_flux_j | float | PSF flux in _j_-band | nJy | (\*) | |
| psf_flux_error_u | float | Error in PSF flux in _u_-band | nJy | (\*) | |
| psf_flux_error_v | float | Error in PSF flux in _v_-band | nJy | (\*) | |
| psf_flux_error_g | float | Error in PSF flux in _g_-band | nJy | (\*) | |
| psf_flux_error_r | float | Error in PSF flux in _r_-band | nJy | (\*) | |
| psf_flux_error_i | float | Error in PSF flux in _i_-band | nJy | (\*) | |
| psf_flux_error_z | float | Error in PSF flux in _z_-band | nJy | (\*) | |
| psf_flux_error_y | float | Error in PSF flux in _y_-band | nJy | (\*) | |
| psf_flux_error_j | float | Error in PSF flux in _j_-band | nJy | (\*) | |
| filter_u | str | Photometric band used to measure the PSF flux in _u_-band | | (\*) | |
| filter_v | str | Photometric band used to measure the PSF flux in _v_-band | | (\*) | |
| filter_g | str | Photometric band used to measure the PSF flux in _g_-band | | (\*) | |
| filter_r | str | Photometric band used to measure the PSF flux in _r_-band | | (\*) | |
| filter_i | str | Photometric band used to measure the PSF flux in _i_-band | | (\*) | |
Expand Down Expand Up @@ -85,7 +95,7 @@ Here are the columns in the `fluxstd` table:

- `target_type_id` references the `target_type_id` in the `target_type` table.
- `input_catalog_id` references the `input_catalog_id` in the `input_catalog` table.
- `filter_{g,r,i,z,y,j}` references the `filter_name` in the `filter_name` table.
- `filter_{u,v,g,r,i,z,y,j}` references the `filter_name` in the `filter_name` table.

## Notes

Expand Down
Loading
Loading