-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcontent.html
More file actions
859 lines (735 loc) · 39.4 KB
/
content.html
File metadata and controls
859 lines (735 loc) · 39.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<!--
LOG of changes and updates:
- Version 1.0 (30 Apr 2019): Cloned the ExpTime calculator V1.4 and modified for different collecting areas for NRT
- Version 2.0 (17 May 2019): DMA used Marco Lam's graphical google chart work and modified to solve for Limiting Magnitude
- Version 3.0 (03 June 2019): DMA extended with a second plot with the Spectrograph options
Previous versions of the Exposure time calulutaor on which this was built were;
- Version 1.0 (19 Jun 2014): original code with guestimates for SPRAT, RISE and IO:I
- Version 1.1 ( 4 Jul 2014): reduced size of tables and tweaked text (CJD)
- Version 1.2 (20 Nov 2014): tweaked text (CJD)
- Version 1.3 (24 Apr 2015): Update IO:I H-band zeropoint (CJD)
- Version 1.4 (01 Oct 2015): Update to RINGO3 Zeropoint and Readnoise values (IAS via NRC)
- Version 2.0 (In Dev, Nov 2019): Modify to graphical output with Google Charts (DMA / MCL)
- Version 2.0.1 (In Dev, 22 Jan 2020): Fixed plotting bug, removed RINGO3 and changed default RISE filter (MCL)
** Make sure you update the version number (will be displayed) at the end of this doc **
-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>
<html>
<title>The Liverpool Telescope Instruments : Exposure Time Calculator</title>
<body>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-slider/10.6.1/css/bootstrap-slider.min.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css">
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-slider/10.6.1/bootstrap-slider.min.js"></script>
<script src="https://code.jquery.com/jquery-2.0.3.min.js" data-semver="2.0.3" data-require="jquery"></script>
<script src="jquery.chained.js"></script>
<script src="etc.js"></script>
<style type="text/css">
td {padding:0 15px 0 15px;}
input[type=number]{
width: 80px;}
</style>
<h1> Liverpool Telescope<br>Exposure Time Calculator </h1>
<!-- ................................................. -->
<!-- IMAGING ......................................... -->
<!-- ................................................. -->
<h2 id="imaging" >Imaging </h2>
<br>
<p>To use the Exposure Time Calculator (ETC), select an
<i>Instrument</i> with a corresponding <i>Binning</i> (usually 2x2)
and <i>Filter</i> from the pull-down menus. The <i>Plot Mode</i>
option is used to select whether the plot shows multiple <i>Signal to
Noise Ratios</i> (SNR), <i>Seeing Values</i> (FWHM) or <i>Sky Brightnesses</i>.
The comma separated list can be modified to the desired values.
</p>
<p><u>IMPORTANT NOTES:</u></p>
<ul>
<li><b>Mirror Reflectivity: </b> The zero points are derived with clean mirror coatings.
Mirror reflectivity will naturally degrade over time. The IO:O ZP (two reflections)
is measured to decline at a rate of 0.15mag per year. Other instruments (three reflections) are likely
to decline slightly faster than that. The most recent mirror coating was Sept 2019.</li>
<li><b>Binning: </b> We <i>strongly recommend</i> using 2x2 binning with both
IO:O and RISE. Note that we do not routinely obtain un-binned flats
for either of these instruments. Please contact us
if you plan on taking un-binned data.</li>
<li><b>Minimum Exposure Times: </b> Exposure times as low as 1 second may be
quoted by the ETC for
<a href="https://telescope.livjm.ac.uk/TelInst/Inst/IOO/">IO:O</a> and
<a href="https://telescope.livjm.ac.uk/TelInst/Inst/IOI/">IO:I</a>. However, due to shutter
effects a minimum exposure time of at least 20 seconds is strongly
recommended for IO:O; shorter exposures are unlikely to produce photometric
accuracies of less than 1%. Please refer to the IO:I webpage for information
on exposure times with this instrument. </li>
</ul>
<br><p>
<p>
Dark+10 mag corresponds to civil twilight (sun altitude < -4 degs),
Dark+6 mag to nautical twilight (sun altitude between -8 and -12 degs).
Roughly speaking, Dark+4 corresponds to observing >30 deg from a full moon;
Dark+2 to observing >30 deg from a 65% illuminated moon. We have assumed that
the moon has no affect on J and H-band imaging. </p>
<p> For further information on Sky Brightness and its relation to twilight, moon phase
and moon distance, see our
<a href="https://telescope.livjm.ac.uk/PropInst/Phase2/?sf=SkyBrightness">
Sky Brightness
</a> web-page.
See also the ING web-site on
<a href="http://www.ing.iac.es/Astronomy/observing/conditions/skybr/skybr.html">
La Palma Night-Sky Brightness
</a>.
</p>
<p> If you have any problems with or questions about this ETC, please don't hesitate to
<a href="https://telescope.livjm.ac.uk/Contact/"> contact us</a>.
</p>
<center>
<div id="curve_chart" style="width: 1000px; height: 600px" class="column"></div>
<!-- .......... INPUT DATA TABLE .......... -->
<br>
<table>
<tr>
<td id="pulldn">Log x-Axis: </td>
<td>
<input type="radio" name="logModeRadio" id="logModeOff" value="" checked onchange="calcimage();"/>Off</>
<input type="radio" name="logModeRadio" id="logModeOn" value="log" onchange="calcimage();">On</></td>
<td id="pulldn">Plot Mode: </td>
<td>
<select name="plotMode" id="plotMode" width="180" style="width: 180px" value="seeMode" onchange="calcimage();">
<option value="snrMode">SNR</option>
<option value="seeMode" selected="selected">Seeing</option>
<option value="skyMode">Sky Brightness</option>
</select>
</tr>
<tr>
<td id="pulldn">Instrument: </td>
<td>
<select name="instrument" id="instrum" width="180" style="width: 180px" onchange="calcimage();">
<option value="ioo"> IO:O</option>
<option value="ioi"> IO:I</option>
<option value="rise"> RISE</option>
</select>
</td>
<td id="pulldn"> SNR: </td>
<td>
<input type="text" name="snrText" class="constraintTextInput" id="snrText" value="10, 25, 50, 100" onchange="calcimage();">
<input name="snrSlid" id="snrSlid" data-slider-id="imSlider" type="text" data-slider-min="1" data-slider-max="100" data-slider-step="1" data-slider-value="50" onchange="calcimage();"/>
</td>
</tr>
<tr>
<td id="pulldn">Binning: </td>
<td>
<select name="binning" id="binn" width="180" style="width: 180px" onchange="calcimage();">
<option value="ioo2" class="ioo"> 2x2 </option>
<option value="ioo1" class="ioo"> 1x1 </option>
<option value="ioi1" class="ioi"> 1x1 </option>
<option value="rise2" class="rise"> 2x2 </option>
<option value="rise1" class="rise"> 1x1 </option>
</select>
</td>
<td id="pulldn">Seeing (arcsec):</td>
<td>
<input type="text" name="seeText" class="constraintTextInput" id="seeText" value="0.6, 1.2, 1.8, 2.4, 3.0" onchange="calcimage();">
<input name="seeSlid" id="seeSlid" data-slider-id="imSlider" type="text" data-slider-min="0.6" data-slider-max="4.0" data-slider-step="0.2" data-slider-value="1.2" onchange="calcimage();"/>
</td>
</tr>
<tr>
<td id="pulldn">Filter: </td>
<td>
<select name="filter" id="filt" width="180" style="width: 180px" onchange="calcimage();">
<option value="fsu" class="ioo"> SDSS-U (AB system) </option>
<option value="fbb" class="ioo"> Bessell-B (Vega) </option>
<option value="fbv" class="ioo"> Bessell-V (Vega) </option>
<option value="fsg" class="ioo"> SDSS-G (AB system) </option>
<option value="fsr" class="ioo"> SDSS-R (AB system) </option>
<option value="fsi" class="ioo"> SDSS-I (AB system) </option>
<option value="fsz" class="ioo"> SDSS-Z (AB system) </option>
<!--<option value="fjj" class="ioi"> J (IO:I) </option>-->
<option value="fhh" class="ioi"> H (Vega) </option>
<option value="frise" class="rise"> RISE V+R </option>
<option value="frise720" class="rise"> RISE 720nm (not available) </option>
</select>
</td>
<td>Sky Brightness: </td>
<td>
<input type="text" name="skyText" class="constraintTextInput" id="skyText" value="0, 2, 4, 6, 8" onchange="calcimage();">
<input name="skySlid" id="skySlid" data-slider-id="imSlider" type="text" data-slider-min="0" data-slider-max="10" data-slider-step="0.5" data-slider-value="2" onchange="calcimage();"/>
</td>
</tr>
</table>
<br>
<table>
<tr>
<td>Magnitude Min</td>
<td>
<input id="magmin" size="4" type="number" value=16 onchange="calcimage();">
</td>
<td>Magnitude Max</td>
<td>
<input id="magmax" size="4" type="number" value=22 onchange="calcimage();">
</td>
<td>Exposure Time Max</td>
<td>
<input id="exptmax" size="4" type="number" value=1200 min=200 step=200 onchange="calcimage();">
</td>
</table>
</center>
<br><br>
<h2 id="spectroscopy">Spectroscopy </h2>
<br>
<p>To use the Exposure Time Calculator (ETC), select an
<i>Instrument</i> with a corresponding <i>Binning</i> (usually 2x2)
and <i>Filter</i> from the pull-down menus. The <i>Plot Mode</i>
option is used to select whether the plot shows multiple <i>Signal to
Noise Ratios</i> (SNR), <i>Seeing Values</i> (FWHM) or <i>Sky Brightnesses</i>.
The comma separated list can be modified to the desired values.
</p>
<p><u>IMPORTANT NOTES:</u></p>
<ul>
<li><b>Mirror Reflectivity: </b> The zero points are derived with clean mirror coatings.
Mirror reflectivity will naturally degrade over time. The IO:O ZP (two reflections)
is measured to decline at a rate of 0.15mag per year. Other instruments (three reflections) are likely
to decline slightly faster than that. The most recent mirror coating was Sept 2019.</li>
<li><b>Red and Blue wavelengths: </b> the exposure times listed below are
calculated close to the peak transmission of each arm/wavelength region,
corresponding to 450 nm and 700 nm in the blue and red, respectively. </li>
<li><b>SPRAT: </b> this version of the ETC does not take into account slit
losses with SPRAT; nor does it correct for the colour of a source. </li>
</ul>
<p>
Dark+10 mag corresponds to civil twilight (sun altitude < -4 degs),
Dark+6 mag to nautical twilight (sun altitude between -8 and -12 degs).
Roughly speaking, Dark+4 corresponds to observing >30 deg from a full moon;
Dark+2 to observing >30 deg from a 65% illuminated moon.
For further information on Sky Brightness and its relation to twilight, moon
phase and moon distance, see our
<a href="https://telescope.livjm.ac.uk/PropInst/Phase2/?sf=SkyBrightness">
Sky Brightness</a> webpage.
</p>
<p> If you have any problems with or questions about this ETC, please don't
hesitate to
<a href="https://telescope.livjm.ac.uk/Contact/"> contact us</a>.
</p>
<center>
<div id="spcurve_chart" style="width: 1000px; height: 600px"></div>
<table>
<tr>
<td id="pulldn">Log x-Axis: </td>
<td>
<input type="radio" name="splogModeRadio" id="splogModeOff" value="" checked onchange="calcspec();"/>Off</>
<input type="radio" name="splogModeRadio" id="splogModeOn" value="log" onchange="calcspec();">On</></td>
<td id="pulldn">Plot Mode: </td>
<td>
<select name="spplotMode" id="spplotMode" width="180" style="width: 180px" value="spseeMode" onchange="calcspec();">
<option value="spsnrMode">SNR</option>
<option value="spseeMode" selected="selected">Seeing</option>
<option value="spskyMode">Sky Brightness</option>
</select>
</tr>
<tr>
<td id="pulldn">Instrument: </td>
<td>
<select name="spectrometer" id="spinstrum" width="260" style="width: 260px" onchange="calcspec();">
<option value="frodo"> FRODOspec</option>
<option value="sprat"> SPRAT</option>
</select>
</td>
<td id="pulldn"> SNR: </td>
<td>
<input type="text" name="spsnrText" class="spconstraintTextInput" id="spsnrText" value="10, 25, 50, 100" onchange="calcspec();">
<input name="spsnrSlid" id="spsnrSlid" data-slider-id="spSlider" type="text" data-slider-min="1" data-slider-max="100" data-slider-step="1" data-slider-value="50" onchange="calcspec();"/>
</td>
</tr>
<tr>
<td id="pulldn">Slit: </td>
<td>
<select name="slitwidth" id="spslit" width="260" style="width: 260px" onchange="calcspec();">
<option value="ifu" class="frodo"> IFU fibre bundle </option>
<option value="spratslit" class="sprat"> SPRAT 2 arcsec slit </option>
</select>
</td>
<td id="pulldn"> Seeing (arcsec): </td>
<td>
<input type="text" name="spseeText" class="spconstraintTextInput" id="spseeText" value="0.6, 1.2, 1.8, 2.4, 3.0" onchange="calcspec();">
<input name="spseeSlid" id="spseeSlid" data-slider-id="spSlider" type="text" data-slider-min="0.6" data-slider-max="4.0" data-slider-step="0.2" data-slider-value="1.2" onchange="calcspec();"/>
</td>
</tr>
<tr>
<td id="pulldn">Spectrometer arm: </td>
<td>
<select name="specarm" id="sparm" width="260" style="width: 260px" onchange="calcspec();">
<option value="frredarmv" class="frodo"> FRODOspec Red arm (VPH) </option>
<option value="frbluarmv" class="frodo"> FRODOspec Blue arm (VPH) </option>
<option value="frredarm" class="frodo"> FRODOspec Red arm (low res) </option>
<option value="frbluarm" class="frodo"> FRODOspec Blue arm (low res) </option>
<option value="spredarm" class="sprat"> SPRAT Red region </option>
<option value="spbluarm" class="sprat"> SPRAT Blue region </option>
</select>
</td>
<td>Sky Brightness: </td>
<td>
<input type="text" name="spskyText" class="spconstraintTextInput" id="spskyText" value="0, 2, 4, 6, 8" onchange="calcspec();">
<input name="spskySlid" id="spskySlid" data-slider-id="spSlider" type="text" data-slider-min="0" data-slider-max="10" data-slider-step="0.5" data-slider-value="2" onchange="calcspec();"/>
</td>
</tr>
</tr>
</table>
<br>
<table>
<tr>
<td>Magnitude Min</td>
<td>
<input id="spmagmin" size="4" type="number" value=12 onchange="calcspec();">
</td>
<td>Magnitude Max</td>
<td>
<input id="spmagmax" size="4" type="number" value=20 onchange="calcspec();">
</td>
<td>Exposure Time Max</td>
<td>
<input id="spexptmax" size="4" type="number" value=1200 min=200 step=200 onchange="calcspec();">
</td>
</table>
<br><br>
<br><hr>
<br><br><br>
<p> <i>(Version 2.0.1 - 21 Jan 2020, Marco Lam and Doug Arnold)</i> </p>
</center>
<!-- ......................................................................... -->
<!-- ... The rest of this file is JavaScript code within the <script> tags ... -->
<!-- ......................................................................... -->
<script>
/*
* This script defines the calculate() function called by the event handlers
* in HTML above. The function reads values from
<input> elements or
<select>
* pull-down options, calculates exposure times, then displays the results
* in
<span> elements.
*/
// TIP: variables declared as "var" are Global variables. However,
// variables declared inside a function as "var" are local to the function.
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(calcimage);
google.charts.setOnLoadCallback(calcspec);
var slider1 = new Slider("#snrSlid", {
formatter: function(value) {
return value;
}
});
var slider2 = new Slider("#seeSlid", {
formatter: function(value) {
return value;
}
});
var slider3 = new Slider("#skySlid", {
formatter: function(value) {
return value;
}
});
var slider4 = new Slider("#spseeSlid", {
formatter: function(value) {
return value;
}
});
var slider5 = new Slider("#spsnrSlid", {
formatter: function(value) {
return value;
}
});
var slider6 = new Slider("#spskySlid", {
formatter: function(value) {
return value;
}
});
function calcimage() {
var chart = new google.visualization.LineChart(document.getElementById('curve_chart'));
// Look up the input elements in the document for IMAGING
var instrum = document.getElementById("instrum").value;
var binn = document.getElementById("binn").value;
var filt = document.getElementById("filt").value;
var seeing = +document.getElementById("seeSlid").value;
var seeText = document.getElementById("seeText").value;
var snr = +document.getElementById("snrSlid").value;
var snrText = document.getElementById("snrText").value;
var sky = +document.getElementById("skySlid").value;
var skyText = document.getElementById("skyText").value;
var magmin = document.getElementById("magmin").value;
var magmax = document.getElementById("magmax").value;
var exptmax = document.getElementById("exptmax").value;
var plotMode = document.getElementById("plotMode").value;
if (document.getElementById('logModeOn').checked) {
var logMode = 'log'
} else {
var logMode = ''
}
// FIRST PULL-DOWN ***
// Look-up tables of variables - INSTRUMENT CHARACTERISTICS
if (instrum == "ioo") {
var pixscale = 0.15;
var darkcurrent = 0;
var readnoise = 10;
} else if (instrum == "ioi") {
var pixscale = 0.18;
var darkcurrent = 0;
var readnoise = 17;
} else { // RISE
var pixscale = 0.54;
var darkcurrent = 0;
var readnoise = 10;
};
// SECOND PULL-DOWN ***
// Look-up tables of variables -BINNING
if (binn == "ioo2" || binn == "rise2") {
var bin = 2;
} else {
var bin = 1;
};
// THIRD PULL-DOWN ***
// Look-up tables of variables - ZERO POINTS & SKY (inst and filter specific)
// NB. ZPs should correspond to 1 electron/second (i.e. corrected for GAIN)
// For skybrightness data see:
// http://www.ing.iac.es/Astronomy/observing/conditions/skybr/skybr.html
// ...
if (filt == "fsu") { // IO:O sdss_u
var zp = 22.17; // 21.30 from old ETC, modified by CMC in Jan 2016 using Helen Jermak's post-recoating factors (29 June 2015 email)
var skybr = 21.0; // Skybr values are similar to ING
var skyoff = 1.5; // measurements on their web-site
} else if (filt == "fbb") { // IO:O bessell_b
var zp = 24.90; // 24.10 from old ETC, modified with HJ's factor
var skybr = 22.3;
var skyoff = 1.5;
} else if (filt == "fbv") { // IO:O bessell_v
var zp = 24.96; // 24.20 from old ETC, modified with HJ's factor
var skybr = 21.4;
var skyoff = 1.5;
} else if (filt == "fsg") { // IO:O sdss_g
var zp = 25.14; // 24.40 from old ETC, modified with HJ's factor
var skybr = 21.7;
var skyoff = 1.0;
} else if (filt == "fsr") { // IO:O sdss_r
var zp = 25.39; // 24.60 from old ETC, modified with HJ's factor
var skybr = 20.4;
var skyoff = 1.0;
} else if (filt == "fsi") { // IO:O sdss_i
var zp = 25.06; // 24.40 from old ETC, modified with HJ's factor
var skybr = 19.3;
var skyoff = 1.0;
} else if (filt == "fsz") { // IO:O sdss_z
var zp = 24.52; // 24.0 from old ETC, modified with HJ's factor
var skybr = 18.3;
var skyoff = 0.5;
} else if (filt == "fjj") { // IO:I J-band
var zp = 24.50; // 24.0 from IO:I webpage (pre-commissioning, so RMB estimate?). In Jan 2016 CMC added 0.5 after 2015 recoating.
var skybr = 16.6; // from ING sky brightness page, in mag per sqr arcsec
var skyoff = 0.0; // skyoff assumes moon has no affect on J-band sky
} else if (filt == "fhh") { // IO:I H-band
var zp = 24.00; // 23.5 updated after commissioning; corrected for gain (CJD). CMC added 0.5 after 2015 recoating.
var skybr = 12.5; // from ING sky brightness page, in mag per sqr arcsec
var skyoff = 0.0; // skyoff assumes moon has no affect on H-band sky
} else if (filt == "frise") { // rise V+R
var zp = 25.20; // In Jan 2016 CMC added 0.7 to original value of 24.50 following 2015 recoating
var skybr = 20.4; // ... same as sdss-r above
var skyoff = 1.0; // ... same as sdss-r above
} else { // rise 720
var zp = 23.40; //
var skybr = 19.3; // ... same as sdss-i above
var skyoff = 1.0; // ... same as sdss-i above
};
// Could display in table the ZP to be used - commented out below
// document.getElementById("zpused").innerHTML = zp.toFixed(2);
// *************************************************************************
// ****
// **** SETUP OUTPUT VALUES
// ****
var data = new google.visualization.DataTable();
data.addColumn('number', 'Exposure Time');
plotModeValues = []
if (plotMode == 'snrMode'){
plotModeValues = snrText.split(",").map(Number).sort()
plotModeValues.forEach(function(snr){
data.addColumn('number', 'SNR = ' + snr.toFixed())
}
);
}
if (plotMode == 'seeMode'){
plotModeValues = seeText.split(",").map(Number).sort()
plotModeValues.forEach(function(see){
data.addColumn('number', see.toFixed(1) + ' arcsec')
}
);
}
if (plotMode == 'skyMode'){
plotModeValues = skyText.split(",").map(Number).sort()
plotModeValues.forEach(function(sky){
data.addColumn('number', 'DARK + ' + sky.toFixed(1) + ' mag/arcsec^2')
});
}
//}
// ****
// **** MAIN CALCULATION (Imaging)
// ****
// POINT sources
// Calculate the number of counts per second from a source for the LT, across a range of seeing values,
// and calculate the limiting magnitude based on a ZP change for different telescop e appertures.
// Step through seeing (nested loop)
// - seeing is 0.5 when i=0; step by 0.1 arcsec so seeing is 3.0 when i=25
// Output values stored in a 1-D variable (2D a pain to code)
; // calculate the skymag
// skyoff takes into account 1 mag change in
// V doesn't equal 1 mag change in u or r.
var calcLimMag = function(snr, seeing, sky){
var skymag = skybr - (skyoff * sky)
var areaofdisk = (seeing * 2 * seeing * 2); // area in arcsec
var numberofpixels = areaofdisk / (pixscale * pixscale * bin * bin);
var skyphotons = Math.pow(10.0,((zp - skymag)/2.5)) * areaofdisk; // within aperture
// - must multiply by areaofdisk since skymag
// in mag/arcsec2
var a = expt * expt;
var b = -snr * snr * expt;
var c = -snr * snr * ((skyphotons * expt) + (darkcurrent * expt *numberofpixels) +(readnoise * readnoise * numberofpixels));
var starphotonsa = (-b + Math.sqrt(b*b - 4*a*c))/(2*a); // solvequadratic equation(+ve)
var starphotonsb = (-b - Math.sqrt(b*b - 4*a*c))/(2*a); // solvequadratic equation (ve)
var starphotons = Math.max(starphotonsa, starphotonsb); // Selecthighest value.
// Calculate the inst zeropoint offset (this should be out of the loop for improved performance!)
limMag = -2.5 * Math.log10(starphotons) + zp; // Calculate thelimiting magnitude
dataLine.push(limMag);
}
var expt = 0; // initial exposure time
for (var i = 1; i <= exptmax; i+=exptmax/400.) {
var expt = i;
var dataLine = [expt];
if (plotMode == 'snrMode'){
plotModeValues.forEach(function(snr){
calcLimMag(snr,seeing,sky);
});
}
if (plotMode == 'seeMode'){
plotModeValues.forEach(function(seeing){
calcLimMag(snr,seeing,sky);
});
}
if (plotMode == 'skyMode'){
plotModeValues.forEach(function(sky){
calcLimMag(snr,seeing,sky);
});
}
data.addRow(dataLine); // Add to list
}
// *************************************************************************
var options = {
title: 'Exposure Time Calculator - Imaging',
curveType: 'function',
legend: { position: 'right' },
hAxis: {
title: "Exposure time (s)",
scaleType: logMode,
viewWindow: {
min: 0,
max: exptmax
}
},
vAxis: {
title: "Limiting Magnitude",
viewWindow: {
min: magmin,
max: magmax,
}
}
};
chart.draw(data, options);
}
function calcspec() {
var spchart = new google.visualization.LineChart(document.getElementById('spcurve_chart'));
// Look up (Define?) the input elements in the document for IMAGING
var spinstrum = document.getElementById("spinstrum").value;
var spslit = document.getElementById("spslit").value;
var sparm = document.getElementById("sparm").value;
var spseeing = +document.getElementById("spseeSlid").value;
var spseeText = document.getElementById("spseeText").value;
var spsnr = +document.getElementById("spsnrSlid").value;
var spsnrText = document.getElementById("spsnrText").value;
var spsky = +document.getElementById("spskySlid").value;
var spskyText = document.getElementById("spskyText").value;
var spmagmin = document.getElementById("spmagmin").value;
var spmagmax = document.getElementById("spmagmax").value;
var spexptmax = document.getElementById("spexptmax").value;
var spplotMode = document.getElementById("spplotMode").value;
if (document.getElementById('splogModeOn').checked) {
var splogMode = 'log'
} else {
var splogMode = ''
}
// FIRST PULL-DOWN ***
// Look-up tables of variables - INSTRUMENT CHARACTERISTICS
if (spinstrum == "frodo") { // FRODO
var sppixscale = 0.82; // spatial pixel scale (arcsec)
var spdarkcurrent = 0; // ??
var spreadnoise = 10; // from website
} else { // sprat
var sppixscale = 0.48; // spatial pixel scale (arcsec)
var spdarkcurrent = 0; // ??
var spreadnoise = 9; // from SPIE 2014 paper.
};
// SECOND PULL-DOWN ***
// Look-up tables of variables - SLIT width (arcsec)
if (spslit == "spratslit") {
var slitwd = 2; // SPRAT slit ESTIMATE
} else {
var slitwd = 10; // FRODO field-of-view
};
// THIRD PULL-DOWN ***
// Look-up tables of other variables (all instrument and arm specific)
// * spzp should be ZP corresponding to 1 electron/second/Angstrom
// * spskybr (Sky brightness) in mag/sqr arcsec
// ...
if (sparm == "frredarmv") { // **** FRODO Red VPH @ 7000 (R-band)
var spzp = 16.0; // FRODO zeropoint at 7000 (from website) = 15.30. In Jan 2016 CMC added 0.7 following 2015 recoating.
var spskybr = 20.8; // sky brightness in mag/arcsec^2
var spskyoff = 1.0; // Used when calculating bright sky; +2 mag,+4 mag,etc.
var spres = 5300; // spectral resolution, lambda/delta-lambda
var wvpixscale = 0.8; // spectral pixel scale, in Angstrom
var refwav = 7000; // reference wavelength for calculation, in Angstrom
} else if (sparm == "frbluarmv") { // **** FRODO Blue VPH @ 4500 (B-band)
var spzp = 14.5; // FRODO zeropoint at 4500 (from website) = 14.50. In Jan 2016 CMC added 0.7 following 2015 recoating.
var spskybr = 22.8; // Bessell B-band
var spskyoff = 1.5; // Bessell B-band
var spres = 5500;
var wvpixscale = 0.35;
var refwav = 4500;
} else if (sparm == "frredarm") { // **** FRODO Red @ 7000
var spzp = 15.60; // FRODO zeropoint at 7000 (from website) = 14.90. In Jan 2016 CMC added 0.7 following 2015 recoating.
var spskybr = 20.8; // R band
var spskyoff = 1.0; // R band
var spres = 2200;
var wvpixscale = 1.9;
var refwav = 7000;
} else if (sparm == "frbluarm") { // **** FRODO Blue @ 4500
var spzp = 14.70; // FRODO zeropoint at 4500 (from website) = 14.20. In Jan 2016 CMC added 0.7 following 2015 recoating.
var spskybr = 22.8; // Bessell B-band
var spskyoff = 1.5; // Bessell B-band
var spres = 2600;
var wvpixscale = 0.60;
var refwav = 4500;
} else if (sparm == "spredarm") { // **** SPRAT Red @ 7000
var spzp = 17.7; // Estimate giving results similar to SPIE paper = 17.0. In Jan 2016 CMC added 0.7 following 2015 recoating.
var spskybr = 20.8; // r band (Originally had 24.6 here. Not sure why. C Benn measures 21.8 in V. 20.8 in R is a reasonable guess.)
var spskyoff = 1.0; // r band
var spres = 350; // Estimate from SPIE paper
var wvpixscale = 9.0; // GUESSED!!!
var refwav = 7000;
} else { // **** SPRAT blue @ 4500
var spzp = 17.2; // Estimate giving results similar to SPIE paper = 16.5. In Jan 2016 CMC added 0.7 following 2015 recoating.
var spskybr = 22.8; // Bessell B-band (Originally had 24.6 here. Not sure why. C Benn measures 21.8 in V. 22.8 in B is a reasonable guess.)
var spskyoff = 1.5; // Bessell B-band
var spres = 350; // Estimate from SPIE paper
var wvpixscale = 3.0; // GUESSED!!!
var refwav = 4500;
};
// ****
// **** MAIN CALCULATION (Spectroscopy)
// ****
// As for imaging, calculate exposure times based on a range of seeing
// and sky brightness values.
// Step through seeing and sky brightness.
// - seeing is 1.0 when si=1; step by 0.5 arcsec so seeing is 4.0 when si=7
// - sky brightness is Dark when sj=0; step by 1 mag so sky is dark+10 when sj=10
// Output values stored in a 1-D variable
var spdata = new google.visualization.DataTable();
spdata.addColumn('number', 'Exposure Time');
plotModeValues = [];
if (spplotMode == 'spsnrMode'){
plotModeValues = spsnrText.split(",").map(Number).sort()
plotModeValues.forEach(function(snr){
spdata.addColumn('number', 'SNR = ' + snr.toFixed())
}
);
}
if (spplotMode == 'spseeMode'){
plotModeValues = spseeText.split(",").map(Number).sort()
plotModeValues.forEach(function(see){
spdata.addColumn('number', see.toFixed(1) + ' arcsec')
}
);
}
if (spplotMode == 'spskyMode'){
plotModeValues = spskyText.split(",").map(Number).sort()
plotModeValues.forEach(function(sky){
spdata.addColumn('number', 'DARK + ' + sky.toFixed(1) + ' mag/arcsec^2')
});
}
var calcLimMag = function(spsnr, spseeing, spsky){
var spskymag = spskybr - (spskyoff * spsky); //
var spatialarcs = (slitwd * spseeing * 2) ; // area on sky, in arcsec
var spatialarea = (slitwd * spseeing * 2) / (sppixscale * sppixscale) ; // area on sky, in pixels
var specpixsc = (refwav) / (spres * wvpixscale) ; // spec resolution, in pixels
var spnumberofpixels = spatialarea * specpixsc ; // number of pixels per spat/spect resln element
//NOTE: spzp is ZP (in mags) that gives 1 photon/sec/Angstrom
var spskyphotons = (Math.pow(10.0,((spzp - spskymag)/2.5)) * (refwav/spres) * spatialarcs);
// spstarphotons and spskyphotons should be in units of photons per spatial/spectral
// resolution element (really electrons/res elem):
// - multiplying by (refwav/spres) convert from "per Angstrom" to "per res element"
// - multiplying by spatialarcs corrects spskyphotons for the "per arcsec"
var spa = spexpt * spexpt;
var spb = -spsnr * spsnr * spexpt;
var spc = -spsnr * spsnr * ((spskyphotons * spexpt) + (spdarkcurrent * spexpt * spnumberofpixels) + (spreadnoise *spreadnoise * spnumberofpixels));
var spstarphotonsa = (-spb + Math.sqrt(spb*spb - 4*spa*spc))/(2*spa); // solve quadratic equation (+ve)
var spstarphotonsb = (-spb - Math.sqrt(spb*spb - 4*spa*spc))/(2*spa); // solve quadratic equation (-ve)
var spstarphotons = Math.max(spstarphotonsa, spstarphotonsb);
// Calulate the inst zeropoint offset (this should be out of the loop for improved performance!)
var splimMag = -2.5 * Math.log10(spstarphotons / (refwav/spres)) + spzp; // Calculate the limiting magnitude
spdataLine.push(splimMag); // Add to list
}
var spexpt = 0;
for (var si = 1; si <= spexptmax; si+=spexptmax/400.) {
var spexpt = si ; // same as for imaging - step through seeing in arcsec
var spdataLine = [spexpt] // Create the list for the dataline with seeing value
if (spplotMode == 'spsnrMode'){
plotModeValues.forEach(function(spsnr){
calcLimMag(spsnr, spseeing, spsky);
});
}
if (spplotMode == 'spseeMode'){
plotModeValues.forEach(function(spseeing){
calcLimMag(spsnr, spseeing, spsky);
});
}
if (spplotMode == 'spskyMode'){
plotModeValues.forEach(function(spsky){
calcLimMag(spsnr, spseeing, spsky);
});
}
spdata.addRow(spdataLine);
}
var spoptions = {
title: 'Exposure Time Calculator - Spectroscopy',
curveType: 'function',
legend: { position: 'right' },
hAxis: {
title: "Exposure time (s)",
scaleType: splogMode,
viewWindow: {
min: 0,
max: spexptmax
}
},
vAxis: {
title: "Limiting Magnitude",
viewWindow: {
min: spmagmin,
max: spmagmax,
}
}
};
spchart.draw(spdata, spoptions);
}
</script>
</body>
</html>