diff --git a/alembic/pfsa-db01-gb/alembic/versions/20250505-162126_fc8ea63b8c9d_add_total_fluxes.py b/alembic/pfsa-db01-gb/alembic/versions/20250505-162126_fc8ea63b8c9d_add_total_fluxes.py new file mode 100644 index 0000000..5b35449 --- /dev/null +++ b/alembic/pfsa-db01-gb/alembic/versions/20250505-162126_fc8ea63b8c9d_add_total_fluxes.py @@ -0,0 +1,50 @@ +"""add total fluxes + +Revision ID: fc8ea63b8c9d +Revises: 5b40ed8dcd48 +Create Date: 2025-05-05 16:21:26.652825 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = 'fc8ea63b8c9d' +down_revision = '5b40ed8dcd48' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.add_column('target', sa.Column('total_flux_g', sa.Float(), nullable=True, comment='g-band total flux (nJy)')) + op.add_column('target', sa.Column('total_flux_r', sa.Float(), nullable=True, comment='r-band total flux (nJy)')) + op.add_column('target', sa.Column('total_flux_i', sa.Float(), nullable=True, comment='i-band total flux (nJy)')) + op.add_column('target', sa.Column('total_flux_z', sa.Float(), nullable=True, comment='z-band total flux (nJy)')) + op.add_column('target', sa.Column('total_flux_y', sa.Float(), nullable=True, comment='y-band total flux (nJy)')) + op.add_column('target', sa.Column('total_flux_j', sa.Float(), nullable=True, comment='J band total flux (nJy)')) + op.add_column('target', sa.Column('total_flux_error_g', sa.Float(), nullable=True, comment='Error in g-band total flux (nJy)')) + op.add_column('target', sa.Column('total_flux_error_r', sa.Float(), nullable=True, comment='Error in r-band total flux (nJy)')) + op.add_column('target', sa.Column('total_flux_error_i', sa.Float(), nullable=True, comment='Error in i-band total flux (nJy)')) + op.add_column('target', sa.Column('total_flux_error_z', sa.Float(), nullable=True, comment='Error in z-band total flux (nJy)')) + op.add_column('target', sa.Column('total_flux_error_y', sa.Float(), nullable=True, comment='Error in y-band total flux (nJy)')) + op.add_column('target', sa.Column('total_flux_error_j', sa.Float(), nullable=True, comment='Error in J band total flux (nJy)')) + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_column('target', 'total_flux_error_j') + op.drop_column('target', 'total_flux_error_y') + op.drop_column('target', 'total_flux_error_z') + op.drop_column('target', 'total_flux_error_i') + op.drop_column('target', 'total_flux_error_r') + op.drop_column('target', 'total_flux_error_g') + op.drop_column('target', 'total_flux_j') + op.drop_column('target', 'total_flux_y') + op.drop_column('target', 'total_flux_z') + op.drop_column('target', 'total_flux_i') + op.drop_column('target', 'total_flux_r') + op.drop_column('target', 'total_flux_g') + # ### end Alembic commands ### diff --git a/diagrams/erdiagram_targetdb-20250506094125.pdf b/diagrams/erdiagram_targetdb-20250506094125.pdf new file mode 100644 index 0000000..5982316 Binary files /dev/null and b/diagrams/erdiagram_targetdb-20250506094125.pdf differ diff --git a/docs/reference/cli.md b/docs/reference/cli.md index 33a5266..8926bc4 100644 --- a/docs/reference/cli.md +++ b/docs/reference/cli.md @@ -44,25 +44,25 @@ $ pfs-targetdb-cli [OPTIONS] COMMAND [ARGS]... **Options**: -* `--help`: Show this message and exit. +- `--help`: Show this message and exit. **Commands**: -* `create-db`: Create a database on a PostgreSQL server. -* `drop-db`: Drop a database on a PostgreSQL server. -* `install-q3c`: Insert the Q3C extension. -* `create-schema`: Create tables of the PFS tartedb in a... -* `checkdups`: Check for duplicates in data files in a... -* `prep-fluxstd`: Prepare flux standard data for the target... -* `diagram`: Generate an ER diagram of a database. -* `mdtable`: Generate a Markdown output of the schema... -* `insert`: Insert rows into a table in the PFS Target... -* `update`: Update rows in a table in the PFS Target... -* `parse-alloc`: Parse an Excel file containing time... -* `transfer-targets`: Download target lists from the uploader to... -* `insert-targets`: Insert targets using a list of input... -* `insert-pointings`: Insert user-defined pointings using a list... -* `update-catalog-active`: Update active flag in the input_catalog... +- `create-db`: Create a database on a PostgreSQL server. +- `drop-db`: Drop a database on a PostgreSQL server. +- `install-q3c`: Insert the Q3C extension. +- `create-schema`: Create tables of the PFS tartedb in a... +- `checkdups`: Check for duplicates in data files in a... +- `prep-fluxstd`: Prepare flux standard data for the target... +- `diagram`: Generate an ER diagram of a database. +- `mdtable`: Generate a Markdown output of the schema... +- `insert`: Insert rows into a table in the PFS Target... +- `update`: Update rows in a table in the PFS Target... +- `parse-alloc`: Parse an Excel file containing time... +- `transfer-targets`: Download target lists from the uploader to... +- `insert-targets`: Insert targets using a list of input... +- `insert-pointings`: Insert user-defined pointings using a list... +- `update-catalog-active`: Update active flag in the input_catalog... --- @@ -78,8 +78,8 @@ $ pfs-targetdb-cli create-db [OPTIONS] **Options**: -* `-c, --config TEXT`: Database configuration file in the TOML format. [required] -* `--help`: Show this message and exit. +- `-c, --config TEXT`: Database configuration file in the TOML format. [required] +- `--help`: Show this message and exit. --- @@ -95,8 +95,8 @@ $ pfs-targetdb-cli drop-db [OPTIONS] **Options**: -* `-c, --config TEXT`: Database configuration file in the TOML format. [required] -* `--help`: Show this message and exit. +- `-c, --config TEXT`: Database configuration file in the TOML format. [required] +- `--help`: Show this message and exit. --- @@ -112,8 +112,8 @@ $ pfs-targetdb-cli install-q3c [OPTIONS] **Options**: -* `-c, --config TEXT`: Database configuration file in the TOML format. [required] -* `--help`: Show this message and exit. +- `-c, --config TEXT`: Database configuration file in the TOML format. [required] +- `--help`: Show this message and exit. --- @@ -129,9 +129,9 @@ $ pfs-targetdb-cli create-schema [OPTIONS] **Options**: -* `-c, --config TEXT`: Database configuration file in the TOML format. [required] -* `--drop-all`: Flag to drop all tables before creating schema. -* `--help`: Show this message and exit. +- `-c, --config TEXT`: Database configuration file in the TOML format. [required] +- `--drop-all`: Flag to drop all tables before creating schema. +- `--help`: Show this message and exit. --- @@ -147,16 +147,16 @@ $ pfs-targetdb-cli checkdups [OPTIONS] DIRECTORY **Arguments**: -* `DIRECTORY`: Directory path containing input files. [required] +- `DIRECTORY`: Directory path containing input files. [required] **Options**: -* `-o, --outdir TEXT`: Directory path to save output files. [default: .] -* `--skip-save-merged`: Do not save the merged DataFrame. -* `--additional-columns TEXT`: Additional columns to output for the merged file. (e.g., 'psf_mag_g' 'psf_mag_r'). The following columns are saved by default: "obj_id", "ra", "dec", "input_catalog_id", "version", "input_file", "is_fstar_gaia", "prob_f_star". -* `--check-columns TEXT`: Columns used to check for duplicates. [default: obj_id, input_catalog_id, version] -* `--format [feather|parquet]`: File format of the merged data file. [default: parquet] -* `--help`: Show this message and exit. +- `-o, --outdir TEXT`: Directory path to save output files. [default: .] +- `--skip-save-merged`: Do not save the merged DataFrame. +- `--additional-columns TEXT`: Additional columns to output for the merged file. (e.g., 'psf_mag_g' 'psf_mag_r'). The following columns are saved by default: "obj_id", "ra", "dec", "input_catalog_id", "version", "input_file", "is_fstar_gaia", "prob_f_star". +- `--check-columns TEXT`: Columns used to check for duplicates. [default: obj_id, input_catalog_id, version] +- `--format [feather|parquet]`: File format of the merged data file. [default: parquet] +- `--help`: Show this message and exit. --- @@ -172,17 +172,17 @@ $ pfs-targetdb-cli prep-fluxstd [OPTIONS] INPUT_DIR OUTPUT_DIR **Arguments**: -* `INPUT_DIR`: Directory path containing input files. Files must be in one of the following formats: parquet, feather, or csv. The input files must be generated in a certain format to be compatible for targetdb. [required] -* `OUTPUT_DIR`: Directory path to save the output files. [required] +- `INPUT_DIR`: Directory path containing input files. Files must be in one of the following formats: parquet, feather, or csv. The input files must be generated in a certain format to be compatible for targetdb. [required] +- `OUTPUT_DIR`: Directory path to save the output files. [required] **Options**: -* `--version TEXT`: Version **string** for the F-star candidate catalog (e.g., '3.3'). [required] -* `--input_catalog_id INTEGER`: Input catalog ID for the flux standard star catalog. -* `--input_catalog_name TEXT`: Input catalog name for the flux standard star catalog. -* `--rename-cols TEXT`: Dictionary to rename columns (e.g., '{"fstar_gaia": "is_fstar_gaia"}'). -* `--format [feather|parquet]`: File format of the output data file. [default: parquet] -* `--help`: Show this message and exit. +- `--version TEXT`: Version **string** for the F-star candidate catalog (e.g., '3.3'). [required] +- `--input_catalog_id INTEGER`: Input catalog ID for the flux standard star catalog. +- `--input_catalog_name TEXT`: Input catalog name for the flux standard star catalog. +- `--rename-cols TEXT`: Dictionary to rename columns (e.g., '{"fstar_gaia": "is_fstar_gaia"}'). +- `--format [feather|parquet]`: File format of the output data file. [default: parquet] +- `--help`: Show this message and exit. --- @@ -198,15 +198,15 @@ $ pfs-targetdb-cli diagram [OPTIONS] **Options**: -* `-c, --config TEXT`: Database configuration file in the TOML format. [required] -* `--generator [schemacrawler|tbls]`: Program to generate ER diagram. [default: schemacrawler] -* `--output-dir TEXT`: Directory path to save output files. [default: diagram] -* `--title TEXT`: Title of the ER diagram. [default: PFS Target Database] -* `--sc-info-level TEXT`: SchemaCrawler info level. [default: maximum] -* `--sc-level-level TEXT`: SchemaCrawler log level. [default: SEVERE] -* `--sc-outprefix TEXT`: Output file prefix. [default: erdiagram_targetdb] -* `--tbls-format TEXT`: tbls format for ER diagrams. [default: mermaid] -* `--help`: Show this message and exit. +- `-c, --config TEXT`: Database configuration file in the TOML format. [required] +- `--generator [schemacrawler|tbls]`: Program to generate ER diagram. [default: schemacrawler] +- `--output-dir TEXT`: Directory path to save output files. [default: diagram] +- `--title TEXT`: Title of the ER diagram. [default: PFS Target Database] +- `--sc-info-level TEXT`: SchemaCrawler info level. [default: maximum] +- `--sc-level-level TEXT`: SchemaCrawler log level. [default: SEVERE] +- `--sc-outprefix TEXT`: Output file prefix. [default: erdiagram_targetdb] +- `--tbls-format TEXT`: tbls format for ER diagrams. [default: mermaid] +- `--help`: Show this message and exit. --- @@ -222,8 +222,8 @@ $ pfs-targetdb-cli mdtable [OPTIONS] **Options**: -* `-o, --output-file TEXT`: Output file. -* `--help`: Show this message and exit. +- `-o, --output-file TEXT`: Output file. +- `--help`: Show this message and exit. --- @@ -239,19 +239,20 @@ $ pfs-targetdb-cli insert [OPTIONS] INPUT_FILE **Arguments**: -* `INPUT_FILE`: Input file to be inserted to targetdb (CSV, ECSV, Feather, or Parquet format). [required] +- `INPUT_FILE`: Input file to be inserted to targetdb (CSV, ECSV, Feather, or Parquet format). [required] **Options**: -* `-c, --config TEXT`: Database configuration file in the TOML format. [required] -* `-t, --table [filter_name|fluxstd|input_catalog|partner|pfs_arm|proposal|proposal_category|sky|target|target_type|user_pointing]`: Table name to insert rows. [required] -* `--commit`: Commit changes to the database. -* `--fetch`: Fetch data from database a the end. -* `--from-uploader`: Flag to indicate the data is coming from the PFS Target Uploader. Only required for the `target` table. -* `--upload_id TEXT`: Upload ID issued by the PFS Target Uploader. Only required for the `target` table. -* `--proposal_id TEXT`: Proposal ID (e.g., S24B-QT001). Only required for the `target` table. -* `-v, --verbose`: Verbose output. -* `--help`: Show this message and exit. +- `-c, --config TEXT`: Database configuration file in the TOML format. [required] +- `-t, --table [filter_name|fluxstd|input_catalog|partner|pfs_arm|proposal|proposal_category|sky|target|target_type|user_pointing]`: Table name to insert rows. [required] +- `--commit`: Commit changes to the database. +- `--fetch`: Fetch data from database a the end. +- `--from-uploader`: Flag to indicate the data is coming from the PFS Target Uploader. Only required for the `target` table. +- `--flux-type [total|psf]`: Flux type for the flux standard star catalog. [default: total] +- `--upload_id TEXT`: Upload ID issued by the PFS Target Uploader. Only required for the `target` table. +- `--proposal_id TEXT`: Proposal ID (e.g., S24B-QT001). Only required for the `target` table. +- `-v, --verbose`: Verbose output. +- `--help`: Show this message and exit. --- @@ -267,19 +268,19 @@ $ pfs-targetdb-cli update [OPTIONS] INPUT_FILE **Arguments**: -* `INPUT_FILE`: Input file containing data to update records in the PFS Target Database (CSV, ECSV, or Feather formats). [required] +- `INPUT_FILE`: Input file containing data to update records in the PFS Target Database (CSV, ECSV, or Feather formats). [required] **Options**: -* `-c, --config TEXT`: Database configuration file in the TOML format. [required] -* `-t, --table [filter_name|fluxstd|input_catalog|partner|pfs_arm|proposal|proposal_category|sky|target|target_type|user_pointing]`: Table name to update rows. [required] -* `--commit`: Commit changes to the database. -* `--fetch`: Fetch data from database a the end. -* `--from-uploader`: Flag to indicate the data is coming from the PFS Target Uploader. Only required for the `target` table. -* `--upload_id TEXT`: Upload ID issued by the PFS Target Uploader. Only required for the `target` table -* `--proposal_id TEXT`: Proposal ID (e.g., S24B-QT001). Only required for the `target` table -* `--verbose`: Verbose output. -* `--help`: Show this message and exit. +- `-c, --config TEXT`: Database configuration file in the TOML format. [required] +- `-t, --table [filter_name|fluxstd|input_catalog|partner|pfs_arm|proposal|proposal_category|sky|target|target_type|user_pointing]`: Table name to update rows. [required] +- `--commit`: Commit changes to the database. +- `--fetch`: Fetch data from database a the end. +- `--from-uploader`: Flag to indicate the data is coming from the PFS Target Uploader. Only required for the `target` table. +- `--upload_id TEXT`: Upload ID issued by the PFS Target Uploader. Only required for the `target` table +- `--proposal_id TEXT`: Proposal ID (e.g., S24B-QT001). Only required for the `target` table +- `--verbose`: Verbose output. +- `--help`: Show this message and exit. --- @@ -295,13 +296,13 @@ $ pfs-targetdb-cli parse-alloc [OPTIONS] INPUT_FILE **Arguments**: -* `INPUT_FILE`: Path to the Excel file containing time allocation information (e.g., "allocations.xlsx"). [required] +- `INPUT_FILE`: Path to the Excel file containing time allocation information (e.g., "allocations.xlsx"). [required] **Options**: -* `--output-dir PATH`: Directory path to save output files. [default: .] -* `--outfile-prefix TEXT`: Prefix to the output files. -* `--help`: Show this message and exit. +- `--output-dir PATH`: Directory path to save output files. [default: .] +- `--outfile-prefix TEXT`: Prefix to the output files. +- `--help`: Show this message and exit. --- @@ -317,14 +318,14 @@ $ pfs-targetdb-cli transfer-targets [OPTIONS] INPUT_FILE **Arguments**: -* `INPUT_FILE`: Input catalog list file (csv). [required] +- `INPUT_FILE`: Input catalog list file (csv). [required] **Options**: -* `-c, --config TEXT`: Database configuration file in the TOML format. [required] -* `--local-dir PATH`: Path to the data directory in the local machine [default: .] -* `--force / --no-force`: Force download. [default: no-force] -* `--help`: Show this message and exit. +- `-c, --config TEXT`: Database configuration file in the TOML format. [required] +- `--local-dir PATH`: Path to the data directory in the local machine [default: .] +- `--force / --no-force`: Force download. [default: no-force] +- `--help`: Show this message and exit. --- @@ -340,16 +341,17 @@ $ pfs-targetdb-cli insert-targets [OPTIONS] INPUT_CATALOGS **Arguments**: -* `INPUT_CATALOGS`: Input catalog list to insert (csv). [required] +- `INPUT_CATALOGS`: Input catalog list to insert (csv). [required] **Options**: -* `-c, --config TEXT`: Database configuration file in the TOML format. [required] -* `--data-dir PATH`: Path to the data directory. [default: .] -* `--commit`: Commit changes to the database. -* `--fetch`: Fetch data from database a the end. -* `-v, --verbose`: Verbose output. -* `--help`: Show this message and exit. +- `-c, --config TEXT`: Database configuration file in the TOML format. [required] +- `--data-dir PATH`: Path to the data directory. [default: .] +- `--flux-type [total|psf]`: Flux type for the flux standard star catalog. [default: total] +- `--commit`: Commit changes to the database. +- `--fetch`: Fetch data from database a the end. +- `-v, --verbose`: Verbose output. +- `--help`: Show this message and exit. --- @@ -365,16 +367,16 @@ $ pfs-targetdb-cli insert-pointings [OPTIONS] INPUT_CATALOGS **Arguments**: -* `INPUT_CATALOGS`: Input catalog list to insert (csv). [required] +- `INPUT_CATALOGS`: Input catalog list to insert (csv). [required] **Options**: -* `-c, --config TEXT`: Database configuration file in the TOML format. [required] -* `--data-dir PATH`: Path to the data directory. [default: .] -* `--commit`: Commit changes to the database. -* `--fetch`: Fetch data from database a the end. -* `-v, --verbose`: Verbose output. -* `--help`: Show this message and exit. +- `-c, --config TEXT`: Database configuration file in the TOML format. [required] +- `--data-dir PATH`: Path to the data directory. [default: .] +- `--commit`: Commit changes to the database. +- `--fetch`: Fetch data from database a the end. +- `-v, --verbose`: Verbose output. +- `--help`: Show this message and exit. --- @@ -390,12 +392,12 @@ $ pfs-targetdb-cli update-catalog-active [OPTIONS] INPUT_CATALOG_ID ACTIVE_FLAG **Arguments**: -* `INPUT_CATALOG_ID`: Input catalog ID to be updated. [required] -* `ACTIVE_FLAG`: Active flag to be set. [required] +- `INPUT_CATALOG_ID`: Input catalog ID to be updated. [required] +- `ACTIVE_FLAG`: Active flag to be set. [required] **Options**: -* `-c, --config TEXT`: Database configuration file in the TOML format. [required] -* `--commit`: Commit changes to the database. -* `-v, --verbose`: Verbose output. -* `--help`: Show this message and exit. +- `-c, --config TEXT`: Database configuration file in the TOML format. [required] +- `--commit`: Commit changes to the database. +- `-v, --verbose`: Verbose output. +- `--help`: Show this message and exit. diff --git a/docs/schema/target.md b/docs/schema/target.md index 541e7d0..9c6d5ce 100644 --- a/docs/schema/target.md +++ b/docs/schema/target.md @@ -54,6 +54,18 @@ Here are the columns in the `target` table: | 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 | (\*) | | +| total_flux_g | float | Total flux in _g_-band | nJy | (\*) | | +| total_flux_r | float | Total flux in _r_-band | nJy | (\*) | | +| total_flux_i | float | Total flux in _i_-band | nJy | (\*) | | +| total_flux_z | float | Total flux in _z_-band | nJy | (\*) | | +| total_flux_y | float | Total flux in _y_-band | nJy | (\*) | | +| total_flux_j | float | Total flux in _j_-band | nJy | (\*) | | +| total_flux_error_g | float | Error in total flux in _g_-band | nJy | (\*) | | +| total_flux_error_r | float | Error in total flux in _r_-band | nJy | (\*) | | +| total_flux_error_i | float | Error in total flux in _i_-band | nJy | (\*) | | +| total_flux_error_z | float | Error in total flux in _z_-band | nJy | (\*) | | +| total_flux_error_y | float | Error in total flux in _y_-band | nJy | (\*) | | +| total_flux_error_j | float | Error in total flux in _j_-band | nJy | (\*) | | | 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 | | (\*) | | diff --git a/docs/tbls/README.md b/docs/tbls/README.md index b15a707..3bd761b 100644 --- a/docs/tbls/README.md +++ b/docs/tbls/README.md @@ -4,17 +4,18 @@ | Name | Columns | Comment | Type | | ---- | ------- | ------- | ---- | +| [public.alembic_version](public.alembic_version.md) | 1 | | BASE TABLE | +| [public.cluster](public.cluster.md) | 10 | | BASE TABLE | | [public.filter_name](public.filter_name.md) | 4 | | BASE TABLE | +| [public.fluxstd](public.fluxstd.md) | 61 | | BASE TABLE | +| [public.input_catalog](public.input_catalog.md) | 9 | | BASE TABLE | | [public.pfs_arm](public.pfs_arm.md) | 4 | | BASE TABLE | +| [public.proposal](public.proposal.md) | 15 | | BASE TABLE | | [public.proposal_category](public.proposal_category.md) | 5 | | BASE TABLE | -| [public.input_catalog](public.input_catalog.md) | 9 | | BASE TABLE | +| [public.sky](public.sky.md) | 14 | | BASE TABLE | +| [public.target](public.target.md) | 73 | | BASE TABLE | | [public.target_type](public.target_type.md) | 5 | | BASE TABLE | | [public.user_pointing](public.user_pointing.md) | 10 | | BASE TABLE | -| [public.proposal](public.proposal.md) | 14 | | BASE TABLE | -| [public.sky](public.sky.md) | 14 | | BASE TABLE | -| [public.fluxstd](public.fluxstd.md) | 61 | | BASE TABLE | -| [public.target](public.target.md) | 61 | | BASE TABLE | -| [public.cluster](public.cluster.md) | 10 | | BASE TABLE | | [public.partner](public.partner.md) | 5 | | BASE TABLE | ## Stored procedures and functions @@ -55,6 +56,12 @@ | public.q3c_poly_query | bool | real, real, double precision[] | FUNCTION | | public.q3c_poly_query | bool | double precision, double precision, polygon | FUNCTION | | public.q3c_poly_query | bool | real, real, polygon | FUNCTION | +| public.bt_index_check | void | index regclass | FUNCTION | +| public.bt_index_parent_check | void | index regclass | FUNCTION | +| public.bt_index_check | void | index regclass, heapallindexed boolean | FUNCTION | +| public.bt_index_parent_check | void | index regclass, heapallindexed boolean | FUNCTION | +| public.bt_index_parent_check | void | index regclass, heapallindexed boolean, rootdescend boolean | FUNCTION | +| public.verify_heapam | record | relation regclass, on_error_stop boolean DEFAULT false, check_toast boolean DEFAULT false, skip text DEFAULT 'none'::text, startblock bigint DEFAULT NULL::bigint, endblock bigint DEFAULT NULL::bigint, OUT blkno bigint, OUT offnum integer, OUT attnum integer, OUT msg text | FUNCTION | ## Enums @@ -67,10 +74,8 @@ ```mermaid erDiagram -"public.user_pointing" }o--|| "public.input_catalog" : "FOREIGN KEY (input_catalog_id) REFERENCES input_catalog(input_catalog_id)" -"public.proposal" }o--o| "public.proposal_category" : "FOREIGN KEY (proposal_category_id) REFERENCES proposal_category(proposal_category_id)" -"public.sky" }o--|| "public.input_catalog" : "FOREIGN KEY (input_catalog_id) REFERENCES input_catalog(input_catalog_id)" -"public.sky" }o--o| "public.target_type" : "FOREIGN KEY (target_type_id) REFERENCES target_type(target_type_id)" +"public.cluster" }o--o| "public.input_catalog" : "FOREIGN KEY (input_catalog_id) REFERENCES input_catalog(input_catalog_id)" +"public.cluster" }o--|| "public.target" : "FOREIGN KEY (target_id) REFERENCES target(target_id)" "public.fluxstd" }o--o| "public.filter_name" : "FOREIGN KEY (filter_g) REFERENCES filter_name(filter_name)" "public.fluxstd" }o--o| "public.filter_name" : "FOREIGN KEY (filter_i) REFERENCES filter_name(filter_name)" "public.fluxstd" }o--o| "public.filter_name" : "FOREIGN KEY (filter_j) REFERENCES filter_name(filter_name)" @@ -79,97 +84,40 @@ erDiagram "public.fluxstd" }o--o| "public.filter_name" : "FOREIGN KEY (filter_z) REFERENCES filter_name(filter_name)" "public.fluxstd" }o--|| "public.input_catalog" : "FOREIGN KEY (input_catalog_id) REFERENCES input_catalog(input_catalog_id)" "public.fluxstd" }o--o| "public.target_type" : "FOREIGN KEY (target_type_id) REFERENCES target_type(target_type_id)" +"public.proposal" }o--o| "public.proposal_category" : "FOREIGN KEY (proposal_category_id) REFERENCES proposal_category(proposal_category_id)" +"public.proposal" }o--o| "public.partner" : "FOREIGN KEY (partner_id) REFERENCES partner(partner_id)" +"public.sky" }o--|| "public.input_catalog" : "FOREIGN KEY (input_catalog_id) REFERENCES input_catalog(input_catalog_id)" +"public.sky" }o--o| "public.target_type" : "FOREIGN KEY (target_type_id) REFERENCES target_type(target_type_id)" "public.target" }o--o| "public.filter_name" : "FOREIGN KEY (filter_g) REFERENCES filter_name(filter_name)" "public.target" }o--o| "public.filter_name" : "FOREIGN KEY (filter_i) REFERENCES filter_name(filter_name)" "public.target" }o--o| "public.filter_name" : "FOREIGN KEY (filter_j) REFERENCES filter_name(filter_name)" "public.target" }o--o| "public.filter_name" : "FOREIGN KEY (filter_r) REFERENCES filter_name(filter_name)" "public.target" }o--o| "public.filter_name" : "FOREIGN KEY (filter_y) REFERENCES filter_name(filter_name)" "public.target" }o--o| "public.filter_name" : "FOREIGN KEY (filter_z) REFERENCES filter_name(filter_name)" -"public.target" }o--o| "public.pfs_arm" : "FOREIGN KEY (qa_reference_arm) REFERENCES pfs_arm(name)" "public.target" }o--|| "public.input_catalog" : "FOREIGN KEY (input_catalog_id) REFERENCES input_catalog(input_catalog_id)" -"public.target" }o--o| "public.target_type" : "FOREIGN KEY (target_type_id) REFERENCES target_type(target_type_id)" +"public.target" }o--o| "public.pfs_arm" : "FOREIGN KEY (qa_reference_arm) REFERENCES pfs_arm(name)" "public.target" }o--o| "public.proposal" : "FOREIGN KEY (proposal_id) REFERENCES proposal(proposal_id)" -"public.cluster" }o--o| "public.input_catalog" : "FOREIGN KEY (input_catalog_id) REFERENCES input_catalog(input_catalog_id)" -"public.cluster" }o--|| "public.target" : "FOREIGN KEY (target_id) REFERENCES target(target_id)" +"public.target" }o--o| "public.target_type" : "FOREIGN KEY (target_type_id) REFERENCES target_type(target_type_id)" +"public.user_pointing" }o--|| "public.input_catalog" : "FOREIGN KEY (input_catalog_id) REFERENCES input_catalog(input_catalog_id)" -"public.filter_name" { - varchar filter_name - varchar filter_name_description - timestamp_without_time_zone created_at - timestamp_without_time_zone updated_at +"public.alembic_version" { + varchar_32_ version_num } -"public.pfs_arm" { - varchar name - varchar description - timestamp_without_time_zone created_at - timestamp_without_time_zone updated_at -} -"public.proposal_category" { - integer proposal_category_id - varchar proposal_category_name - varchar proposal_category_description - timestamp_without_time_zone created_at - timestamp_without_time_zone updated_at -} -"public.input_catalog" { - integer input_catalog_id - varchar input_catalog_name - varchar input_catalog_description - varchar_16_ upload_id - boolean active - boolean is_classical - boolean is_user_pointing - timestamp_without_time_zone created_at - timestamp_without_time_zone updated_at -} -"public.target_type" { - integer target_type_id - varchar target_type_name - varchar target_type_description - timestamp_without_time_zone created_at - timestamp_without_time_zone updated_at -} -"public.user_pointing" { - bigint user_pointing_id - varchar ppc_code - double_precision ppc_ra - double_precision ppc_dec - double_precision ppc_pa - resolutionmode ppc_resolution - double_precision ppc_priority +"public.cluster" { + bigint cluster_id + bigint target_id FK + integer n_targets + double_precision ra_cluster + double_precision dec_cluster + double_precision d_ra + double_precision d_dec integer input_catalog_id FK timestamp_without_time_zone created_at timestamp_without_time_zone updated_at } -"public.proposal" { - varchar proposal_id - varchar group_id - varchar pi_first_name - varchar pi_last_name - varchar pi_middle_name - double_precision rank - varchar grade - double_precision allocated_time_total - double_precision allocated_time_lr - double_precision allocated_time_mr - integer proposal_category_id FK - boolean is_too - timestamp_without_time_zone created_at - timestamp_without_time_zone updated_at -} -"public.sky" { - bigint sky_id - bigint obj_id - varchar obj_id_orig - double_precision ra - double_precision dec - varchar epoch - integer tract - integer patch - integer target_type_id FK - integer input_catalog_id FK - double_precision mag_thresh - varchar version +"public.filter_name" { + varchar filter_name + varchar filter_name_description timestamp_without_time_zone created_at timestamp_without_time_zone updated_at } @@ -195,33 +143,36 @@ erDiagram double_precision psf_mag_z double_precision psf_mag_y double_precision psf_mag_j - double_precision psf_mag_error_g - double_precision psf_mag_error_r - double_precision psf_mag_error_i - double_precision psf_mag_error_z - double_precision psf_mag_error_y - double_precision psf_mag_error_j double_precision psf_flux_g double_precision psf_flux_r double_precision psf_flux_i double_precision psf_flux_z double_precision psf_flux_y double_precision psf_flux_j - double_precision psf_flux_error_g - double_precision psf_flux_error_r - double_precision psf_flux_error_i - double_precision psf_flux_error_z - double_precision psf_flux_error_y - double_precision psf_flux_error_j + double_precision prob_f_star + boolean flags_dist + boolean flags_ebv + varchar version + timestamp_without_time_zone created_at + timestamp_without_time_zone updated_at varchar filter_g FK varchar filter_r FK varchar filter_i FK varchar filter_z FK varchar filter_y FK varchar filter_j FK - double_precision prob_f_star - boolean flags_dist - boolean flags_ebv + double_precision psf_mag_error_g + double_precision psf_mag_error_r + double_precision psf_mag_error_i + double_precision psf_mag_error_z + double_precision psf_mag_error_y + double_precision psf_mag_error_j + double_precision psf_flux_error_g + double_precision psf_flux_error_r + double_precision psf_flux_error_i + double_precision psf_flux_error_z + double_precision psf_flux_error_y + double_precision psf_flux_error_j double_precision teff_brutus double_precision teff_brutus_low double_precision teff_brutus_high @@ -232,6 +183,60 @@ erDiagram double_precision teff_gspphot_lower double_precision teff_gspphot_upper boolean is_fstar_gaia +} +"public.input_catalog" { + varchar input_catalog_name + varchar input_catalog_description + timestamp_without_time_zone created_at + timestamp_without_time_zone updated_at + varchar_16_ upload_id + integer input_catalog_id + boolean active + boolean is_classical + boolean is_user_pointing +} +"public.pfs_arm" { + varchar name + varchar description + timestamp_without_time_zone created_at + timestamp_without_time_zone updated_at +} +"public.proposal" { + varchar proposal_id + varchar group_id + varchar pi_first_name + varchar pi_last_name + varchar pi_middle_name + double_precision rank + varchar grade + double_precision allocated_time_total + integer proposal_category_id FK + timestamp_without_time_zone created_at + timestamp_without_time_zone updated_at + double_precision allocated_time_lr + double_precision allocated_time_mr + boolean is_too + integer partner_id FK +} +"public.proposal_category" { + integer proposal_category_id + varchar proposal_category_name + varchar proposal_category_description + timestamp_without_time_zone created_at + timestamp_without_time_zone updated_at +} +"public.sky" { + bigint sky_id + bigint obj_id + varchar obj_id_orig + double_precision ra + double_precision dec + varchar epoch + integer tract + integer patch + integer target_type_id FK + integer input_catalog_id FK + double_precision mag_thresh varchar version timestamp_without_time_zone created_at timestamp_without_time_zone updated_at @@ -239,7 +244,6 @@ erDiagram "public.target" { bigint target_id varchar proposal_id FK - varchar ob_code bigint obj_id double_precision ra double_precision dec @@ -263,50 +267,70 @@ erDiagram double_precision psf_mag_z double_precision psf_mag_y double_precision psf_mag_j - double_precision psf_mag_error_g - double_precision psf_mag_error_r - double_precision psf_mag_error_i - double_precision psf_mag_error_z - double_precision psf_mag_error_y - double_precision psf_mag_error_j double_precision psf_flux_g double_precision psf_flux_r double_precision psf_flux_i double_precision psf_flux_z double_precision psf_flux_y double_precision psf_flux_j - double_precision psf_flux_error_g - double_precision psf_flux_error_r - double_precision psf_flux_error_i - double_precision psf_flux_error_z - double_precision psf_flux_error_y - double_precision psf_flux_error_j + double_precision priority + double_precision effective_exptime + boolean is_medium_resolution + double_precision qa_relative_throughput + double_precision qa_relative_noise + double_precision qa_reference_lambda + boolean is_cluster + timestamp_without_time_zone created_at + timestamp_without_time_zone updated_at varchar filter_g FK varchar filter_r FK varchar filter_i FK varchar filter_z FK varchar filter_y FK varchar filter_j FK - double_precision priority - double_precision effective_exptime + double_precision psf_mag_error_g + double_precision psf_mag_error_r + double_precision psf_mag_error_i + double_precision psf_mag_error_z + double_precision psf_mag_error_y + double_precision psf_mag_error_j + double_precision psf_flux_error_g + double_precision psf_flux_error_r + double_precision psf_flux_error_i + double_precision psf_flux_error_z + double_precision psf_flux_error_y + double_precision psf_flux_error_j + varchar ob_code double_precision single_exptime - boolean is_medium_resolution - double_precision qa_relative_throughput - double_precision qa_relative_noise - double_precision qa_reference_lambda varchar qa_reference_arm FK - boolean is_cluster + double_precision total_flux_g + double_precision total_flux_r + double_precision total_flux_i + double_precision total_flux_z + double_precision total_flux_y + double_precision total_flux_j + double_precision total_flux_error_g + double_precision total_flux_error_r + double_precision total_flux_error_i + double_precision total_flux_error_z + double_precision total_flux_error_y + double_precision total_flux_error_j +} +"public.target_type" { + integer target_type_id + varchar target_type_name + varchar target_type_description timestamp_without_time_zone created_at timestamp_without_time_zone updated_at } -"public.cluster" { - bigint cluster_id - bigint target_id FK - integer n_targets - double_precision ra_cluster - double_precision dec_cluster - double_precision d_ra - double_precision d_dec +"public.user_pointing" { + bigint user_pointing_id + varchar ppc_code + double_precision ppc_ra + double_precision ppc_dec + double_precision ppc_pa + resolutionmode ppc_resolution + double_precision ppc_priority integer input_catalog_id FK timestamp_without_time_zone created_at timestamp_without_time_zone updated_at diff --git a/docs/tbls/public.alembic_version.md b/docs/tbls/public.alembic_version.md new file mode 100644 index 0000000..b41fd16 --- /dev/null +++ b/docs/tbls/public.alembic_version.md @@ -0,0 +1,36 @@ +# public.alembic_version + +## Description + +## Columns + +| Name | Type | Default | Nullable | Children | Parents | Comment | +| ---- | ---- | ------- | -------- | -------- | ------- | ------- | +| version_num | varchar(32) | | false | | | | + +## Constraints + +| Name | Type | Definition | +| ---- | ---- | ---------- | +| alembic_version_pkc | PRIMARY KEY | PRIMARY KEY (version_num) | + +## Indexes + +| Name | Definition | +| ---- | ---------- | +| alembic_version_pkc | CREATE UNIQUE INDEX alembic_version_pkc ON public.alembic_version USING btree (version_num) | + +## Relations + +```mermaid +erDiagram + + +"public.alembic_version" { + varchar_32_ version_num +} +``` + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/docs/tbls/public.cluster.md b/docs/tbls/public.cluster.md index f4187a7..d1eaf23 100644 --- a/docs/tbls/public.cluster.md +++ b/docs/tbls/public.cluster.md @@ -21,14 +21,16 @@ | Name | Type | Definition | | ---- | ---- | ---------- | +| cluster_cluster_id_target_id_key | UNIQUE | UNIQUE (cluster_id, target_id) | +| cluster_pkey | PRIMARY KEY | PRIMARY KEY (cluster_id, target_id) | | cluster_input_catalog_id_fkey | FOREIGN KEY | FOREIGN KEY (input_catalog_id) REFERENCES input_catalog(input_catalog_id) | | cluster_target_id_fkey | FOREIGN KEY | FOREIGN KEY (target_id) REFERENCES target(target_id) | -| cluster_pkey | PRIMARY KEY | PRIMARY KEY (cluster_id, target_id) | ## Indexes | Name | Definition | | ---- | ---------- | +| cluster_cluster_id_target_id_key | CREATE UNIQUE INDEX cluster_cluster_id_target_id_key ON public.cluster USING btree (cluster_id, target_id) | | cluster_pkey | CREATE UNIQUE INDEX cluster_pkey ON public.cluster USING btree (cluster_id, target_id) | ## Relations @@ -54,7 +56,6 @@ erDiagram "public.target" { bigint target_id varchar proposal_id FK - varchar ob_code bigint obj_id double_precision ra double_precision dec @@ -78,52 +79,65 @@ erDiagram double_precision psf_mag_z double_precision psf_mag_y double_precision psf_mag_j - double_precision psf_mag_error_g - double_precision psf_mag_error_r - double_precision psf_mag_error_i - double_precision psf_mag_error_z - double_precision psf_mag_error_y - double_precision psf_mag_error_j double_precision psf_flux_g double_precision psf_flux_r double_precision psf_flux_i double_precision psf_flux_z double_precision psf_flux_y double_precision psf_flux_j - double_precision psf_flux_error_g - double_precision psf_flux_error_r - double_precision psf_flux_error_i - double_precision psf_flux_error_z - double_precision psf_flux_error_y - double_precision psf_flux_error_j - varchar filter_g FK - varchar filter_r FK - varchar filter_i FK - varchar filter_z FK - varchar filter_y FK - 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 double_precision qa_reference_lambda - varchar qa_reference_arm FK boolean is_cluster timestamp_without_time_zone created_at timestamp_without_time_zone updated_at + varchar filter_g FK + varchar filter_r FK + varchar filter_i FK + varchar filter_z FK + varchar filter_y FK + varchar filter_j FK + double_precision psf_mag_error_g + double_precision psf_mag_error_r + double_precision psf_mag_error_i + double_precision psf_mag_error_z + double_precision psf_mag_error_y + double_precision psf_mag_error_j + double_precision psf_flux_error_g + double_precision psf_flux_error_r + double_precision psf_flux_error_i + double_precision psf_flux_error_z + double_precision psf_flux_error_y + double_precision psf_flux_error_j + varchar ob_code + double_precision single_exptime + varchar qa_reference_arm FK + double_precision total_flux_g + double_precision total_flux_r + double_precision total_flux_i + double_precision total_flux_z + double_precision total_flux_y + double_precision total_flux_j + double_precision total_flux_error_g + double_precision total_flux_error_r + double_precision total_flux_error_i + double_precision total_flux_error_z + double_precision total_flux_error_y + double_precision total_flux_error_j } "public.input_catalog" { - integer input_catalog_id varchar input_catalog_name varchar input_catalog_description + timestamp_without_time_zone created_at + timestamp_without_time_zone updated_at varchar_16_ upload_id + integer input_catalog_id boolean active boolean is_classical boolean is_user_pointing - timestamp_without_time_zone created_at - timestamp_without_time_zone updated_at } ``` diff --git a/docs/tbls/public.filter_name.md b/docs/tbls/public.filter_name.md index 2590c98..1918eeb 100644 --- a/docs/tbls/public.filter_name.md +++ b/docs/tbls/public.filter_name.md @@ -15,12 +15,14 @@ | Name | Type | Definition | | ---- | ---- | ---------- | +| filter_name_filter_name_key | UNIQUE | UNIQUE (filter_name) | | filter_name_pkey | PRIMARY KEY | PRIMARY KEY (filter_name) | ## Indexes | Name | Definition | | ---- | ---------- | +| filter_name_filter_name_key | CREATE UNIQUE INDEX filter_name_filter_name_key ON public.filter_name USING btree (filter_name) | | filter_name_pkey | CREATE UNIQUE INDEX filter_name_pkey ON public.filter_name USING btree (filter_name) | ## Relations @@ -69,33 +71,36 @@ erDiagram double_precision psf_mag_z double_precision psf_mag_y double_precision psf_mag_j - double_precision psf_mag_error_g - double_precision psf_mag_error_r - double_precision psf_mag_error_i - double_precision psf_mag_error_z - double_precision psf_mag_error_y - double_precision psf_mag_error_j double_precision psf_flux_g double_precision psf_flux_r double_precision psf_flux_i double_precision psf_flux_z double_precision psf_flux_y double_precision psf_flux_j - double_precision psf_flux_error_g - double_precision psf_flux_error_r - double_precision psf_flux_error_i - double_precision psf_flux_error_z - double_precision psf_flux_error_y - double_precision psf_flux_error_j + double_precision prob_f_star + boolean flags_dist + boolean flags_ebv + varchar version + timestamp_without_time_zone created_at + timestamp_without_time_zone updated_at varchar filter_g FK varchar filter_r FK varchar filter_i FK varchar filter_z FK varchar filter_y FK varchar filter_j FK - double_precision prob_f_star - boolean flags_dist - boolean flags_ebv + double_precision psf_mag_error_g + double_precision psf_mag_error_r + double_precision psf_mag_error_i + double_precision psf_mag_error_z + double_precision psf_mag_error_y + double_precision psf_mag_error_j + double_precision psf_flux_error_g + double_precision psf_flux_error_r + double_precision psf_flux_error_i + double_precision psf_flux_error_z + double_precision psf_flux_error_y + double_precision psf_flux_error_j double_precision teff_brutus double_precision teff_brutus_low double_precision teff_brutus_high @@ -106,14 +111,10 @@ erDiagram double_precision teff_gspphot_lower double_precision teff_gspphot_upper boolean is_fstar_gaia - varchar version - timestamp_without_time_zone created_at - timestamp_without_time_zone updated_at } "public.target" { bigint target_id varchar proposal_id FK - varchar ob_code bigint obj_id double_precision ra double_precision dec @@ -137,41 +138,54 @@ erDiagram double_precision psf_mag_z double_precision psf_mag_y double_precision psf_mag_j - double_precision psf_mag_error_g - double_precision psf_mag_error_r - double_precision psf_mag_error_i - double_precision psf_mag_error_z - double_precision psf_mag_error_y - double_precision psf_mag_error_j double_precision psf_flux_g double_precision psf_flux_r double_precision psf_flux_i double_precision psf_flux_z double_precision psf_flux_y double_precision psf_flux_j - double_precision psf_flux_error_g - double_precision psf_flux_error_r - double_precision psf_flux_error_i - double_precision psf_flux_error_z - double_precision psf_flux_error_y - double_precision psf_flux_error_j - varchar filter_g FK - varchar filter_r FK - varchar filter_i FK - varchar filter_z FK - varchar filter_y FK - 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 double_precision qa_reference_lambda - varchar qa_reference_arm FK boolean is_cluster timestamp_without_time_zone created_at timestamp_without_time_zone updated_at + varchar filter_g FK + varchar filter_r FK + varchar filter_i FK + varchar filter_z FK + varchar filter_y FK + varchar filter_j FK + double_precision psf_mag_error_g + double_precision psf_mag_error_r + double_precision psf_mag_error_i + double_precision psf_mag_error_z + double_precision psf_mag_error_y + double_precision psf_mag_error_j + double_precision psf_flux_error_g + double_precision psf_flux_error_r + double_precision psf_flux_error_i + double_precision psf_flux_error_z + double_precision psf_flux_error_y + double_precision psf_flux_error_j + varchar ob_code + double_precision single_exptime + varchar qa_reference_arm FK + double_precision total_flux_g + double_precision total_flux_r + double_precision total_flux_i + double_precision total_flux_z + double_precision total_flux_y + double_precision total_flux_j + double_precision total_flux_error_g + double_precision total_flux_error_r + double_precision total_flux_error_i + double_precision total_flux_error_z + double_precision total_flux_error_y + double_precision total_flux_error_j } ``` diff --git a/docs/tbls/public.fluxstd.md b/docs/tbls/public.fluxstd.md index 6eb58ac..ba48566 100644 --- a/docs/tbls/public.fluxstd.md +++ b/docs/tbls/public.fluxstd.md @@ -27,33 +27,36 @@ | psf_mag_z | double precision | | true | | | z-band PSF magnitude (AB mag) | | psf_mag_y | double precision | | true | | | y-band PSF magnitude (AB mag) | | psf_mag_j | double precision | | true | | | J band PSF magnitude (AB mag) | -| psf_mag_error_g | double precision | | true | | | Error in g-band PSF magnitude (AB mag) | -| psf_mag_error_r | double precision | | true | | | Error in r-band PSF magnitude (AB mag) | -| psf_mag_error_i | double precision | | true | | | Error in i-band PSF magnitude (AB mag) | -| psf_mag_error_z | double precision | | true | | | Error in z-band PSF magnitude (AB mag) | -| psf_mag_error_y | double precision | | true | | | Error in y-band PSF magnitude (AB mag) | -| psf_mag_error_j | double precision | | true | | | Error in J band PSF magnitude (AB mag) | | psf_flux_g | double precision | | true | | | g-band PSF flux (nJy) | | psf_flux_r | double precision | | true | | | r-band PSF flux (nJy) | | psf_flux_i | double precision | | true | | | i-band PSF flux (nJy) | | psf_flux_z | double precision | | true | | | z-band PSF flux (nJy) | | psf_flux_y | double precision | | true | | | y-band PSF flux (nJy) | | psf_flux_j | double precision | | true | | | J band PSF flux (nJy) | -| psf_flux_error_g | double precision | | true | | | Error in g-band PSF flux (nJy) | -| psf_flux_error_r | double precision | | true | | | Error in r-band PSF flux (nJy) | -| psf_flux_error_i | double precision | | true | | | Error in i-band PSF flux (nJy) | -| psf_flux_error_z | double precision | | true | | | Error in z-band PSF flux (nJy) | -| psf_flux_error_y | double precision | | true | | | Error in y-band PSF flux (nJy) | -| psf_flux_error_j | double precision | | true | | | Error in J band PSF flux (nJy) | +| prob_f_star | double precision | | true | | | Probability of being an F-type star | +| flags_dist | boolean | | true | | | Distance uncertanty flag, True if parallax_error/parallax \> 0.2 | +| flags_ebv | boolean | | true | | | E(B-V) uncertainty flag, True if E(B-V) uncertainty is greater than 20% | +| version | varchar | | false | | | Version string of the F-star selection | +| created_at | timestamp without time zone | timezone('utc'::text, CURRENT_TIMESTAMP) | true | | | The date and time in UTC when the record was created | +| updated_at | timestamp without time zone | | true | | | The date and time in UTC when the record was last updated | | filter_g | varchar | | true | | [public.filter_name](public.filter_name.md) | g-band filter (g_hsc, g_ps1, g_sdss, etc.) | | filter_r | varchar | | true | | [public.filter_name](public.filter_name.md) | r-band filter (r_hsc, r_ps1, r_sdss, etc.) | | filter_i | varchar | | true | | [public.filter_name](public.filter_name.md) | i-band filter (i_hsc, i_ps1, i_sdss, etc.) | | filter_z | varchar | | true | | [public.filter_name](public.filter_name.md) | z-band filter (z_hsc, z_ps1, z_sdss, etc.) | | filter_y | varchar | | true | | [public.filter_name](public.filter_name.md) | y-band filter (y_hsc, y_ps1, y_sdss, etc.) | | filter_j | varchar | | true | | [public.filter_name](public.filter_name.md) | j-band filter (j_mko, etc.) | -| prob_f_star | double precision | | true | | | Probability of being an F-type star | -| flags_dist | boolean | | true | | | Distance uncertanty flag, True if parallax_error/parallax > 0.2 | -| flags_ebv | boolean | | true | | | E(B-V) uncertainty flag, True if E(B-V) uncertainty is greater than 20% | +| psf_mag_error_g | double precision | | true | | | Error in g-band PSF magnitude (AB mag) | +| psf_mag_error_r | double precision | | true | | | Error in r-band PSF magnitude (AB mag) | +| psf_mag_error_i | double precision | | true | | | Error in i-band PSF magnitude (AB mag) | +| psf_mag_error_z | double precision | | true | | | Error in z-band PSF magnitude (AB mag) | +| psf_mag_error_y | double precision | | true | | | Error in y-band PSF magnitude (AB mag) | +| psf_mag_error_j | double precision | | true | | | Error in J band PSF magnitude (AB mag) | +| psf_flux_error_g | double precision | | true | | | Error in g-band PSF flux (nJy) | +| psf_flux_error_r | double precision | | true | | | Error in r-band PSF flux (nJy) | +| psf_flux_error_i | double precision | | true | | | Error in i-band PSF flux (nJy) | +| psf_flux_error_z | double precision | | true | | | Error in z-band PSF flux (nJy) | +| psf_flux_error_y | double precision | | true | | | Error in y-band PSF flux (nJy) | +| psf_flux_error_j | double precision | | true | | | Error in J band PSF flux (nJy) | | teff_brutus | double precision | | true | | | Effective temperature from Brutus code [K] | | teff_brutus_low | double precision | | true | | | Lower confidence level (16%) of effective temperature from Brutus code [K] | | teff_brutus_high | double precision | | true | | | Upper confidence level (84%) of effective temperature from Brutus code [K] | @@ -64,9 +67,6 @@ | teff_gspphot_lower | double precision | | true | | | Lower confidence level (16%) of effective temperature inferred by GSP-phot Aeneas [K] | | teff_gspphot_upper | double precision | | true | | | Upper confidence level (84%) of effective temperature inferred by GSP-phot Aeneas [K] | | is_fstar_gaia | boolean | | true | | | Flag for F-star from Gaia (Teff=6000-7500K if True) | -| version | varchar | | false | | | Version string of the F-star selection | -| created_at | timestamp without time zone | timezone('utc'::text, CURRENT_TIMESTAMP) | true | | | The date and time in UTC when the record was created | -| updated_at | timestamp without time zone | | true | | | The date and time in UTC when the record was last updated | ## Constraints @@ -80,6 +80,7 @@ | fluxstd_filter_z_fkey | FOREIGN KEY | FOREIGN KEY (filter_z) REFERENCES filter_name(filter_name) | | fluxstd_input_catalog_id_fkey | FOREIGN KEY | FOREIGN KEY (input_catalog_id) REFERENCES input_catalog(input_catalog_id) | | fluxstd_target_type_id_fkey | FOREIGN KEY | FOREIGN KEY (target_type_id) REFERENCES target_type(target_type_id) | +| fluxstd_fluxstd_id_key | UNIQUE | UNIQUE (fluxstd_id) | | fluxstd_pkey | PRIMARY KEY | PRIMARY KEY (fluxstd_id) | | uq_obj_id_input_catalog_id_version | UNIQUE | UNIQUE (obj_id, input_catalog_id, version) | @@ -87,6 +88,7 @@ | Name | Definition | | ---- | ---------- | +| fluxstd_fluxstd_id_key | CREATE UNIQUE INDEX fluxstd_fluxstd_id_key ON public.fluxstd USING btree (fluxstd_id) | | 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) | | ix_fluxstd_version | CREATE INDEX ix_fluxstd_version ON public.fluxstd USING btree (version) | @@ -128,33 +130,36 @@ erDiagram double_precision psf_mag_z double_precision psf_mag_y double_precision psf_mag_j - double_precision psf_mag_error_g - double_precision psf_mag_error_r - double_precision psf_mag_error_i - double_precision psf_mag_error_z - double_precision psf_mag_error_y - double_precision psf_mag_error_j double_precision psf_flux_g double_precision psf_flux_r double_precision psf_flux_i double_precision psf_flux_z double_precision psf_flux_y double_precision psf_flux_j - double_precision psf_flux_error_g - double_precision psf_flux_error_r - double_precision psf_flux_error_i - double_precision psf_flux_error_z - double_precision psf_flux_error_y - double_precision psf_flux_error_j + double_precision prob_f_star + boolean flags_dist + boolean flags_ebv + varchar version + timestamp_without_time_zone created_at + timestamp_without_time_zone updated_at varchar filter_g FK varchar filter_r FK varchar filter_i FK varchar filter_z FK varchar filter_y FK varchar filter_j FK - double_precision prob_f_star - boolean flags_dist - boolean flags_ebv + double_precision psf_mag_error_g + double_precision psf_mag_error_r + double_precision psf_mag_error_i + double_precision psf_mag_error_z + double_precision psf_mag_error_y + double_precision psf_mag_error_j + double_precision psf_flux_error_g + double_precision psf_flux_error_r + double_precision psf_flux_error_i + double_precision psf_flux_error_z + double_precision psf_flux_error_y + double_precision psf_flux_error_j double_precision teff_brutus double_precision teff_brutus_low double_precision teff_brutus_high @@ -165,9 +170,6 @@ erDiagram double_precision teff_gspphot_lower double_precision teff_gspphot_upper boolean is_fstar_gaia - varchar version - timestamp_without_time_zone created_at - timestamp_without_time_zone updated_at } "public.target_type" { integer target_type_id @@ -177,15 +179,15 @@ erDiagram timestamp_without_time_zone updated_at } "public.input_catalog" { - integer input_catalog_id varchar input_catalog_name varchar input_catalog_description + timestamp_without_time_zone created_at + timestamp_without_time_zone updated_at varchar_16_ upload_id + integer input_catalog_id boolean active boolean is_classical boolean is_user_pointing - timestamp_without_time_zone created_at - timestamp_without_time_zone updated_at } "public.filter_name" { varchar filter_name diff --git a/docs/tbls/public.input_catalog.md b/docs/tbls/public.input_catalog.md index 2cdfa86..f6d07c7 100644 --- a/docs/tbls/public.input_catalog.md +++ b/docs/tbls/public.input_catalog.md @@ -6,26 +6,28 @@ | Name | Type | Default | Nullable | Children | Parents | Comment | | ---- | ---- | ------- | -------- | -------- | ------- | ------- | -| input_catalog_id | integer | | false | [public.user_pointing](public.user_pointing.md) [public.sky](public.sky.md) [public.fluxstd](public.fluxstd.md) [public.target](public.target.md) [public.cluster](public.cluster.md) | | Unique identifier for input catalogs | | input_catalog_name | varchar | | false | | | Name of the input catalog (e.g., Gaia DR2, HSC-SSP PDR3, etc.) | | input_catalog_description | varchar | | true | | | Description of the input catalog | +| created_at | timestamp without time zone | timezone('utc'::text, CURRENT_TIMESTAMP) | true | | | The date and time in UTC when the record was created | +| updated_at | timestamp without time zone | | true | | | The date and time in UTC when the record was last updated | | upload_id | varchar(16) | | true | | | A 8-bit hex string (16 characters) assigned at the submission of the target list (default: empty string) | +| input_catalog_id | integer | | false | [public.cluster](public.cluster.md) [public.fluxstd](public.fluxstd.md) [public.sky](public.sky.md) [public.target](public.target.md) [public.user_pointing](public.user_pointing.md) | | Unique identifier for input catalogs | | active | boolean | | true | | | Flag to indicate if the input catalog is active (default: True) | | is_classical | boolean | | true | | | True if the classical mode is requested | | is_user_pointing | boolean | | true | | | True if user-defined pointings are provided | -| created_at | timestamp without time zone | timezone('utc'::text, CURRENT_TIMESTAMP) | true | | | The date and time in UTC when the record was created | -| updated_at | timestamp without time zone | | true | | | The date and time in UTC when the record was last updated | ## Constraints | Name | Type | Definition | | ---- | ---- | ---------- | +| input_catalog_input_catalog_id_key | UNIQUE | UNIQUE (input_catalog_id) | | input_catalog_pkey | PRIMARY KEY | PRIMARY KEY (input_catalog_id) | ## Indexes | Name | Definition | | ---- | ---------- | +| input_catalog_input_catalog_id_key | CREATE UNIQUE INDEX input_catalog_input_catalog_id_key ON public.input_catalog USING btree (input_catalog_id) | | input_catalog_pkey | CREATE UNIQUE INDEX input_catalog_pkey ON public.input_catalog USING btree (input_catalog_id) | ## Relations @@ -33,48 +35,32 @@ ```mermaid erDiagram -"public.user_pointing" }o--|| "public.input_catalog" : "FOREIGN KEY (input_catalog_id) REFERENCES input_catalog(input_catalog_id)" -"public.sky" }o--|| "public.input_catalog" : "FOREIGN KEY (input_catalog_id) REFERENCES input_catalog(input_catalog_id)" +"public.cluster" }o--o| "public.input_catalog" : "FOREIGN KEY (input_catalog_id) REFERENCES input_catalog(input_catalog_id)" "public.fluxstd" }o--|| "public.input_catalog" : "FOREIGN KEY (input_catalog_id) REFERENCES input_catalog(input_catalog_id)" +"public.sky" }o--|| "public.input_catalog" : "FOREIGN KEY (input_catalog_id) REFERENCES input_catalog(input_catalog_id)" "public.target" }o--|| "public.input_catalog" : "FOREIGN KEY (input_catalog_id) REFERENCES input_catalog(input_catalog_id)" -"public.cluster" }o--o| "public.input_catalog" : "FOREIGN KEY (input_catalog_id) REFERENCES input_catalog(input_catalog_id)" +"public.user_pointing" }o--|| "public.input_catalog" : "FOREIGN KEY (input_catalog_id) REFERENCES input_catalog(input_catalog_id)" "public.input_catalog" { - integer input_catalog_id varchar input_catalog_name varchar input_catalog_description + timestamp_without_time_zone created_at + timestamp_without_time_zone updated_at varchar_16_ upload_id + integer input_catalog_id boolean active boolean is_classical boolean is_user_pointing - timestamp_without_time_zone created_at - timestamp_without_time_zone updated_at -} -"public.user_pointing" { - bigint user_pointing_id - varchar ppc_code - double_precision ppc_ra - double_precision ppc_dec - double_precision ppc_pa - resolutionmode ppc_resolution - double_precision ppc_priority - integer input_catalog_id FK - timestamp_without_time_zone created_at - timestamp_without_time_zone updated_at } -"public.sky" { - bigint sky_id - bigint obj_id - varchar obj_id_orig - double_precision ra - double_precision dec - varchar epoch - integer tract - integer patch - integer target_type_id FK +"public.cluster" { + bigint cluster_id + bigint target_id FK + integer n_targets + double_precision ra_cluster + double_precision dec_cluster + double_precision d_ra + double_precision d_dec integer input_catalog_id FK - double_precision mag_thresh - varchar version timestamp_without_time_zone created_at timestamp_without_time_zone updated_at } @@ -100,33 +86,36 @@ erDiagram double_precision psf_mag_z double_precision psf_mag_y double_precision psf_mag_j - double_precision psf_mag_error_g - double_precision psf_mag_error_r - double_precision psf_mag_error_i - double_precision psf_mag_error_z - double_precision psf_mag_error_y - double_precision psf_mag_error_j double_precision psf_flux_g double_precision psf_flux_r double_precision psf_flux_i double_precision psf_flux_z double_precision psf_flux_y double_precision psf_flux_j - double_precision psf_flux_error_g - double_precision psf_flux_error_r - double_precision psf_flux_error_i - double_precision psf_flux_error_z - double_precision psf_flux_error_y - double_precision psf_flux_error_j + double_precision prob_f_star + boolean flags_dist + boolean flags_ebv + varchar version + timestamp_without_time_zone created_at + timestamp_without_time_zone updated_at varchar filter_g FK varchar filter_r FK varchar filter_i FK varchar filter_z FK varchar filter_y FK varchar filter_j FK - double_precision prob_f_star - boolean flags_dist - boolean flags_ebv + double_precision psf_mag_error_g + double_precision psf_mag_error_r + double_precision psf_mag_error_i + double_precision psf_mag_error_z + double_precision psf_mag_error_y + double_precision psf_mag_error_j + double_precision psf_flux_error_g + double_precision psf_flux_error_r + double_precision psf_flux_error_i + double_precision psf_flux_error_z + double_precision psf_flux_error_y + double_precision psf_flux_error_j double_precision teff_brutus double_precision teff_brutus_low double_precision teff_brutus_high @@ -137,6 +126,19 @@ erDiagram double_precision teff_gspphot_lower double_precision teff_gspphot_upper boolean is_fstar_gaia +} +"public.sky" { + bigint sky_id + bigint obj_id + varchar obj_id_orig + double_precision ra + double_precision dec + varchar epoch + integer tract + integer patch + integer target_type_id FK + integer input_catalog_id FK + double_precision mag_thresh varchar version timestamp_without_time_zone created_at timestamp_without_time_zone updated_at @@ -144,7 +146,6 @@ erDiagram "public.target" { bigint target_id varchar proposal_id FK - varchar ob_code bigint obj_id double_precision ra double_precision dec @@ -168,50 +169,63 @@ erDiagram double_precision psf_mag_z double_precision psf_mag_y double_precision psf_mag_j - double_precision psf_mag_error_g - double_precision psf_mag_error_r - double_precision psf_mag_error_i - double_precision psf_mag_error_z - double_precision psf_mag_error_y - double_precision psf_mag_error_j double_precision psf_flux_g double_precision psf_flux_r double_precision psf_flux_i double_precision psf_flux_z double_precision psf_flux_y double_precision psf_flux_j - double_precision psf_flux_error_g - double_precision psf_flux_error_r - double_precision psf_flux_error_i - double_precision psf_flux_error_z - double_precision psf_flux_error_y - double_precision psf_flux_error_j - varchar filter_g FK - varchar filter_r FK - varchar filter_i FK - varchar filter_z FK - varchar filter_y FK - 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 double_precision qa_reference_lambda - varchar qa_reference_arm FK boolean is_cluster timestamp_without_time_zone created_at timestamp_without_time_zone updated_at + varchar filter_g FK + varchar filter_r FK + varchar filter_i FK + varchar filter_z FK + varchar filter_y FK + varchar filter_j FK + double_precision psf_mag_error_g + double_precision psf_mag_error_r + double_precision psf_mag_error_i + double_precision psf_mag_error_z + double_precision psf_mag_error_y + double_precision psf_mag_error_j + double_precision psf_flux_error_g + double_precision psf_flux_error_r + double_precision psf_flux_error_i + double_precision psf_flux_error_z + double_precision psf_flux_error_y + double_precision psf_flux_error_j + varchar ob_code + double_precision single_exptime + varchar qa_reference_arm FK + double_precision total_flux_g + double_precision total_flux_r + double_precision total_flux_i + double_precision total_flux_z + double_precision total_flux_y + double_precision total_flux_j + double_precision total_flux_error_g + double_precision total_flux_error_r + double_precision total_flux_error_i + double_precision total_flux_error_z + double_precision total_flux_error_y + double_precision total_flux_error_j } -"public.cluster" { - bigint cluster_id - bigint target_id FK - integer n_targets - double_precision ra_cluster - double_precision dec_cluster - double_precision d_ra - double_precision d_dec +"public.user_pointing" { + bigint user_pointing_id + varchar ppc_code + double_precision ppc_ra + double_precision ppc_dec + double_precision ppc_pa + resolutionmode ppc_resolution + double_precision ppc_priority integer input_catalog_id FK timestamp_without_time_zone created_at timestamp_without_time_zone updated_at diff --git a/docs/tbls/public.partner.md b/docs/tbls/public.partner.md index e29cc6a..aaf3b70 100644 --- a/docs/tbls/public.partner.md +++ b/docs/tbls/public.partner.md @@ -6,7 +6,7 @@ | Name | Type | Default | Nullable | Children | Parents | Comment | | ---- | ---- | ------- | -------- | -------- | ------- | ------- | -| partner_id | integer | | false | | | Unique identifier of the partner | +| partner_id | integer | | false | [public.proposal](public.proposal.md) | | Unique identifier of the partner | | partner_name | varchar | | false | | | Name of the partner (e.g., subaru, gemini, keck, and uh) | | partner_description | varchar | | true | | | Description of the partner | | created_at | timestamp without time zone | timezone('utc'::text, CURRENT_TIMESTAMP) | true | | | The date and time in UTC when the record was created | @@ -18,6 +18,7 @@ | ---- | ---- | ---------- | | partner_pkey | PRIMARY KEY | PRIMARY KEY (partner_id) | | partner_partner_name_key | UNIQUE | UNIQUE (partner_name) | +| partner_partner_id_key | UNIQUE | UNIQUE (partner_id) | ## Indexes @@ -25,12 +26,14 @@ | ---- | ---------- | | partner_pkey | CREATE UNIQUE INDEX partner_pkey ON public.partner USING btree (partner_id) | | partner_partner_name_key | CREATE UNIQUE INDEX partner_partner_name_key ON public.partner USING btree (partner_name) | +| partner_partner_id_key | CREATE UNIQUE INDEX partner_partner_id_key ON public.partner USING btree (partner_id) | ## Relations ```mermaid erDiagram +"public.proposal" }o--o| "public.partner" : "FOREIGN KEY (partner_id) REFERENCES partner(partner_id)" "public.partner" { integer partner_id @@ -39,6 +42,23 @@ erDiagram timestamp_without_time_zone created_at timestamp_without_time_zone updated_at } +"public.proposal" { + varchar proposal_id + varchar group_id + varchar pi_first_name + varchar pi_last_name + varchar pi_middle_name + double_precision rank + varchar grade + double_precision allocated_time_total + integer proposal_category_id FK + timestamp_without_time_zone created_at + timestamp_without_time_zone updated_at + double_precision allocated_time_lr + double_precision allocated_time_mr + boolean is_too + integer partner_id FK +} ``` --- diff --git a/docs/tbls/public.pfs_arm.md b/docs/tbls/public.pfs_arm.md index 959d089..332004c 100644 --- a/docs/tbls/public.pfs_arm.md +++ b/docs/tbls/public.pfs_arm.md @@ -15,12 +15,14 @@ | Name | Type | Definition | | ---- | ---- | ---------- | +| pfs_arm_name_key | UNIQUE | UNIQUE (name) | | pfs_arm_pkey | PRIMARY KEY | PRIMARY KEY (name) | ## Indexes | Name | Definition | | ---- | ---------- | +| pfs_arm_name_key | CREATE UNIQUE INDEX pfs_arm_name_key ON public.pfs_arm USING btree (name) | | pfs_arm_pkey | CREATE UNIQUE INDEX pfs_arm_pkey ON public.pfs_arm USING btree (name) | ## Relations @@ -39,7 +41,6 @@ erDiagram "public.target" { bigint target_id varchar proposal_id FK - varchar ob_code bigint obj_id double_precision ra double_precision dec @@ -63,41 +64,54 @@ erDiagram double_precision psf_mag_z double_precision psf_mag_y double_precision psf_mag_j - double_precision psf_mag_error_g - double_precision psf_mag_error_r - double_precision psf_mag_error_i - double_precision psf_mag_error_z - double_precision psf_mag_error_y - double_precision psf_mag_error_j double_precision psf_flux_g double_precision psf_flux_r double_precision psf_flux_i double_precision psf_flux_z double_precision psf_flux_y double_precision psf_flux_j - double_precision psf_flux_error_g - double_precision psf_flux_error_r - double_precision psf_flux_error_i - double_precision psf_flux_error_z - double_precision psf_flux_error_y - double_precision psf_flux_error_j - varchar filter_g FK - varchar filter_r FK - varchar filter_i FK - varchar filter_z FK - varchar filter_y FK - 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 double_precision qa_reference_lambda - varchar qa_reference_arm FK boolean is_cluster timestamp_without_time_zone created_at timestamp_without_time_zone updated_at + varchar filter_g FK + varchar filter_r FK + varchar filter_i FK + varchar filter_z FK + varchar filter_y FK + varchar filter_j FK + double_precision psf_mag_error_g + double_precision psf_mag_error_r + double_precision psf_mag_error_i + double_precision psf_mag_error_z + double_precision psf_mag_error_y + double_precision psf_mag_error_j + double_precision psf_flux_error_g + double_precision psf_flux_error_r + double_precision psf_flux_error_i + double_precision psf_flux_error_z + double_precision psf_flux_error_y + double_precision psf_flux_error_j + varchar ob_code + double_precision single_exptime + varchar qa_reference_arm FK + double_precision total_flux_g + double_precision total_flux_r + double_precision total_flux_i + double_precision total_flux_z + double_precision total_flux_y + double_precision total_flux_j + double_precision total_flux_error_g + double_precision total_flux_error_r + double_precision total_flux_error_i + double_precision total_flux_error_z + double_precision total_flux_error_y + double_precision total_flux_error_j } ``` diff --git a/docs/tbls/public.proposal.md b/docs/tbls/public.proposal.md index 4f26b70..4565363 100644 --- a/docs/tbls/public.proposal.md +++ b/docs/tbls/public.proposal.md @@ -6,20 +6,21 @@ | Name | Type | Default | Nullable | Children | Parents | Comment | | ---- | ---- | ------- | -------- | -------- | ------- | ------- | -| proposal_id | varchar | | false | [public.target](public.target.md) | | Unique identifier for proposal (e.g, S21B-OT06?) | -| group_id | varchar | | false | | | Group ID in STARS (e.g., o21195?) | +| proposal_id | varchar | | false | [public.target](public.target.md) | | Unique identifier for proposal (e.g, S21B-OT06) | +| group_id | varchar | | false | | | Group ID in STARS (e.g., o21195) | | pi_first_name | varchar | | true | | | PI's first name | | pi_last_name | varchar | | false | | | PI's last name | | pi_middle_name | varchar | | true | | | PI's middle name | | rank | double precision | | false | | | TAC score | -| grade | varchar | | false | | | TAC grade (A/B/C/F in the case of HSC queue) | +| grade | varchar | | false | | | TAC grade (A/B/C/F and N/A) | | allocated_time_total | double precision | | true | | | Total fiberhours allocated by TAC (hour) | -| allocated_time_lr | double precision | | true | | | Total fiberhours for the low-resolution mode allocated by TAC (hour) | -| allocated_time_mr | double precision | | true | | | Total fiberhours for the medium-resolution mode allocated by TAC (hour) | | proposal_category_id | integer | | true | | [public.proposal_category](public.proposal_category.md) | | -| is_too | boolean | | true | | | True when the proposal is ToO | | created_at | timestamp without time zone | timezone('utc'::text, CURRENT_TIMESTAMP) | true | | | The date and time in UTC when the record was created | | updated_at | timestamp without time zone | | true | | | The date and time in UTC when the record was last updated | +| allocated_time_lr | double precision | | true | | | Total fiberhours for the low-resolution mode allocated by TAC (hour) | +| allocated_time_mr | double precision | | true | | | Total fiberhours for the medium-resolution mode allocated by TAC (hour) | +| is_too | boolean | | true | | | True when the proposal is ToO | +| partner_id | integer | | true | | [public.partner](public.partner.md) | | ## Constraints @@ -27,12 +28,16 @@ | ---- | ---- | ---------- | | proposal_proposal_category_id_fkey | FOREIGN KEY | FOREIGN KEY (proposal_category_id) REFERENCES proposal_category(proposal_category_id) | | proposal_pkey | PRIMARY KEY | PRIMARY KEY (proposal_id) | +| proposal_proposal_id_key | UNIQUE | UNIQUE (proposal_id) | +| proposal_partner_id_fkey | FOREIGN KEY | FOREIGN KEY (partner_id) REFERENCES partner(partner_id) | ## Indexes | Name | Definition | | ---- | ---------- | | proposal_pkey | CREATE UNIQUE INDEX proposal_pkey ON public.proposal USING btree (proposal_id) | +| proposal_proposal_id_key | CREATE UNIQUE INDEX proposal_proposal_id_key ON public.proposal USING btree (proposal_id) | +| idx_proposal_grade | CREATE INDEX idx_proposal_grade ON public.proposal USING btree (grade) | ## Relations @@ -41,6 +46,7 @@ erDiagram "public.target" }o--o| "public.proposal" : "FOREIGN KEY (proposal_id) REFERENCES proposal(proposal_id)" "public.proposal" }o--o| "public.proposal_category" : "FOREIGN KEY (proposal_category_id) REFERENCES proposal_category(proposal_category_id)" +"public.proposal" }o--o| "public.partner" : "FOREIGN KEY (partner_id) REFERENCES partner(partner_id)" "public.proposal" { varchar proposal_id @@ -51,17 +57,17 @@ erDiagram double_precision rank varchar grade double_precision allocated_time_total - double_precision allocated_time_lr - double_precision allocated_time_mr integer proposal_category_id FK - boolean is_too timestamp_without_time_zone created_at timestamp_without_time_zone updated_at + double_precision allocated_time_lr + double_precision allocated_time_mr + boolean is_too + integer partner_id FK } "public.target" { bigint target_id varchar proposal_id FK - varchar ob_code bigint obj_id double_precision ra double_precision dec @@ -85,41 +91,54 @@ erDiagram double_precision psf_mag_z double_precision psf_mag_y double_precision psf_mag_j - double_precision psf_mag_error_g - double_precision psf_mag_error_r - double_precision psf_mag_error_i - double_precision psf_mag_error_z - double_precision psf_mag_error_y - double_precision psf_mag_error_j double_precision psf_flux_g double_precision psf_flux_r double_precision psf_flux_i double_precision psf_flux_z double_precision psf_flux_y double_precision psf_flux_j - double_precision psf_flux_error_g - double_precision psf_flux_error_r - double_precision psf_flux_error_i - double_precision psf_flux_error_z - double_precision psf_flux_error_y - double_precision psf_flux_error_j - varchar filter_g FK - varchar filter_r FK - varchar filter_i FK - varchar filter_z FK - varchar filter_y FK - 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 double_precision qa_reference_lambda - varchar qa_reference_arm FK boolean is_cluster timestamp_without_time_zone created_at timestamp_without_time_zone updated_at + varchar filter_g FK + varchar filter_r FK + varchar filter_i FK + varchar filter_z FK + varchar filter_y FK + varchar filter_j FK + double_precision psf_mag_error_g + double_precision psf_mag_error_r + double_precision psf_mag_error_i + double_precision psf_mag_error_z + double_precision psf_mag_error_y + double_precision psf_mag_error_j + double_precision psf_flux_error_g + double_precision psf_flux_error_r + double_precision psf_flux_error_i + double_precision psf_flux_error_z + double_precision psf_flux_error_y + double_precision psf_flux_error_j + varchar ob_code + double_precision single_exptime + varchar qa_reference_arm FK + double_precision total_flux_g + double_precision total_flux_r + double_precision total_flux_i + double_precision total_flux_z + double_precision total_flux_y + double_precision total_flux_j + double_precision total_flux_error_g + double_precision total_flux_error_r + double_precision total_flux_error_i + double_precision total_flux_error_z + double_precision total_flux_error_y + double_precision total_flux_error_j } "public.proposal_category" { integer proposal_category_id @@ -128,6 +147,13 @@ erDiagram timestamp_without_time_zone created_at timestamp_without_time_zone updated_at } +"public.partner" { + integer partner_id + varchar partner_name + varchar partner_description + timestamp_without_time_zone created_at + timestamp_without_time_zone updated_at +} ``` --- diff --git a/docs/tbls/public.proposal_category.md b/docs/tbls/public.proposal_category.md index b591581..d25dbac 100644 --- a/docs/tbls/public.proposal_category.md +++ b/docs/tbls/public.proposal_category.md @@ -17,6 +17,7 @@ | Name | Type | Definition | | ---- | ---- | ---------- | | proposal_category_pkey | PRIMARY KEY | PRIMARY KEY (proposal_category_id) | +| proposal_category_proposal_category_id_key | UNIQUE | UNIQUE (proposal_category_id) | | proposal_category_proposal_category_name_key | UNIQUE | UNIQUE (proposal_category_name) | ## Indexes @@ -24,6 +25,7 @@ | Name | Definition | | ---- | ---------- | | proposal_category_pkey | CREATE UNIQUE INDEX proposal_category_pkey ON public.proposal_category USING btree (proposal_category_id) | +| proposal_category_proposal_category_id_key | CREATE UNIQUE INDEX proposal_category_proposal_category_id_key ON public.proposal_category USING btree (proposal_category_id) | | proposal_category_proposal_category_name_key | CREATE UNIQUE INDEX proposal_category_proposal_category_name_key ON public.proposal_category USING btree (proposal_category_name) | ## Relations @@ -49,12 +51,13 @@ erDiagram double_precision rank varchar grade double_precision allocated_time_total - double_precision allocated_time_lr - double_precision allocated_time_mr integer proposal_category_id FK - boolean is_too timestamp_without_time_zone created_at timestamp_without_time_zone updated_at + double_precision allocated_time_lr + double_precision allocated_time_mr + boolean is_too + integer partner_id FK } ``` diff --git a/docs/tbls/public.sky.md b/docs/tbls/public.sky.md index f79a461..63116a7 100644 --- a/docs/tbls/public.sky.md +++ b/docs/tbls/public.sky.md @@ -26,19 +26,21 @@ | Name | Type | Definition | | ---- | ---- | ---------- | | sky_input_catalog_id_fkey | FOREIGN KEY | FOREIGN KEY (input_catalog_id) REFERENCES input_catalog(input_catalog_id) | -| sky_target_type_id_fkey | FOREIGN KEY | FOREIGN KEY (target_type_id) REFERENCES target_type(target_type_id) | -| sky_pkey | PRIMARY KEY | PRIMARY KEY (sky_id) | | sky_obj_id_input_catalog_id_version_key | UNIQUE | UNIQUE (obj_id, input_catalog_id, version) | +| sky_pkey | PRIMARY KEY | PRIMARY KEY (sky_id) | +| sky_sky_id_key | UNIQUE | UNIQUE (sky_id) | +| sky_target_type_id_fkey | FOREIGN KEY | FOREIGN KEY (target_type_id) REFERENCES target_type(target_type_id) | ## Indexes | Name | Definition | | ---- | ---------- | -| sky_pkey | CREATE UNIQUE INDEX sky_pkey ON public.sky USING btree (sky_id) | | sky_obj_id_input_catalog_id_version_key | CREATE UNIQUE INDEX sky_obj_id_input_catalog_id_version_key ON public.sky USING btree (obj_id, input_catalog_id, version) | +| sky_pkey | CREATE UNIQUE INDEX sky_pkey ON public.sky USING btree (sky_id) | +| sky_sky_id_key | CREATE UNIQUE INDEX sky_sky_id_key ON public.sky USING btree (sky_id) | +| ix_sky_input_catalog_id | CREATE INDEX ix_sky_input_catalog_id ON public.sky USING btree (input_catalog_id) | | ix_sky_version | CREATE INDEX ix_sky_version ON public.sky USING btree (version) | | sky_q3c_ang2ipix_idx | CREATE INDEX sky_q3c_ang2ipix_idx ON public.sky USING btree (q3c_ang2ipix(ra, "dec")) | -| ix_sky_input_catalog_id | CREATE INDEX ix_sky_input_catalog_id ON public.sky USING btree (input_catalog_id) | ## Relations @@ -72,15 +74,15 @@ erDiagram timestamp_without_time_zone updated_at } "public.input_catalog" { - integer input_catalog_id varchar input_catalog_name varchar input_catalog_description + timestamp_without_time_zone created_at + timestamp_without_time_zone updated_at varchar_16_ upload_id + integer input_catalog_id boolean active boolean is_classical boolean is_user_pointing - timestamp_without_time_zone created_at - timestamp_without_time_zone updated_at } ``` diff --git a/docs/tbls/public.target.md b/docs/tbls/public.target.md index 3aa6614..d8c4eac 100644 --- a/docs/tbls/public.target.md +++ b/docs/tbls/public.target.md @@ -8,7 +8,6 @@ | ---- | ---- | ------- | -------- | -------- | ------- | ------- | | target_id | bigint | nextval('target_target_id_seq'::regclass) | false | [public.cluster](public.cluster.md) | | Unique identifier for each target | | proposal_id | varchar | | true | | [public.proposal](public.proposal.md) | | -| ob_code | varchar | | false | | | Identifer for a combination of a target, observing mode, and exposure time in a program. | | obj_id | bigint | | false | | | Object ID as specified by the observer at Phase 2 (can be same as the input_catalog_object_id) | | ra | double precision | | false | | | RA (ICRS, degree) | | dec | double precision | | false | | | Dec (ICRS, degree) | @@ -32,41 +31,54 @@ | psf_mag_z | double precision | | true | | | z-band PSF magnitude (AB mag) | | psf_mag_y | double precision | | true | | | y-band PSF magnitude (AB mag) | | psf_mag_j | double precision | | true | | | J band PSF magnitude (AB mag) | -| psf_mag_error_g | double precision | | true | | | Error in g-band PSF magnitude (AB mag) | -| psf_mag_error_r | double precision | | true | | | Error in r-band PSF magnitude (AB mag) | -| psf_mag_error_i | double precision | | true | | | Error in i-band PSF magnitude (AB mag) | -| psf_mag_error_z | double precision | | true | | | Error in z-band PSF magnitude (AB mag) | -| psf_mag_error_y | double precision | | true | | | Error in y-band PSF magnitude (AB mag) | -| psf_mag_error_j | double precision | | true | | | Error in J band PSF magnitude (AB mag) | | psf_flux_g | double precision | | true | | | g-band PSF flux (nJy) | | psf_flux_r | double precision | | true | | | r-band PSF flux (nJy) | | psf_flux_i | double precision | | true | | | i-band PSF flux (nJy) | | psf_flux_z | double precision | | true | | | z-band PSF flux (nJy) | | psf_flux_y | double precision | | true | | | y-band PSF flux (nJy) | | psf_flux_j | double precision | | true | | | J band PSF flux (nJy) | -| psf_flux_error_g | double precision | | true | | | Error in g-band PSF flux (nJy) | -| psf_flux_error_r | double precision | | true | | | Error in r-band PSF flux (nJy) | -| psf_flux_error_i | double precision | | true | | | Error in i-band PSF flux (nJy) | -| psf_flux_error_z | double precision | | true | | | Error in z-band PSF flux (nJy) | -| psf_flux_error_y | double precision | | true | | | Error in y-band PSF flux (nJy) | -| psf_flux_error_j | double precision | | true | | | Error in J band PSF flux (nJy) | -| filter_g | varchar | | true | | [public.filter_name](public.filter_name.md) | g-band filter (g_hsc, g_ps1, g_sdss, etc.) | -| filter_r | varchar | | true | | [public.filter_name](public.filter_name.md) | r-band filter (r_hsc, r_ps1, r_sdss, etc.) | -| filter_i | varchar | | true | | [public.filter_name](public.filter_name.md) | i-band filter (i_hsc, i_ps1, i_sdss, etc.) | -| filter_z | varchar | | true | | [public.filter_name](public.filter_name.md) | z-band filter (z_hsc, z_ps1, z_sdss, etc.) | -| filter_y | varchar | | true | | [public.filter_name](public.filter_name.md) | y-band filter (y_hsc, y_ps1, y_sdss, etc.) | -| 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) | | qa_reference_lambda | double precision | | true | | | Reference wavelength to evaluate effective exposure time (angstrom or nm?) | -| qa_reference_arm | varchar | | true | | [public.pfs_arm](public.pfs_arm.md) | Reference arm to evaluate effective exposure time ('b', 'r', 'n', 'm') | | is_cluster | boolean | | true | | | True if it is a cluster of multiple targets. | | created_at | timestamp without time zone | timezone('utc'::text, CURRENT_TIMESTAMP) | true | | | The date and time in UTC when the record was created | | updated_at | timestamp without time zone | | true | | | The date and time in UTC when the record was last updated | +| filter_g | varchar | | true | | [public.filter_name](public.filter_name.md) | g-band filter (g_hsc, g_ps1, g_sdss, etc.) | +| filter_r | varchar | | true | | [public.filter_name](public.filter_name.md) | r-band filter (r_hsc, r_ps1, r_sdss, etc.) | +| filter_i | varchar | | true | | [public.filter_name](public.filter_name.md) | i-band filter (i_hsc, i_ps1, i_sdss, etc.) | +| filter_z | varchar | | true | | [public.filter_name](public.filter_name.md) | z-band filter (z_hsc, z_ps1, z_sdss, etc.) | +| filter_y | varchar | | true | | [public.filter_name](public.filter_name.md) | y-band filter (y_hsc, y_ps1, y_sdss, etc.) | +| filter_j | varchar | | true | | [public.filter_name](public.filter_name.md) | j-band filter (j_mko, etc.) | +| psf_mag_error_g | double precision | | true | | | Error in g-band PSF magnitude (AB mag) | +| psf_mag_error_r | double precision | | true | | | Error in r-band PSF magnitude (AB mag) | +| psf_mag_error_i | double precision | | true | | | Error in i-band PSF magnitude (AB mag) | +| psf_mag_error_z | double precision | | true | | | Error in z-band PSF magnitude (AB mag) | +| psf_mag_error_y | double precision | | true | | | Error in y-band PSF magnitude (AB mag) | +| psf_mag_error_j | double precision | | true | | | Error in J band PSF magnitude (AB mag) | +| psf_flux_error_g | double precision | | true | | | Error in g-band PSF flux (nJy) | +| psf_flux_error_r | double precision | | true | | | Error in r-band PSF flux (nJy) | +| psf_flux_error_i | double precision | | true | | | Error in i-band PSF flux (nJy) | +| psf_flux_error_z | double precision | | true | | | Error in z-band PSF flux (nJy) | +| psf_flux_error_y | double precision | | true | | | Error in y-band PSF flux (nJy) | +| psf_flux_error_j | double precision | | true | | | Error in J band PSF flux (nJy) | +| ob_code | varchar | | false | | | Identifer for a combination of a target, observing mode, and exposure time in a program. | +| single_exptime | double precision | | false | | | Individual exposure time (s) | +| qa_reference_arm | varchar | | true | | [public.pfs_arm](public.pfs_arm.md) | Reference arm to evaluate effective exposure time ('b', 'r', 'n', 'm') | +| total_flux_g | double precision | | true | | | g-band total flux (nJy) | +| total_flux_r | double precision | | true | | | r-band total flux (nJy) | +| total_flux_i | double precision | | true | | | i-band total flux (nJy) | +| total_flux_z | double precision | | true | | | z-band total flux (nJy) | +| total_flux_y | double precision | | true | | | y-band total flux (nJy) | +| total_flux_j | double precision | | true | | | J band total flux (nJy) | +| total_flux_error_g | double precision | | true | | | Error in g-band total flux (nJy) | +| total_flux_error_r | double precision | | true | | | Error in r-band total flux (nJy) | +| total_flux_error_i | double precision | | true | | | Error in i-band total flux (nJy) | +| total_flux_error_z | double precision | | true | | | Error in z-band total flux (nJy) | +| total_flux_error_y | double precision | | true | | | Error in y-band total flux (nJy) | +| total_flux_error_j | double precision | | true | | | Error in J band total flux (nJy) | ## Constraints @@ -78,13 +90,14 @@ | target_filter_r_fkey | FOREIGN KEY | FOREIGN KEY (filter_r) REFERENCES filter_name(filter_name) | | target_filter_y_fkey | FOREIGN KEY | FOREIGN KEY (filter_y) REFERENCES filter_name(filter_name) | | target_filter_z_fkey | FOREIGN KEY | FOREIGN KEY (filter_z) REFERENCES filter_name(filter_name) | -| target_qa_reference_arm_fkey | FOREIGN KEY | FOREIGN KEY (qa_reference_arm) REFERENCES pfs_arm(name) | | target_input_catalog_id_fkey | FOREIGN KEY | FOREIGN KEY (input_catalog_id) REFERENCES input_catalog(input_catalog_id) | -| target_target_type_id_fkey | FOREIGN KEY | FOREIGN KEY (target_type_id) REFERENCES target_type(target_type_id) | +| target_qa_reference_arm_fkey | FOREIGN KEY | FOREIGN KEY (qa_reference_arm) REFERENCES pfs_arm(name) | | target_proposal_id_fkey | FOREIGN KEY | FOREIGN KEY (proposal_id) REFERENCES proposal(proposal_id) | +| target_target_type_id_fkey | FOREIGN KEY | FOREIGN KEY (target_type_id) REFERENCES target_type(target_type_id) | | target_pkey | PRIMARY KEY | PRIMARY KEY (target_id) | | target_propid_obcode_catid_objid_resolution_key | UNIQUE | UNIQUE (proposal_id, ob_code, input_catalog_id, obj_id, is_medium_resolution) | | target_propid_obcode_key | UNIQUE | UNIQUE (proposal_id, ob_code) | +| target_target_id_key | UNIQUE | UNIQUE (target_id) | ## Indexes @@ -93,6 +106,7 @@ | target_pkey | CREATE UNIQUE INDEX target_pkey ON public.target USING btree (target_id) | | target_propid_obcode_catid_objid_resolution_key | CREATE UNIQUE INDEX target_propid_obcode_catid_objid_resolution_key ON public.target USING btree (proposal_id, ob_code, input_catalog_id, obj_id, is_medium_resolution) | | target_propid_obcode_key | CREATE UNIQUE INDEX target_propid_obcode_key ON public.target USING btree (proposal_id, ob_code) | +| target_target_id_key | CREATE UNIQUE INDEX target_target_id_key ON public.target USING btree (target_id) | | target_q3c_ang2ipix_idx | CREATE INDEX target_q3c_ang2ipix_idx ON public.target USING btree (q3c_ang2ipix(ra, "dec")) | ## Relations @@ -115,7 +129,6 @@ erDiagram "public.target" { bigint target_id varchar proposal_id FK - varchar ob_code bigint obj_id double_precision ra double_precision dec @@ -139,41 +152,54 @@ erDiagram double_precision psf_mag_z double_precision psf_mag_y double_precision psf_mag_j - double_precision psf_mag_error_g - double_precision psf_mag_error_r - double_precision psf_mag_error_i - double_precision psf_mag_error_z - double_precision psf_mag_error_y - double_precision psf_mag_error_j double_precision psf_flux_g double_precision psf_flux_r double_precision psf_flux_i double_precision psf_flux_z double_precision psf_flux_y double_precision psf_flux_j - double_precision psf_flux_error_g - double_precision psf_flux_error_r - double_precision psf_flux_error_i - double_precision psf_flux_error_z - double_precision psf_flux_error_y - double_precision psf_flux_error_j - varchar filter_g FK - varchar filter_r FK - varchar filter_i FK - varchar filter_z FK - varchar filter_y FK - 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 double_precision qa_reference_lambda - varchar qa_reference_arm FK boolean is_cluster timestamp_without_time_zone created_at timestamp_without_time_zone updated_at + varchar filter_g FK + varchar filter_r FK + varchar filter_i FK + varchar filter_z FK + varchar filter_y FK + varchar filter_j FK + double_precision psf_mag_error_g + double_precision psf_mag_error_r + double_precision psf_mag_error_i + double_precision psf_mag_error_z + double_precision psf_mag_error_y + double_precision psf_mag_error_j + double_precision psf_flux_error_g + double_precision psf_flux_error_r + double_precision psf_flux_error_i + double_precision psf_flux_error_z + double_precision psf_flux_error_y + double_precision psf_flux_error_j + varchar ob_code + double_precision single_exptime + varchar qa_reference_arm FK + double_precision total_flux_g + double_precision total_flux_r + double_precision total_flux_i + double_precision total_flux_z + double_precision total_flux_y + double_precision total_flux_j + double_precision total_flux_error_g + double_precision total_flux_error_r + double_precision total_flux_error_i + double_precision total_flux_error_z + double_precision total_flux_error_y + double_precision total_flux_error_j } "public.cluster" { bigint cluster_id @@ -196,12 +222,13 @@ erDiagram double_precision rank varchar grade double_precision allocated_time_total - double_precision allocated_time_lr - double_precision allocated_time_mr integer proposal_category_id FK - boolean is_too timestamp_without_time_zone created_at timestamp_without_time_zone updated_at + double_precision allocated_time_lr + double_precision allocated_time_mr + boolean is_too + integer partner_id FK } "public.target_type" { integer target_type_id @@ -211,15 +238,15 @@ erDiagram timestamp_without_time_zone updated_at } "public.input_catalog" { - integer input_catalog_id varchar input_catalog_name varchar input_catalog_description + timestamp_without_time_zone created_at + timestamp_without_time_zone updated_at varchar_16_ upload_id + integer input_catalog_id boolean active boolean is_classical boolean is_user_pointing - timestamp_without_time_zone created_at - timestamp_without_time_zone updated_at } "public.filter_name" { varchar filter_name diff --git a/docs/tbls/public.target_type.md b/docs/tbls/public.target_type.md index 3d05465..418461c 100644 --- a/docs/tbls/public.target_type.md +++ b/docs/tbls/public.target_type.md @@ -6,7 +6,7 @@ | Name | Type | Default | Nullable | Children | Parents | Comment | | ---- | ---- | ------- | -------- | -------- | ------- | ------- | -| target_type_id | integer | | false | [public.sky](public.sky.md) [public.fluxstd](public.fluxstd.md) [public.target](public.target.md) | | Unique identifier for target types | +| target_type_id | integer | | false | [public.fluxstd](public.fluxstd.md) [public.sky](public.sky.md) [public.target](public.target.md) | | Unique identifier for target types | | target_type_name | varchar | | false | | | Name for the target type. | | target_type_description | varchar | | true | | | Description of the target type | | created_at | timestamp without time zone | timezone('utc'::text, CURRENT_TIMESTAMP) | true | | | The date and time in UTC when the record was created | @@ -17,20 +17,22 @@ | Name | Type | Definition | | ---- | ---- | ---------- | | target_type_pkey | PRIMARY KEY | PRIMARY KEY (target_type_id) | +| target_type_target_type_id_key | UNIQUE | UNIQUE (target_type_id) | ## Indexes | Name | Definition | | ---- | ---------- | | target_type_pkey | CREATE UNIQUE INDEX target_type_pkey ON public.target_type USING btree (target_type_id) | +| target_type_target_type_id_key | CREATE UNIQUE INDEX target_type_target_type_id_key ON public.target_type USING btree (target_type_id) | ## Relations ```mermaid erDiagram -"public.sky" }o--o| "public.target_type" : "FOREIGN KEY (target_type_id) REFERENCES target_type(target_type_id)" "public.fluxstd" }o--o| "public.target_type" : "FOREIGN KEY (target_type_id) REFERENCES target_type(target_type_id)" +"public.sky" }o--o| "public.target_type" : "FOREIGN KEY (target_type_id) REFERENCES target_type(target_type_id)" "public.target" }o--o| "public.target_type" : "FOREIGN KEY (target_type_id) REFERENCES target_type(target_type_id)" "public.target_type" { @@ -40,22 +42,6 @@ erDiagram timestamp_without_time_zone created_at timestamp_without_time_zone updated_at } -"public.sky" { - bigint sky_id - bigint obj_id - varchar obj_id_orig - double_precision ra - double_precision dec - varchar epoch - integer tract - integer patch - integer target_type_id FK - integer input_catalog_id FK - double_precision mag_thresh - varchar version - timestamp_without_time_zone created_at - timestamp_without_time_zone updated_at -} "public.fluxstd" { bigint fluxstd_id bigint obj_id @@ -78,33 +64,36 @@ erDiagram double_precision psf_mag_z double_precision psf_mag_y double_precision psf_mag_j - double_precision psf_mag_error_g - double_precision psf_mag_error_r - double_precision psf_mag_error_i - double_precision psf_mag_error_z - double_precision psf_mag_error_y - double_precision psf_mag_error_j double_precision psf_flux_g double_precision psf_flux_r double_precision psf_flux_i double_precision psf_flux_z double_precision psf_flux_y double_precision psf_flux_j - double_precision psf_flux_error_g - double_precision psf_flux_error_r - double_precision psf_flux_error_i - double_precision psf_flux_error_z - double_precision psf_flux_error_y - double_precision psf_flux_error_j + double_precision prob_f_star + boolean flags_dist + boolean flags_ebv + varchar version + timestamp_without_time_zone created_at + timestamp_without_time_zone updated_at varchar filter_g FK varchar filter_r FK varchar filter_i FK varchar filter_z FK varchar filter_y FK varchar filter_j FK - double_precision prob_f_star - boolean flags_dist - boolean flags_ebv + double_precision psf_mag_error_g + double_precision psf_mag_error_r + double_precision psf_mag_error_i + double_precision psf_mag_error_z + double_precision psf_mag_error_y + double_precision psf_mag_error_j + double_precision psf_flux_error_g + double_precision psf_flux_error_r + double_precision psf_flux_error_i + double_precision psf_flux_error_z + double_precision psf_flux_error_y + double_precision psf_flux_error_j double_precision teff_brutus double_precision teff_brutus_low double_precision teff_brutus_high @@ -115,6 +104,19 @@ erDiagram double_precision teff_gspphot_lower double_precision teff_gspphot_upper boolean is_fstar_gaia +} +"public.sky" { + bigint sky_id + bigint obj_id + varchar obj_id_orig + double_precision ra + double_precision dec + varchar epoch + integer tract + integer patch + integer target_type_id FK + integer input_catalog_id FK + double_precision mag_thresh varchar version timestamp_without_time_zone created_at timestamp_without_time_zone updated_at @@ -122,7 +124,6 @@ erDiagram "public.target" { bigint target_id varchar proposal_id FK - varchar ob_code bigint obj_id double_precision ra double_precision dec @@ -146,41 +147,54 @@ erDiagram double_precision psf_mag_z double_precision psf_mag_y double_precision psf_mag_j - double_precision psf_mag_error_g - double_precision psf_mag_error_r - double_precision psf_mag_error_i - double_precision psf_mag_error_z - double_precision psf_mag_error_y - double_precision psf_mag_error_j double_precision psf_flux_g double_precision psf_flux_r double_precision psf_flux_i double_precision psf_flux_z double_precision psf_flux_y double_precision psf_flux_j - double_precision psf_flux_error_g - double_precision psf_flux_error_r - double_precision psf_flux_error_i - double_precision psf_flux_error_z - double_precision psf_flux_error_y - double_precision psf_flux_error_j - varchar filter_g FK - varchar filter_r FK - varchar filter_i FK - varchar filter_z FK - varchar filter_y FK - 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 double_precision qa_reference_lambda - varchar qa_reference_arm FK boolean is_cluster timestamp_without_time_zone created_at timestamp_without_time_zone updated_at + varchar filter_g FK + varchar filter_r FK + varchar filter_i FK + varchar filter_z FK + varchar filter_y FK + varchar filter_j FK + double_precision psf_mag_error_g + double_precision psf_mag_error_r + double_precision psf_mag_error_i + double_precision psf_mag_error_z + double_precision psf_mag_error_y + double_precision psf_mag_error_j + double_precision psf_flux_error_g + double_precision psf_flux_error_r + double_precision psf_flux_error_i + double_precision psf_flux_error_z + double_precision psf_flux_error_y + double_precision psf_flux_error_j + varchar ob_code + double_precision single_exptime + varchar qa_reference_arm FK + double_precision total_flux_g + double_precision total_flux_r + double_precision total_flux_i + double_precision total_flux_z + double_precision total_flux_y + double_precision total_flux_j + double_precision total_flux_error_g + double_precision total_flux_error_r + double_precision total_flux_error_i + double_precision total_flux_error_z + double_precision total_flux_error_y + double_precision total_flux_error_j } ``` diff --git a/docs/tbls/public.user_pointing.md b/docs/tbls/public.user_pointing.md index e29095d..5d2b36f 100644 --- a/docs/tbls/public.user_pointing.md +++ b/docs/tbls/public.user_pointing.md @@ -50,15 +50,15 @@ erDiagram timestamp_without_time_zone updated_at } "public.input_catalog" { - integer input_catalog_id varchar input_catalog_name varchar input_catalog_description + timestamp_without_time_zone created_at + timestamp_without_time_zone updated_at varchar_16_ upload_id + integer input_catalog_id boolean active boolean is_classical boolean is_user_pointing - timestamp_without_time_zone created_at - timestamp_without_time_zone updated_at } ``` diff --git a/src/targetdb/__init__.py b/src/targetdb/__init__.py index bf070f5..2f0aa7e 100644 --- a/src/targetdb/__init__.py +++ b/src/targetdb/__init__.py @@ -2,6 +2,6 @@ from .targetdb import TargetDB -__version__ = "0.7.0" +__version__ = "0.8.0" __all__ = ["TargetDB", "__version__"] diff --git a/src/targetdb/cli/cli_main.py b/src/targetdb/cli/cli_main.py index 8d27742..fd540a8 100644 --- a/src/targetdb/cli/cli_main.py +++ b/src/targetdb/cli/cli_main.py @@ -59,6 +59,11 @@ class TargetdbTable(str, Enum): user_pointing = "user_pointing" +class FluxType(str, Enum): + total = "total" + psf = "psf" + + config_help_msg = "Database configuration file in the TOML format." @@ -407,6 +412,12 @@ def insert( help="Flag to indicate the data is coming from the PFS Target Uploader. Only required for the `target` table.", ), ] = False, + flux_type: Annotated[ + FluxType, + typer.Option( + "--flux-type", help="Flux type for the flux standard star catalog." + ), + ] = "total", upload_id: Annotated[ str, typer.Option( @@ -445,6 +456,7 @@ def insert( config=config, df=df, from_uploader=from_uploader, + flux_type=flux_type, proposal_id=proposal_id, upload_id=upload_id, insert=True, @@ -646,6 +658,12 @@ def insert_targets( help="Path to the data directory.", ), ] = ".", + flux_type: Annotated[ + FluxType, + typer.Option( + "--flux-type", help="Flux type for the flux standard star catalog." + ), + ] = "total", commit: Annotated[ bool, typer.Option("--commit", help="Commit changes to the database."), @@ -667,6 +685,7 @@ def insert_targets( df_input_catalogs, config, data_dir=data_dir, + flux_type=flux_type, commit=commit, fetch=fetch, verbose=verbose, diff --git a/src/targetdb/models/target.py b/src/targetdb/models/target.py index d737e13..1755889 100644 --- a/src/targetdb/models/target.py +++ b/src/targetdb/models/target.py @@ -148,6 +148,20 @@ class target(Base): psf_flux_error_y = Column(Float, comment="Error in y-band PSF flux (nJy)") psf_flux_error_j = Column(Float, comment="Error in J band PSF flux (nJy)") + total_flux_g = Column(Float, comment="g-band total flux (nJy)") + total_flux_r = Column(Float, comment="r-band total flux (nJy)") + total_flux_i = Column(Float, comment="i-band total flux (nJy)") + total_flux_z = Column(Float, comment="z-band total flux (nJy)") + total_flux_y = Column(Float, comment="y-band total flux (nJy)") + total_flux_j = Column(Float, comment="J band total flux (nJy)") + + total_flux_error_g = Column(Float, comment="Error in g-band total flux (nJy)") + total_flux_error_r = Column(Float, comment="Error in r-band total flux (nJy)") + total_flux_error_i = Column(Float, comment="Error in i-band total flux (nJy)") + total_flux_error_z = Column(Float, comment="Error in z-band total flux (nJy)") + total_flux_error_y = Column(Float, comment="Error in y-band total flux (nJy)") + total_flux_error_j = Column(Float, comment="Error in J band total flux (nJy)") + filter_g = Column( String, ForeignKey("filter_name.filter_name"), @@ -309,6 +323,20 @@ def __init__( psf_flux_error_y, psf_flux_error_j, # + total_flux_g, + total_flux_r, + total_flux_i, + total_flux_z, + total_flux_y, + total_flux_j, + # + total_flux_error_g, + total_flux_error_r, + total_flux_error_i, + total_flux_error_z, + total_flux_error_y, + total_flux_error_j, + # filter_g, filter_r, filter_i, @@ -378,6 +406,20 @@ def __init__( self.psf_flux_error_y = psf_flux_error_y self.psf_flux_error_j = psf_flux_error_j # + self.total_flux_g = total_flux_g + self.total_flux_r = total_flux_r + self.total_flux_i = total_flux_i + self.total_flux_z = total_flux_z + self.total_flux_y = total_flux_y + self.total_flux_j = total_flux_j + # + self.total_flux_error_g = total_flux_error_g + self.total_flux_error_r = total_flux_error_r + self.total_flux_error_i = total_flux_error_i + self.total_flux_error_z = total_flux_error_z + self.total_flux_error_y = total_flux_error_y + self.total_flux_error_j = total_flux_error_j + # self.filter_g = filter_g self.filter_r = filter_r self.filter_i = filter_i diff --git a/src/targetdb/utils.py b/src/targetdb/utils.py index 9fbf07e..f0de875 100644 --- a/src/targetdb/utils.py +++ b/src/targetdb/utils.py @@ -575,6 +575,7 @@ def make_target_df_from_uploader( table="target", proposal_id=None, upload_id=None, + flux_type="total", target_type_name="SCIENCE", insert=False, update=False, @@ -594,6 +595,8 @@ def make_target_df_from_uploader( The proposal id to be used. Defaults to None. upload_id : str, optional The upload id to be used. Defaults to None. + flux_type : str, optional + The kind of flux to use and must be "total" or "psf". Defaults to "total". target_type_name : str, optional The type of the target. Defaults to "SCIENCE". insert : bool, optional @@ -637,6 +640,10 @@ def make_target_df_from_uploader( if "reference_arm" in df.columns: df.rename(columns={"reference_arm": "qa_reference_arm"}, inplace=True) + if flux_type not in ["total", "psf"]: + logger.error(f"flux_type must be 'total' or 'psf'. {flux_type=}") + raise ValueError(f"flux_type must be 'total' or 'psf'. {flux_type=}") + # fill missing values with None or NaN for filters and fluxes for band in ["g", "r", "i", "z", "y", "j"]: if f"filter_{band}" in df.columns: @@ -647,10 +654,13 @@ def make_target_df_from_uploader( except AttributeError: pass if f"flux_{band}" in df.columns: - df.rename(columns={f"flux_{band}": f"psf_flux_{band}"}, inplace=True) + df.rename( + columns={f"flux_{band}": f"{flux_type}_flux_{band}"}, inplace=True + ) if f"flux_error_{band}" in df.columns: df.rename( - columns={f"flux_error_{band}": f"psf_flux_error_{band}"}, inplace=True + columns={f"flux_error_{band}": f"{flux_type}_flux_error_{band}"}, + inplace=True, ) df["target_type_name"] = target_type_name @@ -755,6 +765,7 @@ def add_database_rows( config=None, df=None, from_uploader=False, + flux_type="total", proposal_id=None, upload_id=None, insert=False, @@ -783,6 +794,8 @@ def add_database_rows( The DataFrame to add rows from. Defaults to None. from_uploader : bool, optional If True, the DataFrame is from an uploader. Defaults to False. + flux_type : str, optional + The kind of flux to use and must be "total" or "psf". Defaults to "total". proposal_id : int, optional The proposal id to be used. Defaults to None. upload_id : int, optional @@ -812,6 +825,10 @@ def add_database_rows( logger.warning("Neither insert nor update is selected. Exiting...") return + if flux_type not in ["total", "psf"]: + logger.error(f"flux_type must be 'total' or 'psf'. {flux_type=}") + raise ValueError(f"flux_type must be 'total' or 'psf'. {flux_type=}") + logger.info("Connecting to targetDB") db = TargetDB(**config["targetdb"]["db"]) db.connect() @@ -827,6 +844,7 @@ def add_database_rows( table=table, proposal_id=proposal_id, upload_id=upload_id, + flux_type=flux_type, insert=insert, update=update, ) @@ -1353,12 +1371,17 @@ def insert_targets_from_uploader( df_input_catalogs, config, data_dir=Path("."), + flux_type="total", file_prefix="target", commit=False, fetch=False, verbose=False, ): + if flux_type not in ["total", "psf"]: + logger.error(f"flux_type must be 'total' or 'psf'. {flux_type=}") + raise ValueError(f"flux_type must be 'total' or 'psf'. {flux_type=}") + for _, row in df_input_catalogs.iterrows(): proposal_id = row["proposal_id"] upload_id = row["upload_id"] @@ -1398,6 +1421,7 @@ def insert_targets_from_uploader( config=config, df=df, from_uploader=True, + flux_type=flux_type, proposal_id=proposal_id, upload_id=upload_id, insert=True,