Skip to content

Commit 3daa16c

Browse files
committed
new vision of the photometry catalog
1 parent 3448ff3 commit 3daa16c

3 files changed

Lines changed: 130 additions & 170 deletions

File tree

postgres/drafts/05_photosys.sql

Lines changed: 65 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
BEGIN;
22

3-
4-
CREATE SCHEMA IF NOT EXISTS photsys ;
3+
CREATE SCHEMA IF NOT EXISTS photometry ;
4+
COMMENT ON SCHEMA photometry IS 'Catalog of the photometry';
55

66
-----------------------------------------------
77
--------- Spectral regions --------------------
@@ -21,9 +21,9 @@ CREATE SCHEMA IF NOT EXISTS photsys ;
2121
-----------------------------------------------
2222
--------- Magnitude System Type --------------
2323

24-
CREATE TYPE photsys.MagSysType AS ENUM ( 'Vega', 'AB', 'ST' ) ;
24+
CREATE TYPE photometry.MagSysType AS ENUM ( 'Vega', 'AB', 'ST' ) ;
2525

26-
COMMENT ON TYPE photsys.MagSysType IS '{
26+
COMMENT ON TYPE photometry.MagSysType IS '{
2727
"Vega" : "The Vega magnitude system uses the Vega as the standard star with an apparent magnitude of zero, regardless of the wavelength filter. The spectrum of Vega used to define this system is a composite spectrum of empirical and synthetic spectra (Bohlin & Gilliland, 2004AJ....127.3508B). m(Vega) = -2.5*log10(F/FVega), where F is flux of an object, and FVega is the calibrated spectrum of Vega.",
2828
"AB" : "The AB magnitude system uses flat reference spectrum in frequency space. The conversion is chosen such that the V-magnitude corresponds roughly to that in the Johnson system. The monochromatic AB magnitude is defined as m(AB) = 8.9 -2.5*log10(Fv[Jy]) = -48.6 -2.5*log10(Fv[erg s^−1 cm^−2 Hz^−1]), where Fv is the spectral flux density.",
2929
"ST" : "The ST magnitude system uses flat reference spectrum in wavelength space. The conversion is chosen such that the V-magnitude corresponds roughly to that in the Johnson system. The monochromatic ST magnitude is defined as m(ST) = -21.1 -2.5*log10(Flambda[erg s^−1 cm^−2 Angstrom^−1]), where Flambda is the spectral flux density."
@@ -33,20 +33,20 @@ COMMENT ON TYPE photsys.MagSysType IS '{
3333
-----------------------------------------------
3434
--------- Photometric systems -----------------
3535

36-
CREATE TABLE photsys.photsys (
36+
CREATE TABLE photometry.systems (
3737
id Text PRIMARY KEY
3838
, description Text NOT NULL
3939
, bibcode Char(19) UNIQUE
4040
, svo_id Text UNIQUE
4141
) ;
4242

43-
COMMENT ON TABLE photsys.photsys IS 'Photometric system' ;
44-
COMMENT ON COLUMN photsys.photsys.id IS 'Photometric system ID' ;
45-
COMMENT ON COLUMN photsys.photsys.description IS 'Description of the photometric system' ;
46-
COMMENT ON COLUMN photsys.photsys.bibcode IS '{"description" : "ADS bibcode", "url" : "https://ui.adsabs.harvard.edu/abs/", "ucd" : "meta.ref.url"}' ;
47-
COMMENT ON COLUMN photsys.photsys.svo_id IS '{"description" : "Query to the Spanish Virtual Observatory", "url" : "http://svo2.cab.inta-csic.es/theory/fps/index.php?", "ucd" : "meta.ref.url"}' ;
43+
COMMENT ON TABLE photometry.systems IS 'Photometric system' ;
44+
COMMENT ON COLUMN photometry.systems.id IS 'Photometric system ID' ;
45+
COMMENT ON COLUMN photometry.systems.description IS 'Description of the photometric system' ;
46+
COMMENT ON COLUMN photometry.systems.bibcode IS '{"description" : "ADS bibcode", "url" : "https://ui.adsabs.harvard.edu/abs/", "ucd" : "meta.ref.url"}' ;
47+
COMMENT ON COLUMN photometry.systems.svo_id IS '{"description" : "Query to the Spanish Virtual Observatory", "url" : "http://svo2.cab.inta-csic.es/theory/fps/index.php?", "ucd" : "meta.ref.url"}' ;
4848

49-
INSERT INTO photsys.photsys VALUES
49+
INSERT INTO photometry.systems VALUES
5050
( 'UBVRIJHKL' , 'Johnson UBVRIJHKL photometric system' , '1965CoLPL...3...73J', 'gname=Generic&gname2=Johnson_UBVRIJHKL' )
5151
, ( 'Cousins' , 'Cousins (Rc,Ic) photometric system' , '1976MmRAS..81...25C', 'gname=Generic&gname2=Cousins' )
5252
, ( 'Bessell' , 'Bessell photometric system' , '1990PASP..102.1181B', 'gname=Generic&gname2=Bessell' )
@@ -81,76 +81,76 @@ INSERT INTO photsys.photsys VALUES
8181

8282

8383
-------------- Filter description ---------------
84-
CREATE TABLE photsys.bands (
84+
CREATE TABLE photometry.bands (
8585
id text PRIMARY KEY
8686
, name text NOT NULL
87-
, photsys text NOT NULL REFERENCES photsys.photsys (id) ON DELETE restrict ON UPDATE cascade
87+
, photsys text NOT NULL REFERENCES photometry.systems (id) ON DELETE restrict ON UPDATE cascade
8888
, waveref real NOT NULL
8989
, fwhm real NOT NULL
90-
, relext real
90+
, extinction real
9191
, svo_id text UNIQUE
9292
) ;
93-
CREATE INDEX ON photsys.bands (waveref) ;
94-
CREATE INDEX ON photsys.bands (name) ;
95-
CREATE INDEX ON photsys.bands (photsys) ;
93+
CREATE INDEX ON photometry.bands (waveref) ;
94+
CREATE INDEX ON photometry.bands (name) ;
95+
CREATE INDEX ON photometry.bands (photsys) ;
9696

97-
COMMENT ON TABLE photsys.bands IS 'List of filters' ;
98-
COMMENT ON COLUMN photsys.bands.id IS 'Filter ID' ;
99-
COMMENT ON COLUMN photsys.bands.name IS 'Common filter designation' ;
100-
COMMENT ON COLUMN photsys.bands.photsys IS 'Photometric system' ;
101-
COMMENT ON COLUMN photsys.bands.waveref IS 'The reference wavelength of the filter transmission' ;
102-
COMMENT ON COLUMN photsys.bands.fwhm IS 'The Full Width Half Maximum of the filter transmission' ;
103-
COMMENT ON COLUMN photsys.bands.relext IS 'Relative extinction. Ratio between extintion at λref, Af, and visual extintion, Av' ;
104-
COMMENT ON COLUMN photsys.bands.svo_id IS '{"description" : "The Spanish Virtual Observatory filter ID", "url" : "http://svo2.cab.inta-csic.es/theory/fps/index.php?id=", "ucd" : "meta.ref.url"}' ;
97+
COMMENT ON TABLE photometry.bands IS 'List of filters' ;
98+
COMMENT ON COLUMN photometry.bands.id IS 'Filter ID' ;
99+
COMMENT ON COLUMN photometry.bands.name IS 'Common filter designation' ;
100+
COMMENT ON COLUMN photometry.bands.photsys IS 'Photometric system' ;
101+
COMMENT ON COLUMN photometry.bands.waveref IS 'The reference wavelength of the filter transmission' ;
102+
COMMENT ON COLUMN photometry.bands.fwhm IS 'The Full Width Half Maximum of the filter transmission' ;
103+
COMMENT ON COLUMN photometry.bands.extinction IS 'Relative extinction. Ratio between extintion at λref, Af, and visual extintion, Av' ;
104+
COMMENT ON COLUMN photometry.bands.svo_id IS '{"description" : "The Spanish Virtual Observatory filter ID", "url" : "http://svo2.cab.inta-csic.es/theory/fps/index.php?id=", "ucd" : "meta.ref.url"}' ;
105105

106106

107107
-------------- Calibrated properties -----------
108-
CREATE TABLE photsys.data (
108+
CREATE TABLE photometry.calib_bands (
109109
id text PRIMARY KEY
110-
, band text NOT NULL REFERENCES photsys.bands (id) ON DELETE restrict ON UPDATE cascade
111-
, magsys photsys.MagSysType
110+
, band text NOT NULL REFERENCES photometry.bands (id) ON DELETE restrict ON UPDATE cascade
111+
, magsys photometry.MagSysType
112112
, UNIQUE (band,magsys)
113113
) ;
114114

115-
COMMENT ON TABLE photsys.data IS 'List of calibrated bands' ;
116-
COMMENT ON COLUMN photsys.data.id IS 'Calibrated band ID' ;
117-
COMMENT ON COLUMN photsys.data.band IS 'Band ID' ;
118-
COMMENT ON COLUMN photsys.data.magsys IS 'Magnitude system' ;
119-
120-
121-
CREATE VIEW photsys.dataview AS
122-
SELECT
123-
d.*
124-
, b.name
125-
, b.waveref
126-
, b.fwhm
127-
, b.relext
128-
, b.svo_id
129-
, b.photsys
130-
, s.bibcode
131-
, s.description
132-
FROM
133-
photsys.data AS d
134-
LEFT JOIN photsys.bands AS b ON (b.id=d.band)
135-
LEFT JOIN photsys.photsys AS s ON (s.id=b.photsys)
136-
;
137-
138-
COMMENT ON VIEW photsys.dataview IS 'Band list' ;
139-
COMMENT ON COLUMN photsys.dataview.id IS 'Calibrated band ID' ;
140-
COMMENT ON COLUMN photsys.dataview.band IS 'Band ID' ;
141-
COMMENT ON COLUMN photsys.dataview.magsys IS 'Magnitude system' ;
142-
COMMENT ON COLUMN photsys.dataview.name IS '{"description":"Common filter designation","ucd":"instr.bandpass"}' ;
143-
COMMENT ON COLUMN photsys.dataview.photsys IS 'Photometric system' ;
144-
COMMENT ON COLUMN photsys.dataview.waveref IS '{"description":"Reference wavelength (pivot wavelength) of the filter transmission", "unit":"Angstrom", "ucd":"em.wl"}' ;
145-
COMMENT ON COLUMN photsys.dataview.fwhm IS '{"description":"The Full Width Half Maximum of the filter transmission", "unit":"Angstrom", "ucd":"instr.bandwidth" }' ;
146-
COMMENT ON COLUMN photsys.dataview.relext IS 'Relative extinction. Ratio between extintion at λref, Af, and visual extintion, Av' ;
147-
COMMENT ON COLUMN photsys.dataview.svo_id IS '{"description" : "The Spanish Virtual Observatory filter ID", "url" : "http://svo2.cab.inta-csic.es/theory/fps/index.php?id=", "ucd" : "meta.ref.ivoid;meta.ref.url"}' ;
148-
COMMENT ON COLUMN photsys.dataview.description IS 'Description of the photometric system' ;
149-
COMMENT ON COLUMN photsys.dataview.bibcode IS '{"description" : "ADS bibcode", "url" : "https://ui.adsabs.harvard.edu/abs/", "ucd" : "meta.ref.url"}' ;
115+
COMMENT ON TABLE photometry.calib_bands IS 'List of calibrated bands' ;
116+
COMMENT ON COLUMN photometry.calib_bands.id IS 'Calibrated band ID' ;
117+
COMMENT ON COLUMN photometry.calib_bands.band IS 'Band ID' ;
118+
COMMENT ON COLUMN photometry.calib_bands.magsys IS 'Magnitude system' ;
119+
120+
121+
-- CREATE VIEW photometry.calib_bandsview AS
122+
-- SELECT
123+
-- d.*
124+
-- , b.name
125+
-- , b.waveref
126+
-- , b.fwhm
127+
-- , b.extinction
128+
-- , b.svo_id
129+
-- , b.photsys
130+
-- , s.bibcode
131+
-- , s.description
132+
-- FROM
133+
-- photometry.calib_bands AS d
134+
-- LEFT JOIN photometry.bands AS b ON (b.id=d.band)
135+
-- LEFT JOIN photometry.systems AS s ON (s.id=b.photsys)
136+
-- ;
137+
--
138+
-- COMMENT ON VIEW photometry.calib_bandsview IS 'Band list' ;
139+
-- COMMENT ON COLUMN photometry.calib_bandsview.id IS 'Calibrated band ID' ;
140+
-- COMMENT ON COLUMN photometry.calib_bandsview.band IS 'Band ID' ;
141+
-- COMMENT ON COLUMN photometry.calib_bandsview.magsys IS 'Magnitude system' ;
142+
-- COMMENT ON COLUMN photometry.calib_bandsview.name IS '{"description":"Common filter designation","ucd":"instr.bandpass"}' ;
143+
-- COMMENT ON COLUMN photometry.calib_bandsview.photsys IS 'Photometric system' ;
144+
-- COMMENT ON COLUMN photometry.calib_bandsview.waveref IS '{"description":"Reference wavelength (pivot wavelength) of the filter transmission", "unit":"Angstrom", "ucd":"em.wl"}' ;
145+
-- COMMENT ON COLUMN photometry.calib_bandsview.fwhm IS '{"description":"The Full Width Half Maximum of the filter transmission", "unit":"Angstrom", "ucd":"instr.bandwidth" }' ;
146+
-- COMMENT ON COLUMN photometry.calib_bandsview.extinction IS 'Relative extinction. Ratio between extintion at λref, Af, and visual extintion, Av' ;
147+
-- COMMENT ON COLUMN photometry.calib_bandsview.svo_id IS '{"description" : "The Spanish Virtual Observatory filter ID", "url" : "http://svo2.cab.inta-csic.es/theory/fps/index.php?id=", "ucd" : "meta.ref.ivoid;meta.ref.url"}' ;
148+
-- COMMENT ON COLUMN photometry.calib_bandsview.description IS 'Description of the photometric system' ;
149+
-- COMMENT ON COLUMN photometry.calib_bandsview.bibcode IS '{"description" : "ADS bibcode", "url" : "https://ui.adsabs.harvard.edu/abs/", "ucd" : "meta.ref.url"}' ;
150150

151151

152152
--------------- DATA -----------------
153-
COPY photsys.bands (id,name,photsys,waveref,fwhm,relext,svo_id) FROM STDIN;
153+
COPY photometry.bands (id,name,photsys,waveref,fwhm,extinction,svo_id) FROM STDIN;
154154
FUV FUV GALEX 1535.08 233.93 2.62759 GALEX/GALEX.FUV
155155
NUV NUV GALEX 2300.78 795.19 2.85878 GALEX/GALEX.NUV
156156
UVW2 UVW2 Swift 2054.61 584.89 2.99964 Swift/UVOT.UVW2
@@ -256,7 +256,7 @@ In In GSC2 6793.20 2132.52 0.76550 Palomar/GSC2.In
256256
\.
257257

258258

259-
COPY photsys.data (id,band,magsys) FROM STDIN;
259+
COPY photometry.calib_bands (id,band,magsys) FROM STDIN;
260260
FUV FUV AB
261261
NUV NUV AB
262262
UVW2 UVW2 Vega

postgres/drafts/08_photometry.sql

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
BEGIN;
2+
3+
------------------------------------------------------------------
4+
-------- Photometry catalog (level 1) ---------
5+
------------------------------------------------------------------
6+
------------------ Methods -------------------------------------
7+
-- Visual:
8+
-- -> magVisual
9+
-- -> sizeVisual
10+
-- (in fact, it corresponds to the limiting isophote)
11+
-- Total
12+
-- (Asymptotic extrapolation when aperture size -> Inf) :
13+
-- -> magTotal -> size%total
14+
-- Model:
15+
-- model -> magModel
16+
-- -> size%model
17+
-- Petrosian:
18+
-- -> Rpetro -> aperture -> magPetro -> size%petro
19+
-- Kron:
20+
-- -> Rkron -> aperture -> magKron
21+
------------------------------------------------------------------
22+
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" }' ;
25+
26+
27+
CREATE TABLE photometry.total (
28+
record_id Text NOT NULL REFERENCES layer0.records(id) ON UPDATE cascade ON DELETE restrict
29+
, band text NOT NULL REFERENCES photometry.calib_bands (id) ON DELETE restrict ON UPDATE cascade
30+
, mag real NOT NULL CHECK ( mag > -1 and mag < 30 )
31+
, e_mag real CHECK ( e_mag > 0 and e_mag < 0.5 )
32+
, method photometry.MagMethodType NOT NULL CHECK ( method IN ('psf', 'visual', 'asymptotic', 'model', 'petrosian', 'kron') )
33+
, PRIMARY KEY (record_id, method, band)
34+
);
35+
CREATE INDEX IF NOT EXISTS ON photometry.total (band) ;
36+
CREATE INDEX IF NOT EXISTS ON photometry.total (method) ;
37+
38+
COMMENT ON TABLE photometry.total IS 'Catalog of the total magnitudes';
39+
COMMENT ON COLUMN photometry.total.record_id IS 'Record ID';
40+
COMMENT ON COLUMN photometry.total.band IS 'Calibrated passband ID';
41+
COMMENT ON COLUMN photometry.total.mag IS '{"description":"Total (PSF|model|asymptotic|etc.) magnitude", "unit":"mag", "ucd":"phot.mag"}';
42+
COMMENT ON COLUMN photometry.total.e_mag IS '{"description":"Error of the total magnitude", "unit":"mag", "ucd":"stat.error;phot.mag"}';
43+
COMMENT ON COLUMN photometry.total.method IS 'Photometry method type (PSF, Kron, etc.)' ;
44+
45+
46+
CREATE TABLE photometry.isophotal (
47+
record_id Text NOT NULL REFERENCES layer0.records(id) ON UPDATE cascade ON DELETE restrict
48+
, band text NOT NULL REFERENCES photometry.calib_bands (id) ON DELETE restrict ON UPDATE cascade
49+
, mag real NOT NULL CHECK ( mag > -1 and mag < 30 )
50+
, e_mag real CHECK ( e_mag > 0 and e_mag < 0.5 )
51+
, isophote real NOT NULL CHECK ( mag > -1 and mag < 30 )
52+
, PRIMARY KEY (record_id, method, band, isophote)
53+
);
54+
CREATE INDEX IF NOT EXISTS ON photometry.total (band) ;
55+
CREATE INDEX IF NOT EXISTS ON photometry.total (method) ;
56+
CREATE INDEX IF NOT EXISTS ON photometry.total (isophote) ;
57+
58+
COMMENT ON TABLE photometry.isophotal IS 'Catalog of the isophotal magnitudes';
59+
COMMENT ON COLUMN photometry.isophotal.record_id IS 'Record ID';
60+
COMMENT ON COLUMN photometry.isophotal.band IS 'Calibrated passband ID';
61+
COMMENT ON COLUMN photometry.isophotal.mag IS '{"description":"Isophotal magnitude", "unit":"mag", "ucd":"phot.mag"}';
62+
COMMENT ON COLUMN photometry.isophotal.e_mag IS '{"description":"Error of the isophotal magnitude", "unit":"mag", "ucd":"stat.error;phot.mag"}';
63+
COMMENT ON COLUMN photometry.isophotal.isophote IS 'Isophote level' ;
64+
65+
COMMIT;

postgres/drafts/08_totalmag.sql

Lines changed: 0 additions & 105 deletions
This file was deleted.

0 commit comments

Comments
 (0)