Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 11 additions & 31 deletions postgres/drafts/08_photometry.sql
Original file line number Diff line number Diff line change
Expand Up @@ -24,43 +24,23 @@ CREATE TYPE photometry.MagMethodType AS ENUM ( 'psf', 'visual', 'aperture', 'iso
COMMENT ON TYPE photometry.MagMethodType IS '{ "psf":"Point Spread Function photometry for the point source", "visual":"Visual estimate", "aperture":"Aperture photometry", "isophotal":"Magnitude measurement inside a specified isophote", "asymptotic":"Asymptotic (extrapolated) magnitude when the aperture size -> Inf", "model":"Best fit model of the light distribution", "petrosian":"Petrosian adaptively scaled aperture", "kron":"Kron adaptively scaled aperture" }' ;


CREATE TABLE photometry.total (
CREATE TABLE photometry.data (
record_id Text NOT NULL REFERENCES layer0.records(id) ON UPDATE cascade ON DELETE restrict
, band text NOT NULL REFERENCES photometry.calib_bands (id) ON DELETE restrict ON UPDATE cascade
, mag real NOT NULL CHECK ( mag > -1 and mag < 30 )
, e_mag real CHECK ( e_mag > 0 and e_mag < 0.5 )
, method photometry.MagMethodType NOT NULL CHECK ( method IN ('psf', 'visual', 'asymptotic', 'model', 'petrosian', 'kron') )
, PRIMARY KEY (record_id, method, band)
);
CREATE INDEX ON photometry.total (record_id) ;
CREATE INDEX ON photometry.total (band) ;
CREATE INDEX ON photometry.total (method) ;

COMMENT ON TABLE photometry.total IS 'Catalog of the total magnitudes';
COMMENT ON COLUMN photometry.total.record_id IS 'Record ID';
COMMENT ON COLUMN photometry.total.band IS 'Calibrated passband ID';
COMMENT ON COLUMN photometry.total.mag IS '{"description":"Total (PSF|model|asymptotic|etc.) magnitude", "unit":"mag", "ucd":"phot.mag"}';
COMMENT ON COLUMN photometry.total.e_mag IS '{"description":"Error of the total magnitude", "unit":"mag", "ucd":"stat.error;phot.mag"}';
COMMENT ON COLUMN photometry.total.method IS 'Photometry method type (PSF, Kron, etc.)' ;


CREATE TABLE photometry.isophotal (
record_id Text NOT NULL REFERENCES layer0.records(id) ON UPDATE cascade ON DELETE restrict
, band text NOT NULL REFERENCES photometry.calib_bands (id) ON DELETE restrict ON UPDATE cascade
, mag real NOT NULL CHECK ( mag > -1 and mag < 30 )
, e_mag real CHECK ( e_mag > 0 and e_mag < 0.5 )
, isophote real NOT NULL CHECK ( mag > -1 and mag < 30 )
, PRIMARY KEY (record_id, band, isophote)
);
CREATE INDEX ON photometry.isophotal (record_id) ;
CREATE INDEX ON photometry.isophotal (band) ;
CREATE INDEX ON photometry.isophotal (isophote) ;

COMMENT ON TABLE photometry.isophotal IS 'Catalog of the isophotal magnitudes';
COMMENT ON COLUMN photometry.isophotal.record_id IS 'Record ID';
COMMENT ON COLUMN photometry.isophotal.band IS 'Calibrated passband ID';
COMMENT ON COLUMN photometry.isophotal.mag IS '{"description":"Isophotal magnitude", "unit":"mag", "ucd":"phot.mag"}';
COMMENT ON COLUMN photometry.isophotal.e_mag IS '{"description":"Error of the isophotal magnitude", "unit":"mag", "ucd":"stat.error;phot.mag"}';
COMMENT ON COLUMN photometry.isophotal.isophote IS 'Isophote level' ;
CREATE INDEX ON photometry.data (record_id) ;
CREATE INDEX ON photometry.data (band) ;
CREATE INDEX ON photometry.data (method) ;

COMMENT ON TABLE photometry.data IS 'Catalog of the total magnitudes';
COMMENT ON COLUMN photometry.data.record_id IS 'Record ID';
COMMENT ON COLUMN photometry.data.band IS '{"description":"Calibrated passband ID", "ucd":"instr.filter"}';
COMMENT ON COLUMN photometry.data.mag IS '{"description":"Total (PSF|model|asymptotic|etc.) magnitude", "unit":"mag", "ucd":"phot.mag"}';
COMMENT ON COLUMN photometry.data.e_mag IS '{"description":"Error of the total magnitude", "unit":"mag", "ucd":"stat.error;phot.mag"}';
COMMENT ON COLUMN photometry.data.method IS 'Photometry method type (PSF, Kron, etc.)' ;

COMMIT;
37 changes: 37 additions & 0 deletions postgres/drafts/09_isophote.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
BEGIN;

CREATE SCHEMA IF NOT EXISTS isophote ;
COMMENT ON SCHEMA isophote IS 'Catalog of the isophotal photometry';

CREATE TABLE isophote.data (
record_id Text NOT NULL REFERENCES layer0.records(id) ON UPDATE cascade ON DELETE restrict
, band text NOT NULL REFERENCES photometry.calib_bands (id) ON DELETE restrict ON UPDATE cascade
, isophote real NOT NULL CHECK ( mag > -1 and mag < 30 )
, mag real NOT NULL CHECK ( mag > -1 and mag < 30 )
, e_mag real CHECK ( e_mag > 0 and e_mag < 0.5 )
, a real NOT NULL CHECK (a>0)
, e_a real CHECK (e_a>0)
, b real NOT NULL CHECK (b>0)
, e_b real CHECK (e_b>0)
, pa real NOT NULL CHECK (pa>=0 and pa<180)
, e_pa real CHECK (e_pa>0)
, PRIMARY KEY (record_id, band, isophote)
);
CREATE INDEX ON isophote.data (record_id) ;
CREATE INDEX ON isophote.data (band) ;
CREATE INDEX ON isophote.data (isophote) ;

COMMENT ON TABLE isophote.data IS 'Catalog of the isophotal photometry';
COMMENT ON COLUMN isophote.data.record_id IS 'Record ID';
COMMENT ON COLUMN isophote.data.band IS '{"description":"Calibrated passband ID", "ucd":"instr.filter"}';
COMMENT ON COLUMN isophote.data.isophote IS '{"description":"Isophote level",, "unit":"mag/arcmin2", "ucd":"phot.mag.sb"}' ;
COMMENT ON COLUMN isophote.data.mag IS '{"description":"Isophotal magnitude", "unit":"mag", "ucd":"phot.mag"}';
COMMENT ON COLUMN isophote.data.e_mag IS '{"description":"Error of the isophotal magnitude", "unit":"mag", "ucd":"stat.error;phot.mag"}';
COMMENT ON COLUMN isophote.data.a IS '{"description":"Semi-major axis length at the given isophote", "unit":"arcsec", "ucd":"phys.angSize.smajAxis"}'
COMMENT ON COLUMN isophote.data.e_a IS '{"description":"Error of the semi-major axis length at the given isophote", "unit":"arcsec", "ucd":"stat.error;phys.angSize.smajAxis"}'
COMMENT ON COLUMN isophote.data.b IS '{"description":"Semi-minor axis length at the given isophote", "unit":"arcsec", "ucd":"phys.angSize.sminAxis"}'
COMMENT ON COLUMN isophote.data.e_b IS '{"description":"Error of the semi-minor axis length at the given isophote", "unit":"arcsec", "ucd":"stat.error;phys.angSize.sminAxis"}'
COMMENT ON COLUMN isophote.data.pa IS '{"description":"Position angle (measured east of north)", "unit":"deg", "ucd":"pos.posAng"}'
COMMENT ON COLUMN isophote.data.e_pa IS '{"description":"Error of the position angle", "unit":"deg", "ucd":"stat.error;pos.posAng"}'

COMMIT;
Loading