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.
 
 
 
 
 
 

81 lines
3.2 KiB

  1. 10 ' Program to compute the signal-to-noise ratio
  2. 20 ' for a stellar image in a CCD camera.
  3. 30 ' Written by Anthony Mallama, September 1992.
  4. 40 '
  5. 50 DIM SN(5) :' PI=3.14159
  6. 60 S0=2000000: ' Star-signal constant (the number of
  7. 70 ' electrons per second for a 0-magnitude
  8. 80 ' star and a 1-inch scope)
  9. 90 SB=18: ' Sky brightness in mag per sq arc second
  10. 100 PS=1.5: ' Pixel size in arc seconds of sky
  11. 110 DD=3: ' Detection diameter in arc seconds
  12. 120 RN=100: ' Readout noise in electrons per pixel
  13. 130 TH=70: ' Thermal electrons/pixel/sec
  14. 140 AP=8: ' Aperture of telescope in inches
  15. 150 ET=100: ' Time before a readout in seconds
  16. 160 PRINT
  17. 170 PRINT "Signal-to-noise ratios for stellar CCD images,"
  18. 180 PRINT "based on:"
  19. 190 PRINT USING " A) #####.# inch aperture scope";AP
  20. 200 PRINT USING " B) #####.# mag per sq arcsec of sky";SB
  21. 210 PRINT USING " C) ####### arcsec detection circle";DD
  22. 220 PRINT USING " D) ####### sec longest single exp.";ET
  23. 230 PRINT USING " E) #####.# arcsec-per-pixel scale";PS
  24. 240 PRINT USING " F) ####### elec/pixel readout noise";RN
  25. 250 PRINT USING " G) ####### thermal elec/pixel/sec";TH
  26. 260 PRINT USING " H) ####### star-signal constant";S0
  27. 270 PRINT " Q) Quit"
  28. 280 PRINT
  29. 290 INPUT "Choose a letter or type '/' to continue";P$
  30. 300 IF P$="A" OR P$="a" THEN INPUT AP
  31. 310 IF P$="B" OR P$="b" THEN INPUT SB
  32. 320 IF P$="C" OR P$="c" THEN INPUT DD
  33. 330 IF P$="D" OR P$="d" THEN INPUT ET
  34. 340 IF P$="E" OR P$="e" THEN INPUT PS
  35. 350 IF P$="F" OR P$="f" THEN INPUT RN
  36. 360 IF P$="G" OR P$="g" THEN INPUT TH
  37. 370 IF P$="H" OR P$="h" THEN INPUT S0
  38. 380 IF P$="Q" OR P$="q" THEN 720
  39. 390 IF P$="/" THEN GOTO 410
  40. 400 GOTO 160
  41. 410 PRINT
  42. 420 AR=PI*(DD/2)^2: 'Detection area in square arcsec
  43. 430 PX=AR/PS^2: 'Detection area in pixels
  44. 440 IF PX>1 GOTO 500
  45. 450 PRINT "Warning: Detection area is less"
  46. 460 PRINT "than 1 pixel. Increase size."
  47. 470 PRINT
  48. 480 INPUT "Press <Enter> to continue";X$
  49. 490 GOTO 160
  50. 500 EN=DD/10 ' Fraction of star's total image encircled
  51. 510 ' by the detection or measurement area
  52. 520 IF EN>1 THEN EN=1
  53. 530 PRINT " Mag. 1 sec 10s 100s ";
  54. 540 PRINT "1000s 10000s"
  55. 550 FOR M=10 TO 20
  56. 560 L=1/(10^(M/2.5)): ' Luminosity
  57. 570 PRINT USING " ##.#"; M;
  58. 580 FOR I=1 TO 5
  59. 590 S=10^(I-1): ' Exposure time in seconds
  60. 600 SG=L*S*S0*EN*AP^2: ' Signal total
  61. 610 SK=S*S0*AR*AP^2/10^(SB/2.5): ' Sky total
  62. 620 TT=TH*PX*S: ' Thermal total
  63. 630 N=S/ET: ' Total number of frames
  64. 640 IF N<>INT(N) THEN N=INT(N)+1
  65. 650 SN(I)=SG/SQR(SG+TT+SK+N*PX*RN^2)
  66. 660 NEXT I
  67. 670 PRINT USING "######";SN(1);SN(2);SN(3);SN(4);SN(5)
  68. 680 NEXT M
  69. 690 PRINT
  70. 700 INPUT "Press <Enter> to continue";X$
  71. 710 GOTO 160
  72. 720 END
  73. 730 '
  74. 740 ' This program computes the signal-to-noise (SNR) ratio expected
  75. 750 ' when a CCD camera is used under specific conditions and
  76. 760 ' with a given telescope. Since an SNR of at least 3 is needed
  77. 770 ' for reliable visiblity of a star image, the program can be
  78. 780 ' used to estimate the magnitude limit reached. It was written
  79. 790 ' by Anthony Mallama and appeared in Sky & Telescope for
  80. 800 ' February 1993, page 84.