From 760b0528fb35efad999aa55f0c1fa0a9457cfb7e Mon Sep 17 00:00:00 2001 From: Dmitry Makarov Date: Sun, 15 Mar 2026 20:21:58 +0300 Subject: [PATCH] Isophote schema --- postgres/drafts/08_photometry.sql | 42 ++++++++----------------------- postgres/drafts/09_isophote.sql | 37 +++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 31 deletions(-) create mode 100755 postgres/drafts/09_isophote.sql diff --git a/postgres/drafts/08_photometry.sql b/postgres/drafts/08_photometry.sql index 0d83a829..7e3268cc 100644 --- a/postgres/drafts/08_photometry.sql +++ b/postgres/drafts/08_photometry.sql @@ -24,7 +24,7 @@ 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 ) @@ -32,35 +32,15 @@ CREATE TABLE photometry.total ( , 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; diff --git a/postgres/drafts/09_isophote.sql b/postgres/drafts/09_isophote.sql new file mode 100755 index 00000000..196b9b55 --- /dev/null +++ b/postgres/drafts/09_isophote.sql @@ -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; \ No newline at end of file