Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data release photometry for lightcurve panel #543

Merged
merged 11 commits into from
Dec 24, 2023
Merged
5 changes: 4 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@
import dash
import dash_bootstrap_components as dbc
from dash.long_callback import DiskcacheLongCallbackManager
from dash import DiskcacheManager

# import jpype

@@ -24,6 +25,7 @@

cache = diskcache.Cache("./cache")
long_callback_manager = DiskcacheLongCallbackManager(cache)
background_callback_manager = DiskcacheManager(cache)

args = yaml.load(open('config.yml'), yaml.Loader)

@@ -56,7 +58,8 @@
"name": "viewport",
"content": "width=device-width, initial-scale=1"
}],
long_callback_manager=long_callback_manager
long_callback_manager=long_callback_manager,
background_callback_manager=background_callback_manager,
)


125 changes: 82 additions & 43 deletions apps/cards.py
Original file line number Diff line number Diff line change
@@ -33,6 +33,43 @@
import numpy as np
import urllib

lc_help = r"""
##### Difference magnitude

Circles (●) with error bars show valid alerts that pass the Fink quality cuts.
In addition, the _Difference magnitude_ view shows:
- upper triangles with errors (▲), representing alert measurements that do not satisfy Fink quality cuts, but are nevetheless contained in the history of valid alerts and used by classifiers.
- lower triangles (▽), representing 5-sigma magnitude limit in difference image based on PSF-fit photometry contained in the history of valid alerts.

If the `Color` switch is turned on, the view also shows the panel with `g - r` color, estimated by combining nearby (closer than 0.3 days) measurements in two filters.

##### DC magnitude
DC magnitude is computed by combining the nearest reference image catalog magnitude (`magnr`),
differential magnitude (`magpsf`), and `isdiffpos` (positive or negative difference image detection) as follows:
$$
m_{DC} = -2.5\log_{10}(10^{-0.4m_{magnr}} + \texttt{sign} 10^{-0.4m_{magpsf}})
$$

where `sign` = 1 if `isdiffpos` = 't' or `sign` = -1 if `isdiffpos` = 'f'.
Before using the nearest reference image source magnitude (`magnr`), you will need
to ensure the source is close enough to be considered an association
(e.g., `distnr` $\leq$ 1.5 arcsec). It is also advised you check the other associated metrics
(`chinr` and/or `sharpnr`) to ensure it is a point source. ZTF recommends
0.5 $\leq$ `chinr` $\leq$ 1.5 and/or -0.5 $\leq$ `sharpnr` $\leq$ 0.5.

The view also shows, with dashed horizontal lines, the levels corresponding to the magnitudes of the nearest reference image catalog entry (`magnr`) used in computing DC magnitudes.

This view may be augmented with the photometric points from [ZTF Data Releases](https://www.ztf.caltech.edu/ztf-public-releases.html) by clicking `Get DR photometry` button. The points will be shown with semi-transparent dots (•).

##### DC flux
DC flux (in Jansky) is constructed from DC magnitude by using the following:
$$
f_{DC} = 3631 \times 10^{-0.4m_{DC}}
$$

Note that we display the flux in milli-Jansky.
"""

def card_lightcurve_summary():
""" Add a card containing the lightcurve

@@ -41,50 +78,18 @@ def card_lightcurve_summary():
card: dbc.Card
Card with the cutouts drawn inside
"""

lc_help = dcc.Markdown(
"""
##### Difference magnitude

Circles (●) with error bars show valid alerts that pass the Fink quality cuts.
In addition, the _Difference magnitude_ view shows:
- upper triangles with errors (▲), representing alert measurements that do not satisfy Fink quality cuts, but are nevetheless contained in the history of valid alerts and used by classifiers.
- lower triangles (▽), representing 5-sigma magnitude limit in difference image based on PSF-fit photometry contained in the history of valid alerts.

##### DC magnitude
DC magnitude is computed by combining the nearest reference image catalog magnitude (`magnr`),
differential magnitude (`magpsf`), and `isdiffpos` (positive or negative difference image detection) as follows:
$$
m_{DC} = -2.5\\log_{10}(10^{-0.4m_{magnr}} + \\texttt{sign} 10^{-0.4m_{magpsf}})
$$

where `sign` = 1 if `isdiffpos` = 't' or `sign` = -1 if `isdiffpos` = 'f'.
Before using the nearest reference image source magnitude (`magnr`), you will need
to ensure the source is close enough to be considered an association
(e.g., `distnr` $\\leq$ 1.5 arcsec). It is also advised you check the other associated metrics
(`chinr` and/or `sharpnr`) to ensure it is a point source. ZTF recommends
0.5 $\\leq$ `chinr` $\\leq$ 1.5 and/or -0.5 $\\leq$ `sharpnr` $\\leq$ 0.5.

##### DC flux
DC flux (in Jansky) is constructed from DC magnitude by using the following:
$$
f_{DC} = 3631 \\times 10^{-0.4m_{DC}}
$$

Note that we display the flux in milli-Jansky.
""", mathjax=True
)

card = dmc.Paper(
[
dcc.Graph(
id='lightcurve_cutouts',
style={
'width': '100%',
'height': '30pc'
},
config={'displayModeBar': False},
className="mb-2"
loading(
dcc.Graph(
id='lightcurve_cutouts',
style={
'width': '100%',
'height': '30pc'
},
config={'displayModeBar': False},
className="mb-2"
)
),
dbc.Row(
dbc.Col(
@@ -101,7 +106,41 @@ def card_lightcurve_summary():
)
)
),
help_popover(lc_help, 'help_lc'),
dmc.Group(
[
dmc.Switch(
"Color",
id='lightcurve_show_color',
color='gray',
radius='xl',
size='sm',
persistence=True
),
dmc.Button(
"Get DR photometry",
id='lightcurve_request_release',
variant="outline",
color='gray',
radius='xl', size='xs',
compact=False,
),
help_popover(
dcc.Markdown(
lc_help, mathjax=True
),
'help_lc',
trigger=dmc.ActionIcon(
DashIconify(icon="mdi:help"),
id='help_lc',
color='gray',
variant="outline",
radius='xl',
size='md',
)
),
],
position='center', align='center'
)
], radius='xl', p='md', shadow='xl', withBorder=True
)
return card
Loading