Skip to content

Commit 29e1d90

Browse files
committed
Added functionality into package for easy usage of the
`sims_skybrightness` package and also contains scripts for calculating m5 created before these new developments. - Added script for calculating m5 values from new sims_skybrightness - Added files with codes and test to get airmass dependent bandpass modified: obscond/__init__.py new file: obscond/atmosphere.py new file: tests/test_bandpasses.py - added tests for atmospheric inputs - Added module to calculate skybrightness and fixed it new file: obscond/skybrightness.py - Added Demo and files for demo modified: MANIFEST.in new file: examples/Demo_SkyBrightness.ipynb modified: obscond/__init__.py new file: obscond/example_data/README.md new file: obscond/example_data/example_pointings.csv modified: setup.py - Bumped version modified: obscond/version.py
1 parent c02a26e commit 29e1d90

12 files changed

+737
-4
lines changed

MANIFEST.in

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
include example_data/*.md
22
include example_data/*.txt
3+
include example_data/*.csv
34

examples/Demo_SkyBrightness.ipynb

+361
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,361 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"metadata": {
7+
"collapsed": true
8+
},
9+
"outputs": [],
10+
"source": [
11+
"import os"
12+
]
13+
},
14+
{
15+
"cell_type": "code",
16+
"execution_count": 2,
17+
"metadata": {
18+
"collapsed": true
19+
},
20+
"outputs": [],
21+
"source": [
22+
"from lsst.sims.photUtils import BandpassDict"
23+
]
24+
},
25+
{
26+
"cell_type": "code",
27+
"execution_count": 3,
28+
"metadata": {
29+
"collapsed": false
30+
},
31+
"outputs": [],
32+
"source": [
33+
"import pandas as pd"
34+
]
35+
},
36+
{
37+
"cell_type": "code",
38+
"execution_count": 4,
39+
"metadata": {
40+
"collapsed": true
41+
},
42+
"outputs": [],
43+
"source": [
44+
"import obscond"
45+
]
46+
},
47+
{
48+
"cell_type": "code",
49+
"execution_count": 5,
50+
"metadata": {
51+
"collapsed": false
52+
},
53+
"outputs": [],
54+
"source": [
55+
"hwbpDict, TotbpDict = BandpassDict.loadBandpassesFromFiles()"
56+
]
57+
},
58+
{
59+
"cell_type": "code",
60+
"execution_count": 9,
61+
"metadata": {
62+
"collapsed": false
63+
},
64+
"outputs": [],
65+
"source": [
66+
"pointings = pd.read_csv(os.path.join(obscond.example_data_dir, 'example_pointings.csv'), index_col='obsHistID')"
67+
]
68+
},
69+
{
70+
"cell_type": "code",
71+
"execution_count": 7,
72+
"metadata": {
73+
"collapsed": false
74+
},
75+
"outputs": [],
76+
"source": [
77+
"skycalc = obscond.SkyCalculations(photparams=\"LSST\", hwBandpassDict=hwbpDict)"
78+
]
79+
},
80+
{
81+
"cell_type": "code",
82+
"execution_count": 10,
83+
"metadata": {
84+
"collapsed": false
85+
},
86+
"outputs": [
87+
{
88+
"data": {
89+
"text/html": [
90+
"<div>\n",
91+
"<table border=\"1\" class=\"dataframe\">\n",
92+
" <thead>\n",
93+
" <tr style=\"text-align: right;\">\n",
94+
" <th></th>\n",
95+
" <th>fieldRA</th>\n",
96+
" <th>fieldDec</th>\n",
97+
" <th>expMJD</th>\n",
98+
" <th>airmass</th>\n",
99+
" <th>FWHMeff</th>\n",
100+
" <th>filter</th>\n",
101+
" </tr>\n",
102+
" <tr>\n",
103+
" <th>obsHistID</th>\n",
104+
" <th></th>\n",
105+
" <th></th>\n",
106+
" <th></th>\n",
107+
" <th></th>\n",
108+
" <th></th>\n",
109+
" <th></th>\n",
110+
" </tr>\n",
111+
" </thead>\n",
112+
" <tbody>\n",
113+
" <tr>\n",
114+
" <th>230</th>\n",
115+
" <td>0.925184</td>\n",
116+
" <td>-0.478900</td>\n",
117+
" <td>59580.139555</td>\n",
118+
" <td>1.090199</td>\n",
119+
" <td>1.121968</td>\n",
120+
" <td>r</td>\n",
121+
" </tr>\n",
122+
" <tr>\n",
123+
" <th>1679570</th>\n",
124+
" <td>0.000000</td>\n",
125+
" <td>-0.794553</td>\n",
126+
" <td>62086.152635</td>\n",
127+
" <td>1.169360</td>\n",
128+
" <td>0.837221</td>\n",
129+
" <td>z</td>\n",
130+
" </tr>\n",
131+
" <tr>\n",
132+
" <th>1679569</th>\n",
133+
" <td>0.000000</td>\n",
134+
" <td>-0.794553</td>\n",
135+
" <td>62086.152218</td>\n",
136+
" <td>1.168118</td>\n",
137+
" <td>0.836687</td>\n",
138+
" <td>z</td>\n",
139+
" </tr>\n",
140+
" <tr>\n",
141+
" <th>1679568</th>\n",
142+
" <td>0.000000</td>\n",
143+
" <td>-0.794553</td>\n",
144+
" <td>62086.151802</td>\n",
145+
" <td>1.166882</td>\n",
146+
" <td>0.836156</td>\n",
147+
" <td>z</td>\n",
148+
" </tr>\n",
149+
" <tr>\n",
150+
" <th>1679567</th>\n",
151+
" <td>0.000000</td>\n",
152+
" <td>-0.794553</td>\n",
153+
" <td>62086.151385</td>\n",
154+
" <td>1.165654</td>\n",
155+
" <td>0.835628</td>\n",
156+
" <td>z</td>\n",
157+
" </tr>\n",
158+
" </tbody>\n",
159+
"</table>\n",
160+
"</div>"
161+
],
162+
"text/plain": [
163+
" fieldRA fieldDec expMJD airmass FWHMeff filter\n",
164+
"obsHistID \n",
165+
"230 0.925184 -0.478900 59580.139555 1.090199 1.121968 r\n",
166+
"1679570 0.000000 -0.794553 62086.152635 1.169360 0.837221 z\n",
167+
"1679569 0.000000 -0.794553 62086.152218 1.168118 0.836687 z\n",
168+
"1679568 0.000000 -0.794553 62086.151802 1.166882 0.836156 z\n",
169+
"1679567 0.000000 -0.794553 62086.151385 1.165654 0.835628 z"
170+
]
171+
},
172+
"execution_count": 10,
173+
"metadata": {},
174+
"output_type": "execute_result"
175+
}
176+
],
177+
"source": [
178+
"pointings[['fieldRA', 'fieldDec', 'expMJD', 'airmass', 'FWHMeff', 'filter']].head()"
179+
]
180+
},
181+
{
182+
"cell_type": "code",
183+
"execution_count": 11,
184+
"metadata": {
185+
"collapsed": false
186+
},
187+
"outputs": [
188+
{
189+
"name": "stderr",
190+
"output_type": "stream",
191+
"text": [
192+
"WARNING: ErfaWarning: ERFA function \"taiutc\" yielded 1 of \"dubious year (Note 4)\" [astropy._erfa.core]\n",
193+
"WARNING: ErfaWarning: ERFA function \"utcut1\" yielded 1 of \"dubious year (Note 3)\" [astropy._erfa.core]\n",
194+
"/Users/rbiswas/soft/LSST/DarwinX86/healpy/1.8.1.lsst2+5/lib/python/healpy-1.8.1-py2.7-macosx-10.6-x86_64.egg/healpy/pixelfunc.py:1045: FutureWarning: comparison to `None` will result in an elementwise object comparison in the future.\n",
195+
" if phi == None:\n"
196+
]
197+
},
198+
{
199+
"data": {
200+
"text/plain": [
201+
"21.260974999286908"
202+
]
203+
},
204+
"execution_count": 11,
205+
"metadata": {},
206+
"output_type": "execute_result"
207+
}
208+
],
209+
"source": [
210+
"skycalc.skymag('r', 0.925, -0.4789, 59580.14)"
211+
]
212+
},
213+
{
214+
"cell_type": "code",
215+
"execution_count": 12,
216+
"metadata": {
217+
"collapsed": false
218+
},
219+
"outputs": [
220+
{
221+
"data": {
222+
"text/plain": [
223+
"24.000968703794982"
224+
]
225+
},
226+
"execution_count": 12,
227+
"metadata": {},
228+
"output_type": "execute_result"
229+
}
230+
],
231+
"source": [
232+
"skycalc.fiveSigmaDepth('r', 1.09, 1.12, sm=skycalc.sm)"
233+
]
234+
},
235+
{
236+
"cell_type": "code",
237+
"execution_count": 13,
238+
"metadata": {
239+
"collapsed": false
240+
},
241+
"outputs": [
242+
{
243+
"data": {
244+
"text/html": [
245+
"<div>\n",
246+
"<table border=\"1\" class=\"dataframe\">\n",
247+
" <thead>\n",
248+
" <tr style=\"text-align: right;\">\n",
249+
" <th></th>\n",
250+
" <th>filtSkyBrightness</th>\n",
251+
" <th>fiveSigmaDepth</th>\n",
252+
" </tr>\n",
253+
" <tr>\n",
254+
" <th>obsHistID</th>\n",
255+
" <th></th>\n",
256+
" <th></th>\n",
257+
" </tr>\n",
258+
" </thead>\n",
259+
" <tbody>\n",
260+
" <tr>\n",
261+
" <th>230.0</th>\n",
262+
" <td>21.261849</td>\n",
263+
" <td>23.999459</td>\n",
264+
" </tr>\n",
265+
" <tr>\n",
266+
" <th>1679570.0</th>\n",
267+
" <td>19.279404</td>\n",
268+
" <td>23.082695</td>\n",
269+
" </tr>\n",
270+
" <tr>\n",
271+
" <th>1679569.0</th>\n",
272+
" <td>19.280432</td>\n",
273+
" <td>23.083869</td>\n",
274+
" </tr>\n",
275+
" <tr>\n",
276+
" <th>1679568.0</th>\n",
277+
" <td>19.281451</td>\n",
278+
" <td>23.085036</td>\n",
279+
" </tr>\n",
280+
" <tr>\n",
281+
" <th>1679567.0</th>\n",
282+
" <td>19.282467</td>\n",
283+
" <td>23.086197</td>\n",
284+
" </tr>\n",
285+
" <tr>\n",
286+
" <th>1679566.0</th>\n",
287+
" <td>19.283476</td>\n",
288+
" <td>23.087351</td>\n",
289+
" </tr>\n",
290+
" <tr>\n",
291+
" <th>1679565.0</th>\n",
292+
" <td>19.284477</td>\n",
293+
" <td>23.088500</td>\n",
294+
" </tr>\n",
295+
" <tr>\n",
296+
" <th>1679564.0</th>\n",
297+
" <td>19.285474</td>\n",
298+
" <td>23.089642</td>\n",
299+
" </tr>\n",
300+
" <tr>\n",
301+
" <th>1679563.0</th>\n",
302+
" <td>19.286466</td>\n",
303+
" <td>23.092942</td>\n",
304+
" </tr>\n",
305+
" <tr>\n",
306+
" <th>1679562.0</th>\n",
307+
" <td>20.258438</td>\n",
308+
" <td>23.700729</td>\n",
309+
" </tr>\n",
310+
" </tbody>\n",
311+
"</table>\n",
312+
"</div>"
313+
],
314+
"text/plain": [
315+
" filtSkyBrightness fiveSigmaDepth\n",
316+
"obsHistID \n",
317+
"230.0 21.261849 23.999459\n",
318+
"1679570.0 19.279404 23.082695\n",
319+
"1679569.0 19.280432 23.083869\n",
320+
"1679568.0 19.281451 23.085036\n",
321+
"1679567.0 19.282467 23.086197\n",
322+
"1679566.0 19.283476 23.087351\n",
323+
"1679565.0 19.284477 23.088500\n",
324+
"1679564.0 19.285474 23.089642\n",
325+
"1679563.0 19.286466 23.092942\n",
326+
"1679562.0 20.258438 23.700729"
327+
]
328+
},
329+
"execution_count": 13,
330+
"metadata": {},
331+
"output_type": "execute_result"
332+
}
333+
],
334+
"source": [
335+
"skycalc.calculatePointings(pointings)"
336+
]
337+
}
338+
],
339+
"metadata": {
340+
"anaconda-cloud": {},
341+
"kernelspec": {
342+
"display_name": "Python [default]",
343+
"language": "python",
344+
"name": "python2"
345+
},
346+
"language_info": {
347+
"codemirror_mode": {
348+
"name": "ipython",
349+
"version": 2
350+
},
351+
"file_extension": ".py",
352+
"mimetype": "text/x-python",
353+
"name": "python",
354+
"nbconvert_exporter": "python",
355+
"pygments_lexer": "ipython2",
356+
"version": "2.7.12"
357+
}
358+
},
359+
"nbformat": 4,
360+
"nbformat_minor": 1
361+
}

examples/test_skybrightness.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
print(getPackageDir('sims_skybrightness_data'))
2121
print('numpy', np.__version__)
2222
tot, hwbpdict = BandpassDict.loadBandpassesFromFiles()
23-
print(mCalcs(1.464, 'y', 1.676483, -1.082473, 59580.033829, 1.263038, hwbpdict))
24-
print(mCalcs(1.454958, 'y', 1.69412, -1.033972, 59580.034275, 1.258561, hwbpdict))
23+
# print(mCalcs(1.464, 'y', 1.676483, -1.082473, 59580.033829, 1.263038, hwbpdict))
24+
# print(mCalcs(1.454958, 'y', 1.69412, -1.033972, 59580.034275, 1.258561, hwbpdict))
2525
print(mCalcs(1.008652, 'g', 0.925184, -0.4789, 61044.077855, 1.086662, hwbpdict=hwbpdict))
2626
print(np.__version__)

obscond/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
from .io import *
44
from .historicalWeatherData import *
55
from .constants import *
6+
from .atmosphere import *
7+
from .skybrightness import *
68
#from .version import __version__
79
dirname = os.path.dirname(os.path.abspath(__file__))
810
example_data_dir = os.path.join(dirname, 'example_data')

0 commit comments

Comments
 (0)