ChipMaster's bwBASIC This also includes history going back to v2.10. *WARN* some binary files might have been corrupted by CRLF.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

177 lines
6.6 KiB

  1. 10 REM CCDLIMIT.BAS CCD Limits
  2. 20 REM by Bradley E. Schaefer
  3. 30 FOR I=1 TO 5 : READ WA(I) : NEXT I
  4. 40 DATA 0.365, 0.44, 0.55, 0.7, 0.9
  5. 50 FOR I=1 TO 5 : READ Q(I) : NEXT I
  6. 60 DATA 15.0, 25.0, 40.0, 56.0, 26.0
  7. 70 FOR I=1 TO 5 : READ MO(I) : NEXT I
  8. 80 DATA -10.93, -10.45, -11.05, -11.90, -12.70
  9. 90 REM Input for position
  10. 100 RD=3.14159/180.0
  11. 110 INPUT "Zenith distance (deg.) : ";Z
  12. 120 AM=180.0 : REM Moon phase (deg.; 0=FM, 90=FQ/LQ, 180=NM)
  13. 130 ZM=180.0 : REM Zenith distance of Moon (deg.)
  14. 140 RM=180.0 : REM Angular distance to Moon (deg.)
  15. 150 ZS=180.0 : REM Zenith distance of Sun (deg.)
  16. 160 RS=180.0 : REM Angular distance to Sun (deg.)
  17. 170 REM Input for the Site and Date
  18. 180 TS=1.0 : REM FWHM of seeing in V at zenith
  19. 190 RH=40.0 : REM relative humidity (%)
  20. 200 TE=15.0 : REM Air temperature (deg. C)
  21. 210 LA=30.0 : REM Latitude (deg.)
  22. 220 AL=1000.0 : REM Altitude above sea level (m)
  23. 230 M=2.0 : REM Month (1=Jan, 12=Dec)
  24. 240 Y=1998.0 : REM Year
  25. 250 REM Input for the telescope and detector
  26. 260 D=20.32 : REM Telescope aperture (cm)
  27. 270 TP=.91 : REM Pixel size (")
  28. 280 DS=4.0 : REM Diameter of secondary (cm)
  29. 290 NM=2 : REM Number of mirrors (-)
  30. 300 NL=2 : REM Number of lens/glass in path (-)
  31. 310 RN=15.0 : REM Read noise of CCD (electrons)
  32. 320 INPUT "Enter V-band magnitude of star: ";MV
  33. 330 CI=.7 : REM Color index [B-V] for star (mag)
  34. 340 INPUT "Exposure time (seconds): ";E
  35. 350 NR=1 : REM Number of CCD readouts (-)
  36. 360 TA=1.0 : REM Radius of photometry aperture (") [best : TA=~TS]
  37. 370 GOSUB 1000 : REM Extinction subroutine
  38. 380 GOSUB 2000 : REM Sky subroutine
  39. 390 REM Calculate counts from star and sky
  40. 400 MA(1)=MV+2.35*CI-.6 : REM U
  41. 410 MA(2)=MV+CI : REM B
  42. 420 MA(3)=MV : REM V
  43. 430 MA(4)=MV-.75*CI : REM R
  44. 440 MA(5)=MV-1.6*CI : REM I
  45. 450 GOSUB 3000 : REM CT subroutine
  46. 460 REM Calculate SNR (see PASP article for exact formula)
  47. 470 P=3.14159*(TA/TP)^2
  48. 480 IF P<1.0 THEN P=1.0
  49. 490 FOR I=1 TO 5
  50. 500 VA=NS(I)+P*NB(I)+P*NR*RN*RN
  51. 510 SN(I)=NS(I)/SQR(VA)
  52. 520 SI(I)=1.086/SN(I)
  53. 530 NEXT I
  54. 540 PRINT : PRINT "For star with U, B, V, R, I ";
  55. 550 PRINT USING " #####.##"; MA(1), MA(2), MA(3), MA(4), MA(5)
  56. 560 PRINT " their respective SNR are ";
  57. 570 PRINT USING " #####.##"; SN(1), SN(2), SN(3), SN(4), SN(5)
  58. 580 PRINT " with 1-sigma errors (mag.) of ";
  59. 590 PRINT USING " #####.##"; SI(1), SI(2), SI(3), SI(4), SI(5)
  60. 600 END
  61. 1000 REM Extinction Subroutine
  62. 1010 FOR I=1 TO 5: READ OZ(I): NEXT I
  63. 1020 DATA 0.000, 0.000, 0.031, 0.008, 0.000
  64. 1030 FOR I=1 TO 5: READ WT(I): NEXT I
  65. 1040 DATA 0.074, 0.045, 0.031, 0.020, 0.015
  66. 1050 LT=LA*RD
  67. 1060 RA=(M-3)*30.0*RD
  68. 1070 SL=LA/ABS(LA)
  69. 1080 REM Airmass for each component
  70. 1090 ZZ=Z*RD
  71. 1100 XG=1/(COS(ZZ)+.0286*EXP(-10.5*COS(ZZ)))
  72. 1110 XA=1/(COS(ZZ)+.0123*EXP(-24.5*COS(ZZ)))
  73. 1120 XO=1/SQR(1.0-(SIN(ZZ)/(1.0+(20.0/6378.0)))^2)
  74. 1130 REM UBVRI extinction for each component
  75. 1140 FOR I=1 TO 5
  76. 1150 KR=.1066*EXP(-1*AL/8200)*((WA(I)/.55)^(-4))
  77. 1160 KA=.1*((WA(I)/.55)^(-1.3))*EXP(-1*AL/1500)
  78. 1170 KA=KA*((1-.32/LOG(RH/100.0))^1.33)*(1+SL*SIN(RA))
  79. 1180 KO=OZ(I)*(3.0+.4*(LT*COS(RA)-COS(3*LT)))/3.0
  80. 1190 KW=WT(I)*.94*(RH/100.0)*EXP(TE/15)*EXP(-1*AL/8200)
  81. 1200 K(I)=KR+KA+KO+KW
  82. 1210 DM(I)=KR*XG+KA*XA+KO*XO+KW*XG
  83. 1220 NEXT I
  84. 1230 REM Write results and return
  85. 1240 PRINT : PRINT "Airmass (gas, aerosol, ozone): ";
  86. 1250 PRINT USING "####.## "; XG, XA, XO
  87. 1260 PRINT "Extinction Coefficients (UBVRI): ";
  88. 1270 PRINT USING "####.## "; K(1), K(2), K(3), K(4), K(5)
  89. 1280 PRINT "Total Extinction (UBVRI): ";
  90. 1290 PRINT USING "####.## "; DM(1), DM(2), DM(3), DM(4), DM(5)
  91. 1300 RETURN
  92. 2000 REM SKY Subroutine
  93. 2010 FOR I=1 TO 5: READ BO(I): NEXT I
  94. 2020 DATA 8.0E-14, 7.0E-14, 1.0E-13, 1.0E-13, 3.0E-13
  95. 2030 FOR I=1 TO 5: READ CM(I): NEXT I
  96. 2040 DATA 1.36, 0.91, 0.00, -0.76, -1.17
  97. 2050 FOR I=1 TO 5: READ MS(I): NEXT I
  98. 2060 DATA -25.96, -26.09, -26.74, -27.26, -27.55
  99. 2070 X=1/(COS(ZZ)+.025*EXP(-11*COS(ZZ))) : REM air mass
  100. 2080 XM=1/(COS(ZM*RD)+.025*EXP(-11*COS(ZM*RD))) : REM air mass Moon
  101. 2090 IF ZM>90.0 THEN XM=40.0
  102. 2100 XS=1/(COS(ZS*RD)+.025*EXP(-11*COS(ZS*RD))) : REM air mass Sun
  103. 2110 IF ZS>90.0 THEN XS=40.0
  104. 2120 FOR I=1 TO 5
  105. 2130 REM Dark night sky brightness
  106. 2140 BN=BO(I)*(1+.3*COS(6.283*(Y-1992)/11))
  107. 2150 BN=BN*(.4+.6/SQR(1.0-.96*((SIN(ZZ))^2)))
  108. 2160 BN=BN*(10^(-.4*K(I)*X))
  109. 2170 REM Moonlight brightness
  110. 2180 MM=-12.73+.026*ABS(AM)+4E-09*(AM^4) : REM moon mag in V
  111. 2190 MM=MM+CM(I) : REM Moon mag
  112. 2200 C3=10.0^(-.4*K(I)*XM)
  113. 2210 FM=6.2E+07*(RM^(-2))+(10^(6.15-RM/40))
  114. 2220 FM=FM+(10^5.36)*(1.06+((COS(RM*RD))^2))
  115. 2230 BM=10^(-.4*(MM-MO(I)+43.27))
  116. 2240 BM=BM*(1-10^(-.4*K(I)*X))
  117. 2250 BM=BM*(FM*C3+440000.0*(1-C3))
  118. 2260 REM Twilight brightness
  119. 2270 HS=90.0-ZS : REM Height of Sun
  120. 2280 BT=10^(-.4*(MS(I)-MO(I)+32.5-HS-(Z/(360*K(I)))))
  121. 2290 BT=BT*(100/RS)*(1.0-10.0^(-.4*K(I)))
  122. 2300 REM Daylight brightness
  123. 2310 C4=10.0^(-.4*K(I)*XS)
  124. 2320 FS=6.2E+07*(RS^(-2))+(10^(6.15-RS/40))
  125. 2330 FS=FS+(10^5.36)*(1.06+((COS(RS*RD))^2))
  126. 2340 BD=10^(-.4*(MS(I)-MO(I)+43.27))
  127. 2350 BD=BD*(1-10^(-.4*K(I)*X))
  128. 2360 BD=BD*(FS*C4+440000.0*(1-C4))
  129. 2370 REM Total sky brightness
  130. 2380 IF BD>BT THEN GOTO 2410
  131. 2390 B(I)=BN+BD
  132. 2400 GOTO 2420
  133. 2410 B(I)=BN+BT
  134. 2420 IF ZM<90.0 THEN B(I)=B(I)+BM
  135. 2430 NEXT I
  136. 2440 PRINT "Sky brightness (UBVRI):";
  137. 2450 PRINT USING " ##.#^^^^"; B(1), B(2), B(3), B(4), B(5)
  138. 2460 RETURN
  139. 3000 REM Subroutine CT
  140. 3010 FOR I=1 TO 5 : READ DL(I) : NEXT I
  141. 3020 DATA 0.068, 0.098, 0.089, 0.22, 0.24
  142. 3030 FOR I=1 TO 5 : READ RE(I) : NEXT I
  143. 3040 DATA 0.83, 0.86, 0.88, 0.87, 0.90
  144. 3050 FOR I=1 TO 5 : READ TR(I) : NEXT I
  145. 3060 DATA 0.970, 0.983, 0.987, 0.983, 0.980
  146. 3070 FOR I=1 TO 5 : READ TF(I) : NEXT I
  147. 3080 DATA 0.70, 0.70, 0.70, 0.70, 0.70
  148. 3090 REM Seeing
  149. 3100 FOR I=1 TO 5
  150. 3110 X=1.0/(COS(Z/57.28))
  151. 3120 T1=(TS^2)*(X^1.2)*((WA(I)/.55)^(-.4))
  152. 3130 T2=5.54*((3600.0*57.28*(WA(I)/10000.0)/D)^2)
  153. 3140 TT(I)=SQR(T1+T2) : REM TOTAL SEEING FWHM (")
  154. 3150 NEXT I
  155. 3160 REM Efficiencies
  156. 3170 FOR I=1 TO 5
  157. 3180 EF(I)=(Q(I)/100.0)*TF(I)*(RE(I)^NM)*(TR(I)^(2.0*NL))
  158. 3190 F(I)=1-EXP(-2.77*((TA/TT(I))^2)) : REM Fraction in photometry aperture
  159. 3200 NEXT I
  160. 3210 A=(3.14159/4.0)*(D^2-DS^2) : REM Light-collecting area
  161. 3220 REM Source and sky counts
  162. 3230 FOR I=1 TO 5
  163. 3240 IN=10^(-.4*(MA(I)-MO(I)+DM(I)))
  164. 3250 PE=(WA(I)/10000.0)/(6.62E-27*2.997E+10)
  165. 3260 NS(I)=IN*F(I)*A*EF(I)*E*DL(I)*PE
  166. 3270 NB(I)=B(I)*A*EF(I)*E*DL(I)*PE*(TP^2)
  167. 3280 NEXT I
  168. 3290 PRINT : PRINT "Star counts in photometry aperture (UBVRI):";
  169. 3300 PRINT USING " #####."; NS(1), NS(2), NS(3), NS(4), NS(5)
  170. 3310 PRINT "Sky counts per pixel (UBVRI): ";
  171. 3320 PRINT USING " #####."; NB(1), NB(2), NB(3), NB(4), NB(5)
  172. 3330 RETURN
  173. 9991 REM ==============================
  174. 9992 REM FROM "ASTRONOMICAL COMPUTING,"
  175. 9993 REM SKY & TELESCOPE, MAY 1998
  176. 9994 REM ==============================