Skip to content

Commit 5bdf363

Browse files
authored
Create geometry schema (#424)
* Schema geometry * Geometry catalog updated
1 parent f651b04 commit 5bdf363

3 files changed

Lines changed: 54 additions & 10 deletions

File tree

postgres/drafts/08_photometry.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ BEGIN;
2020
-- -> Rkron -> aperture -> magKron
2121
------------------------------------------------------------------
2222

23-
CREATE TYPE photometry.MagMethodType AS ENUM ( 'psf', 'visual', 'aperture', 'isophotal', 'asymptotic', 'model', 'petrosian', 'kron' ) ;
24-
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" }' ;
23+
CREATE TYPE photometry.MagMethodType AS ENUM ( 'psf', 'visual', 'moments', 'aperture', 'isophotal', 'asymptotic', 'model', 'petrosian', 'kron' ) ;
24+
COMMENT ON TYPE photometry.MagMethodType IS '{ "psf":"Point Spread Function photometry for the point source", "visual":"Visual estimate", "moments":"Second-order moments of the spatial spread of a source profile", "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" }' ;
2525

2626

2727
CREATE TABLE photometry.data (

postgres/drafts/09_isophote.sql

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ CREATE TABLE isophote.data (
1111
, e_mag real CHECK ( e_mag > 0 and e_mag < 0.5 )
1212
, a real NOT NULL CHECK (a>0)
1313
, e_a real CHECK (e_a>0)
14-
, b real NOT NULL CHECK (b>0)
14+
, b real NOT NULL CHECK (b<=a)
1515
, e_b real CHECK (e_b>0)
1616
, pa real NOT NULL CHECK (pa>=0 and pa<180)
1717
, e_pa real CHECK (e_pa>0)
@@ -27,11 +27,11 @@ COMMENT ON COLUMN isophote.data.band IS '{"description":"Calibrated passband ID"
2727
COMMENT ON COLUMN isophote.data.isophote IS '{"description":"Isophote level",, "unit":"mag/arcmin2", "ucd":"phot.mag.sb"}' ;
2828
COMMENT ON COLUMN isophote.data.mag IS '{"description":"Isophotal magnitude", "unit":"mag", "ucd":"phot.mag"}';
2929
COMMENT ON COLUMN isophote.data.e_mag IS '{"description":"Error of the isophotal magnitude", "unit":"mag", "ucd":"stat.error;phot.mag"}';
30-
COMMENT ON COLUMN isophote.data.a IS '{"description":"Semi-major axis length at the given isophote", "unit":"arcsec", "ucd":"phys.angSize.smajAxis"}'
31-
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"}'
32-
COMMENT ON COLUMN isophote.data.b IS '{"description":"Semi-minor axis length at the given isophote", "unit":"arcsec", "ucd":"phys.angSize.sminAxis"}'
33-
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"}'
34-
COMMENT ON COLUMN isophote.data.pa IS '{"description":"Position angle (measured east of north)", "unit":"deg", "ucd":"pos.posAng"}'
35-
COMMENT ON COLUMN isophote.data.e_pa IS '{"description":"Error of the position angle", "unit":"deg", "ucd":"stat.error;pos.posAng"}'
30+
COMMENT ON COLUMN isophote.data.a IS '{"description":"Semi-major axis length at the given isophote", "unit":"arcsec", "ucd":"phys.angSize.smajAxis"}';
31+
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"}';
32+
COMMENT ON COLUMN isophote.data.b IS '{"description":"Semi-minor axis length at the given isophote", "unit":"arcsec", "ucd":"phys.angSize.sminAxis"}';
33+
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"}';
34+
COMMENT ON COLUMN isophote.data.pa IS '{"description":"Position angle (measured east of north)", "unit":"deg", "ucd":"pos.posAng"}';
35+
COMMENT ON COLUMN isophote.data.e_pa IS '{"description":"Error of the position angle", "unit":"deg", "ucd":"stat.error;pos.posAng"}';
3636

37-
COMMIT;
37+
COMMIT;

postgres/drafts/10_geometry.sql

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
BEGIN;
2+
3+
------------------------------------------------------------------
4+
-------- Geometry catalog (level 1) -----------
5+
------------------------------------------------------------------
6+
DROP SCHEMA IF EXISTS geometry CASCADE;
7+
CREATE SCHEMA IF NOT EXISTS geometry;
8+
COMMENT ON SCHEMA geometry IS 'Catalog of the object geometry';
9+
10+
11+
CREATE TABLE geometry.data (
12+
record_id Text NOT NULL REFERENCES layer0.records(id) ON UPDATE cascade ON DELETE restrict
13+
, band text NOT NULL REFERENCES photometry.calib_bands (id) ON DELETE restrict ON UPDATE cascade
14+
, method photometry.MagMethodType NOT NULL CHECK ( method IN ('moments', 'asymptotic', 'model', 'petrosian', 'kron') )
15+
, level real NOT NULL CHECK (level>0 and level<100) DEFAULT 39.3
16+
, a real NOT NULL CHECK (a>0)
17+
, e_a real CHECK (e_a>0)
18+
, b real NOT NULL CHECK (b<=a)
19+
, e_b real CHECK (e_b>0)
20+
, pa real CHECK (pa>=0 and pa<180)
21+
, e_pa real CHECK (e_pa>0)
22+
, isophote real CHECK (isophote>-1 and isophote<30)
23+
, e_isophote real CHECK (e_isophote>0 and e_isophote<0.5)
24+
, PRIMARY KEY (record_id, band, method, level)
25+
);
26+
CREATE INDEX ON geometry.data (record_id) ;
27+
CREATE INDEX ON geometry.data (band) ;
28+
CREATE INDEX ON geometry.data (level) ;
29+
30+
COMMENT ON TABLE geometry.data IS 'Catalog of the isophotal photometry';
31+
COMMENT ON COLUMN geometry.data.record_id IS 'Record ID';
32+
COMMENT ON COLUMN geometry.data.band IS '{"description":"Calibrated passband ID", "ucd":"instr.filter"}';
33+
COMMENT ON COLUMN geometry.data.method IS 'Measurement method of the total magnitude' ;
34+
COMMENT ON COLUMN geometry.data.level IS 'Percent of the enclosed flux' ;
35+
COMMENT ON COLUMN geometry.data.a IS '{"description":"Semi-major axis length at the given isophote", "unit":"arcsec", "ucd":"phys.angSize.smajAxis"}' ;
36+
COMMENT ON COLUMN geometry.data.e_a IS '{"description":"Error of the semi-major axis length at the given isophote", "unit":"arcsec", "ucd":"stat.error;phys.angSize.smajAxis"}' ;
37+
COMMENT ON COLUMN geometry.data.b IS '{"description":"Semi-minor axis length at the given isophote", "unit":"arcsec", "ucd":"phys.angSize.sminAxis"}' ;
38+
COMMENT ON COLUMN geometry.data.e_b IS '{"description":"Error of the semi-minor axis length at the given isophote", "unit":"arcsec", "ucd":"stat.error;phys.angSize.sminAxis"}' ;
39+
COMMENT ON COLUMN geometry.data.pa IS '{"description":"Position angle (measured east of north)", "unit":"deg", "ucd":"pos.posAng"}' ;
40+
COMMENT ON COLUMN geometry.data.e_pa IS '{"description":"Error of the position angle", "unit":"deg", "ucd":"stat.error;pos.posAng"}' ;
41+
COMMENT ON COLUMN geometry.data.isophote IS '{"description":"Surface brightness at given level",, "unit":"mag/arcmin2", "ucd":"phot.mag.sb"}' ;
42+
COMMENT ON COLUMN geometry.data.e_isophote IS '{"description":"Error fo the surface brightness at given level",, "unit":"mag/arcmin2", "ucd":"stat.error;phot.mag.sb"}' ;
43+
44+
COMMIT;

0 commit comments

Comments
 (0)