Skip to content

Commit

Permalink
Merge pull request #85 from Subaru-PFS/u/monodera/add_single_exptime
Browse files Browse the repository at this point in the history
add single_exptime in the target table
  • Loading branch information
monodera authored May 25, 2024
2 parents 596842b + 07f2154 commit 85bdca2
Show file tree
Hide file tree
Showing 12 changed files with 82 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""Add single_exptime to the target table
Revision ID: f630d28235eb
Revises: 368dce443754
Create Date: 2024-05-24 14:50:50.589144
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'f630d28235eb'
down_revision = '368dce443754'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('target', sa.Column('single_exptime', sa.Float(), nullable=True, comment='Individual exposure time (s)'))
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('target', 'single_exptime')
# ### end Alembic commands ###
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
"""set single_exptime un-nullable
Revision ID: 1027c2966c63
Revises: f630d28235eb
Create Date: 2024-05-24 14:58:17.757023
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '1027c2966c63'
down_revision = 'f630d28235eb'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column('target', 'single_exptime',
existing_type=sa.DOUBLE_PRECISION(precision=53),
nullable=False,
existing_comment='Individual exposure time (s)')
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column('target', 'single_exptime',
existing_type=sa.DOUBLE_PRECISION(precision=53),
nullable=True,
existing_comment='Individual exposure time (s)')
# ### end Alembic commands ###
1 change: 1 addition & 0 deletions docs/schema/target.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ Here are the columns in the `target` table:
| filter_j | str | Photometric band used to measure the PSF flux in _j_-band | | (\*) | |
| priority | float | Priority of the target for observation. | | | 1.0 |
| effective_exptime | float | Effective exposure time required to complete the target | s | \* | |
| single_exptime | float | Individual exposure time | s | | 900 |
| is_medium_resolution | bool | `True` if the target is observed with the medium-resolution mode | | | False |
| qa_relative_throughput | float | Quality assurance metric for relative throughput. | | | 1.0 |
| qa_relative_noise | float | Quality assurance metric for relative noise. | | | 1.0 |
Expand Down
3 changes: 2 additions & 1 deletion docs/tbls/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
| [public.proposal](public.proposal.md) | 13 | | BASE TABLE |
| [public.sky](public.sky.md) | 14 | | BASE TABLE |
| [public.fluxstd](public.fluxstd.md) | 61 | | BASE TABLE |
| [public.target](public.target.md) | 59 | | BASE TABLE |
| [public.target](public.target.md) | 60 | | BASE TABLE |
| [public.cluster](public.cluster.md) | 10 | | BASE TABLE |

## Stored procedures and functions
Expand Down Expand Up @@ -257,6 +257,7 @@ erDiagram
varchar filter_j FK
double_precision priority
double_precision effective_exptime
double_precision single_exptime
boolean is_medium_resolution
double_precision qa_relative_throughput
double_precision qa_relative_noise
Expand Down
1 change: 1 addition & 0 deletions docs/tbls/public.cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ erDiagram
varchar filter_j FK
double_precision priority
double_precision effective_exptime
double_precision single_exptime
boolean is_medium_resolution
double_precision qa_relative_throughput
double_precision qa_relative_noise
Expand Down
1 change: 1 addition & 0 deletions docs/tbls/public.filter_name.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ erDiagram
varchar filter_j FK
double_precision priority
double_precision effective_exptime
double_precision single_exptime
boolean is_medium_resolution
double_precision qa_relative_throughput
double_precision qa_relative_noise
Expand Down
2 changes: 1 addition & 1 deletion docs/tbls/public.fluxstd.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@
| ---- | ---------- |
| fluxstd_pkey | CREATE UNIQUE INDEX fluxstd_pkey ON public.fluxstd USING btree (fluxstd_id) |
| uq_obj_id_input_catalog_id_version | CREATE UNIQUE INDEX uq_obj_id_input_catalog_id_version ON public.fluxstd USING btree (obj_id, input_catalog_id, version) |
| fluxstd_q3c_ang2ipix_idx | CREATE INDEX fluxstd_q3c_ang2ipix_idx ON public.fluxstd USING btree (q3c_ang2ipix(ra, "dec")) |
| ix_fluxstd_version | CREATE INDEX ix_fluxstd_version ON public.fluxstd USING btree (version) |
| fluxstd_q3c_ang2ipix_idx | CREATE INDEX fluxstd_q3c_ang2ipix_idx ON public.fluxstd USING btree (q3c_ang2ipix(ra, "dec")) |

## Relations

Expand Down
1 change: 1 addition & 0 deletions docs/tbls/public.input_catalog.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ erDiagram
varchar filter_j FK
double_precision priority
double_precision effective_exptime
double_precision single_exptime
boolean is_medium_resolution
double_precision qa_relative_throughput
double_precision qa_relative_noise
Expand Down
1 change: 1 addition & 0 deletions docs/tbls/public.proposal.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ erDiagram
varchar filter_j FK
double_precision priority
double_precision effective_exptime
double_precision single_exptime
boolean is_medium_resolution
double_precision qa_relative_throughput
double_precision qa_relative_noise
Expand Down
2 changes: 2 additions & 0 deletions docs/tbls/public.target.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
| filter_j | varchar | | true | | [public.filter_name](public.filter_name.md) | j-band filter (j_mko, etc.) |
| priority | double precision | | true | | | Priority of the target specified by the observer within the proposal |
| effective_exptime | double precision | | false | | | Requested effective exposure time (s) |
| single_exptime | double precision | | false | | | Individual exposure time (s) |
| is_medium_resolution | boolean | | true | | | True if the medium resolution mode is requested |
| qa_relative_throughput | double precision | | true | | | Relative throughput to the reference value requested by the observer (default: 1.0) |
| qa_relative_noise | double precision | | true | | | Relative noise to the reference value requested by the observer (default: 1.0) |
Expand Down Expand Up @@ -161,6 +162,7 @@ erDiagram
varchar filter_j FK
double_precision priority
double_precision effective_exptime
double_precision single_exptime
boolean is_medium_resolution
double_precision qa_relative_throughput
double_precision qa_relative_noise
Expand Down
1 change: 1 addition & 0 deletions docs/tbls/public.target_type.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ erDiagram
varchar filter_j FK
double_precision priority
double_precision effective_exptime
double_precision single_exptime
boolean is_medium_resolution
double_precision qa_relative_throughput
double_precision qa_relative_noise
Expand Down
9 changes: 9 additions & 0 deletions src/targetdb/models/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,13 @@ class target(Base):
Float, nullable=False, comment="Requested effective exposure time (s)"
)

single_exptime = Column(
Float,
nullable=False,
default=900,
comment="Individual exposure time (s)",
)

is_medium_resolution = Column(
Boolean,
default=False,
Expand Down Expand Up @@ -298,6 +305,7 @@ def __init__(
#
priority,
effective_exptime,
single_exptime,
is_medium_resolution,
#
qa_relative_throughput,
Expand Down Expand Up @@ -364,6 +372,7 @@ def __init__(
#
self.priority = priority
self.effective_exptime = effective_exptime
self.single_exptime = single_exptime
self.is_medium_resolution = is_medium_resolution
#
self.qa_relative_throughput = qa_relative_throughput
Expand Down

0 comments on commit 85bdca2

Please sign in to comment.