Limb darkening in solar image and photon transfer curve of a CCD detector

download Limb darkening in solar image and photon transfer curve of a CCD detector

of 17

Transcript of Limb darkening in solar image and photon transfer curve of a CCD detector

  • 8/4/2019 Limb darkening in solar image and photon transfer curve of a CCD detector

    1/17

    Experimental Solar PhysicsLimb darkening in solar image

    Photon transfer curve of a CCD detector

    Khan Muhammad Bin Asad

    Astromundus

    University of Rome Tor Vergata, Italy

    8 June 2011

  • 8/4/2019 Limb darkening in solar image and photon transfer curve of a CCD detector

    2/17

    Contents

    1 Limb darkening in solar image 2

    1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.2 Theoretical basis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.3 Scientific ob jective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.4 Working procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

    1.5 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.6 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

    2 Photon transfer curve of a CCD detector 7

    2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72.2 Theoretical basis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72.3 Experimental setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82.4 Working procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

    2.4.1 Acquiring images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92.4.2 Processing images and plotting PTC . . . . . . . . . . . . . . . . . . . . . 9

    2.5 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102.6 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

    3 Appendices 13

    3.1 Appendix A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133.2 Appendix B . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

    1

  • 8/4/2019 Limb darkening in solar image and photon transfer curve of a CCD detector

    3/17

    Chapter 1

    Limb darkening in solar image

    1.1 Introduction

    1.2 Theoretical basis

    Limb darkening is the gradual decrease of the intensity in a stars image as we move from centerof the image towards the limb. It occurs because of two effects:

    1. Density of the star decreases with increasing radius.

    2. Also temperature of the star diminishes with increasing radius.

    So when we look at the center we can look through deeper layers wheras as we go towardslimb our line of sight penetrates upper and upper layers. Deeper layers have more temperaturethus more brightness. So At center we see brighter layers, thus the image becomes brighter andtowards limb we see cooler and fainter layers thus diminshing the brightness of the image.

    Figure 1.1: Pictorial representation of an ideal case of limb darkening. The outer boundary isthe radius at which photons emitted from the star are no longer absorbed. L is a distance forwhich the optical depth is unity. High-temperature photons emitted at A will just barely escapefrom the star, as will the low temperature photons emitted at B. Solar image near B will seemfainter.

    Limb darkening is just a projecttion effect due to our line of sight. It can be explained ina more scientific way. In the linear plane parallel approximation, the intensity of light comingfrom a star can be written as,

    I = a + b cos and S = a + b (1.1)

    = cos (1.2)

    2

  • 8/4/2019 Limb darkening in solar image and photon transfer curve of a CCD detector

    4/17

    Here is the angle between the path of radiation and the surface of the star on the sky. At center = 0 and at limb = 90, thus optical depth, varies from 1 to 0. At center I = a + band at limb I = a. If b > 0 then, intensity is high at the center and lower towards the limb.

    So, limb darkening exists because the continuum source function, S, decreases outward,as decreases. As we look towards the limb, we see upper photospheric layers which are less

    bright.A more general formulation can be done If we consider quadratic terms. In this case center

    to limb variation of solar intensity can be written as,

    I(0, )

    I(0, 0)= a0 + a1 cos + a2 cos

    2 (1.3)

    From measured values of this variation we learn that, the optical depth at the centre of theSolar disk varies from 0.90 at 3737A to 0.68 at 16550A. The effect is more pronounced at theblue end of the spectrum and less pronounced at the red.

    1.3 Scientific objectiveLimb darkening is an unwanted effect. So after getting the calibrated solar image, but beforestarting any analysis, we need to remove limb darkening. During this experiment we got somecalibrated images of Sun. Our objective was to remove limb darkening using IDL. IDL, short forInteractive Data Language, is a programming language used for data analysis. It is especiallypopular among astrophysicists.

    1.4 Working procedure

    The complete IDL program is given in appendix A. Several comments are added in the program.

    I will describe the procedure here according to the numbering of those comments.

    1. Reading and resizing image: At the very beginning we read the selected solar imagein IDL using read bmp command. Then the image is resized. We use rebin to resizethe image. This command works because actual size is a mutiple iniger of the expectedsize. Resizing is necessary to see the image as actual size of the image did not match withthe resolution of my computer.

    2. Finding center of the image: The image is a box image, all pixels outside the Sun hadvalues close to zero. Next step is to calculate the center of the Sun. This is done by thecenter of mass theory. As Sun can be considered spherically symmetric, its center ofintensity should lie at the very center of the Sun. We calculate center of intensity of each

    row and then average the values, same is done for the columns. If n is total number ofpixels along a row, x is the position of the pixels and I is the intensity value of a specificpixel then center of intensity (x) along a row can be found using the formula,

    x =

    n

    xnInn

    In(1.4)

    3. Shifting the image: After that the whole image is shifted to the calculated actual centerof the Sun.

    4. Calculating radius: Then, to find the radius we use the fact that pixel values outsidethe sun are close to zero. In the for loop, while going from bottom to top along the

    3

  • 8/4/2019 Limb darkening in solar image and photon transfer curve of a CCD detector

    5/17

    central column, we start a counter when pixel value becomes larger than 5% of the centralintensity. The counter stops when intensity again drops below that limit. Thus the countergives us diameter in both horizontal and vertical direction. Radius is obtained from theseresults.

    5.Distance function

    : Then we create an image using distance function of IDL. distgives an image whose intensity is directly proportional to its radius. So here intensityitself becomes an indicator of radius. Image created by dist is actually a combination ofone quarters of four images. One complete dist image can be obtained by shifting this byone half of the total number of pixels.

    6. Onion pilling the solar image: First we define some annuli in the dist image withequal radial thickness. Outer radius of the outermost annulus is just the radius of the sunthat we found. We take the index values of the pixels in one annulus and apply that tothe solar image. Then we calculate the standard deviation and mean of those pixel values(intensities), i.e. in that annulus. But There maybe sunspots or faculae in that annulus.To remove these effects we take intensities within two times the standard deviation. Then

    we take mean of those intensities again. After that all the pixel values in that annulusare set to the mean intensity value. This process is repeated for all the annuli. Thus weget an image of the Sun with several annuli and values of all the pixels in one annulus aresame, i.e. average intensity of that annulus. We set all the zero values of this onion-likeimage to be 1 to avoid dividing by zero.

    7. Removing limb darkening: Now original shifted image of the Sun is divided by theonion-like image pixel by pixel. Limb darkening is removed in this way and we get arefined image. But as we divided all the intensities in an annulus by average intensity ofthat annulus, we get pixel values to be a bit more or less than 1, original intensity valuesare gone. To recover the original intensities we need to rescale it, in a way that tvscl

    command does intrinsically. For rescaling we multiply the image by the ratio of 255 andthe maximum pixel value of the refined image. Finally we show this image in a window.

    1.5 Results

    Figure 1.2: In this image all the annuli created on the solar image are visible. All the pixels inone annulus have the same value and the value is the average intensity of that annulus.

    4

  • 8/4/2019 Limb darkening in solar image and photon transfer curve of a CCD detector

    6/17

    Figure 1.3: Left: Original image of the Sun, limb darkening is visible. Right: Image afterremoving the effect of limb darkening.

    1.6 Discussion

    1. A more convenient way of finding the onion-like image using the distance function isto use equal area intervals instead of equal radius intervals. If we use equal area thanall the regions of the image are scaled in a same way and true brightness of the Sun isreestablished more precisely. This can be done by simply dividing total area of the imageby total number of expected annuli and using that as step in the for loop.

    2. While finding radius we must be careful about any interruption caused by cosmic ray orother irregular but intense phenomena in the sky. If data about a cosmic ray exists in oneof the pixels outside the solar image and if the pixel is in the central column or row thanthe counter will start counting before encoutering the edge of the Sun. Thus we will geta wrong value of radius.

    3. Also to make our code more flexible we should tell the program to start counting whenintensity of a pixel becomes greater than some percentage of the central intensity. If weuse a fixed value as limiting value for the counter than the program loses its universalcredibility. Also, to give a certain value we must be sure about the typical pixel values inthe black region and also typical values in the limb of Sun.

    4. This kind of program will work only if the source is spherically symmetric. Consideringthe Sun to be spherically symmetric we could take the image to be circular. And as itwas circular we could find a definite answer for the radius. In practice, radius should becalculated in all directions from the center and an average could be found from them. Alsoin the image we saw some extended intensity regions coming out from the photosphere ofthe Sun. They can be explained as prominences.

    5. By making precise measurements of this form of limb darkening and comparing thesemeasurements with the predictions of different models, in theory we should be able todeduce something about the relation of density and temperature with optical depth inthe solar atmosphere. But one practical difficulty of doing this is that it turns out that itis necessary to make quite precise measurements of the exact form of the limb darkening

    5

  • 8/4/2019 Limb darkening in solar image and photon transfer curve of a CCD detector

    7/17

    very close to the limb to be able to distinguish convincingly between different models. Tocreate a perfect model for explaining limb darkening we should not assume a hard and fastphotosphere surrounded by an atmosphere of uniform source function; rather, we shouldsuppose that the source function varies continuously with depth.

    6. In the end we could also discuss something about the possibility of detecting limb darken-ing of stars other than the Sun. The future will tell whether advances in technology, suchas adaptive optics, may enable us to observe the limb darkening of other stars directly.Other methods are possible. For example, the detailed light curve of an eclipsing binarystar undoubtedly gives us information on the limb darkening of the star that is beingeclipsed.

    6

  • 8/4/2019 Limb darkening in solar image and photon transfer curve of a CCD detector

    8/17

    Chapter 2

    Photon transfer curve of a CCD

    detector

    2.1 Introduction

    Main objective of this experiment is to calibrate and optimize a CCD detector systemwithout knowing technical specifications in detail. Calibration is done by removing sys-tematic effects caused by the detector system itself. To remove these effects we needto judge the performance of the system. Judgment of performance is usually done bytransfer curves. There are 4 operational categories of mainstream performance transfercurves, namely- charge generation, collection, transfer and measurement. Among all thetransfer curves of these 4 categories photon, x-ray and QE transfer curves provide 90%of data required to judge the performance. Photon transfer curve, associated with charge

    collection, is the most versatile one among them. In this experiment we find the photontransfer curve of an ideal CCD using uniform images of different exposure times createdby a LED source. From the PTC we could measure the gain of the whole CCD system,read noise and the full well capacity.

    We also find the linearity plot, i.e. exposure time vs. signal in DN. Linearity of the CCDcan be found by linear least-square regression analysis. We did not do the analysis as ourmain objective was to calibrate the system with PTC. But we saw the plot and found itto be almost linear.

    2.2 Theoretical basis

    Ratio of output and input is called a transfer function. Transfer curve plots this function,i.e. output vs. input. Results of the test tools developed to allow CCD performance tobe expressed in absolute units (number of electrons) are often presented in the form oftransfer curve. CCD transfer function can be obtained from the following diagram,

    7

  • 8/4/2019 Limb darkening in solar image and photon transfer curve of a CCD detector

    9/17

    Figure 2.1: Typical CCD camera system. Internal gain functions, signal and noise parametersare shown

    S(DN)

    P= QEI i ASN ASF ACDS AADC (2.1)

    (2.2)

    Its very difficult to calculate individual gains in this function precisely. Instead PTC can

    be used to measure the whole gain, g(e

    /DN) = (ASNASFACDSAADC)1

    and G =1/g.

    Noise sources in CCD are: Photon shot noise, readout noise, dark current, bias frame, fanonoise, fixed pattern noise. We dont need to consider Fano noise because it is appreciableonly from soft x-ray regime when photon energy becomes more than 10 eV. Fixed patternnoise (Pixel response non-uniformity, PRNU) is same for a specific image, we get rid of thisby subtracting one image from the other image of same exposure time. Dark current andbias frame are removed when we subtract the dark image from the mean of the originalimages. So finally only two noise sources remain: shot noise and read noise. As they arestatistically independent total noise can be written like,

    N2

    tot = N2

    shot + N2

    read (2.3)(GNtot)

    2 = (GNshot)2 + (GNread)

    2 (2.4)

    But total noise is just the observed variance. Mean number of photoelectrons is SG

    , and

    shot noise is just the square root of this, so Nshot =

    S

    G. Finally we get,

    2tot = G S+ (GNread)2 (2.5)

    In this final equation variance and mean signal are the observables. If we plot these twoquantities for many exposure times we will get a curve with a sharp cutoff near full wellcapacity. This is PTC. If we fit the PTC linearly then the slope of the linear fit will giveus gain, G, and the intercept with y-axis will give the readout noise, (GNread)

    2.

    2.3 Experimental setup

    (a) At one side of the platform there was a LED source fixed to a stand that could bemoved only towards left or right. Two wires were connected to the LED from thepower source. At the power source there was a voltmeter to measure the voltage.

    (b) On the other side of the platform there was a CCD detector. It was fixed on a standthat can be moved from top to bottom and front to back and vice versa.

    8

  • 8/4/2019 Limb darkening in solar image and photon transfer curve of a CCD detector

    10/17

    (c) Between the CCD and the LED source a biconvex lens was fixed. The lens standcould be moved towartds left to right and top to bottom and vice versa.

    (d) Several plastic tubes were provided to close the path of light rays so that they cantescape.

    (e) CCD detector was connected to a computer. Commands to close or open shutterand take pictures were given using a software installed in the computer.

    2.4 Working procedure

    2.4.1 Acquiring images

    (a) CCD, lens and LED stands were moved up and down so that the three componentsare horizontally coplanar.

    (b) One of the two wires from LED was connected to a source and the other one wasconnected to ground. Thus LED was illumanated. Light level was controlled by thevoltage regulator. A white paper was placed in front of the LED source in roderto diffuse the light. In fact, we dont want any focusing of light, diffused light isnecessary for uniform image. Lens was placed in a position where distance betweenlens and detector is less than the focal length of the lens in order to acquire anuniform image. Distances from detector to lens and lens to LED were adjusted formaximum possible uniformity.

    (c) After adjusting the distances for uniformity we adjust the voltage given to the LEDin order to optimize the number of measurements. If voltage is very high the CCDwill saturate sooner and we will not have sufficient number of measurements to plotthe PTC effectively. Voltage was fixed at an intermediate level where exposure time

    at saturation was large enough. But exposure time at saturation should not be verylarge, as then we will have very small number of incident photons at low exposuretimes.

    (d) Then we started taking images varying exposure times, but at a fixed voltage level.Starting from 5 milliseconds we went till the saturation when full well capacity isreached. After finding saturation we backed off a little and took some more mea-surements to get a smooth curve near saturation so that we get an exact value offull-well capacity. Then we took some more values after saturation.

    (e) For each exposure time first a dark image, with CCD shutter closed, was taken. Thentwo normal images were taken. All the images were saved in tif (tagged image file)format with clever naming convention. Then data processing was done by IDL.

    2.4.2 Processing images and plotting PTC

    IDL codes are given in the appendix with necessary comments. Here I am listing the mainprocesses:

    (a) All the signal and dark image files are read in IDL. Two floating arrays are definedwith necessary number of elements.

    (b) A vector is defined where all the values of exposure times are written according tothe sequence maintained in the directory.

    9

  • 8/4/2019 Limb darkening in solar image and photon transfer curve of a CCD detector

    11/17

    (c) A table is created where I can write values of mean signals, total variane and exposuretimes.

    (d) I find the mean of two signal images and subtract dark frame from it pixel by pixel.Then I find the mean of all the pixel values and get the mean signal for each expo-sure. For total variance I subtract one signal image from another and divide it by

    2 because when 2 identical frames are subtracted random noise component of theresulted frame increase by a factor of

    2. While differencing fixed noises are canceled

    out, only random noise components remain. Then I find the variance of this and gettotal variance. Mean signal, total variance and exposure times are written in thepreviously opened file.

    (e) A floating array is created where data from the table were stored to plot in IDL.

    (f) First, the linearity plot is created by plotting exposure time in x-axis and mean signalin ADU in y-axis. Then photon transfer curve is created by plotting mean signal inx-axis and total variance, i.e. noise, in y-axis.

    (g) Linear fitting is done. The fit is plotted over the PTC upto the full well capacity.

    (h) Parameters from linear fit are printed in IDL with their corresponding errors.

    2.5 Results

    Figure 2.2: Linearity plot. A linear fit is errplotted to show how linear it is. From the graph wecan see that maximum deviation from the original value is very low. By least-squared regressionanalysis it could be found that non-linearity is very low, but we did not do that.

    10

  • 8/4/2019 Limb darkening in solar image and photon transfer curve of a CCD detector

    12/17

    Figure 2.3: Left: Classical Photon transfer curve that is shot noise limited, noise is plottedagainst mean signal. From the linear fit we can calculate gain, readout noise and full wellcapacity. Right: Total variance of the signal is plotted against mean signal. As images are not

    subtracted we get the total noise including fixed pattern and shot noise. Log-log plot is madeto show different regimes more clearly.

    We can directly print out the values of y-intercept and slope of photon transfer curvethat will give us read noise and gain respectively. Also mean signal in ADU at the peakof the curve gives full well capacity. Values that we get by printing linfit in IDL are,G = 0.127964 0.000242272 and (GNread)2 = 4.51561 0.467813. From these values wecan calculate the following,

    (a) Detector-CDS-ADC Gain, g = 1G

    = (7.81 0.0146) e/ADU

    (b) Readout noise by extrapolating linear fit, Nread = (17 1) electrons(c) Full well capacity, = 3258.25ADU = 25447 electrons

    From the results we can understand the following aspects of CCD:

    (a) Response of the CCD is quite linear which is very good for detection.

    (b) Full well of the CCD is reached at quite high signal level, i.e. it has a high dy-namic range. Small dynamic range is not shown just because we did not take muchmeasurements at small exposure times.

    (c) In the log log plane two different slopes can be seen. For FPN slope is 1 while forshot noise slope is 0.5. At read noise regime slope should be constant, but we dont

    see this regime well because we did not take reading at short exposure times.

    2.6 Discussion

    We had to measure read noise just by extrapolating the linear fit which wont give thevery exact value. If we could take a very large dynamic range, and took measurements atvery small exposure times than we could have observed the flattening of PTC at read noiseregime, as slope at this regime is theoretically zero. Intercept of this flattened portionwith the y axis would have given us the read noise.

    11

  • 8/4/2019 Limb darkening in solar image and photon transfer curve of a CCD detector

    13/17

    Also our first PTC is shot noise limited, that means classical. Because, we canceled thefixed noises by subtracting one image from another. In the second image we took totalvariance and plotted that against signal and got the total noise PTC. In that curve FPNregime has a slope of almost 1 and at shot noise regime it is 0.5. In the total PTCdark non-uniformity is also present. But in that case dark non-uniformity dominates

    over FPN, because dark non-unifomity is 10% of the total noise whereas FPN is just 1%.An important aspect to note is that, dark current does not hamper the PTC. PTC onlydepend on how the charges are collected, not how they were generated, as long as theyexhibit shot noise characteristics. In fact, a PTC can be plotted only by dark currentcounts that is called dark transfer curve.

    Photon transfer is the first test performed to determine the overall health of a new CCD-telescope system. Because it gives some amazing results for calibration and optimization,such as:

    (a) Well behaved PTC means the system is capable of making very precise measurements.

    (b) It magically gives the conversion constant to convert DN (digital number) or ADU

    (analog to digital unit) to absolute units, i.e. electrons.

    (c) When some problem is dtected in CCD-telescope system PTC is plotted again tofind non-linearity and noise.

    (d) It can be used to even calculate the quantum yield gain, i in this way: If K =(ASN ASF ACDS AADC)1 and J = (i ASN ASF ACDS AADC)1then i =

    K

    J. When > 4000, i = 1 but when < 4000, i > 1. K can be found

    from optical PTC and J can be found from soft x-ray PTC and then i is calculatedcomparing these two PTCs.

    There are always room for improvements. Noise statistics could be improved by taking3 signal images instead of 2. In that case each one has to be subtracted from other, 3distinct variances should be calculated and final variance will be the mean of them.

    12

  • 8/4/2019 Limb darkening in solar image and photon transfer curve of a CCD detector

    14/17

    Chapter 3

    Appendices

    3.1 Appendix A

    IDL code for removing limb darkening.

    p r o l i mb; 1 . R ea di ng i ma geimage=read bmp( / home/md/ i d l /Images /2003102 5 064 105 .bmp )rimage=rebi n ( image ,5 04 ,5 08 )x=504y=508z=256p=200q=p+1

    ; 2 . F in di ng c e nt e r o f t he imagef o r j=p , yq do b eg in

    s=0f o r i = 0,x1 d o b eg i n

    a=i long ( rimage ( i , j ))s=s+a

    e n d f o rd=to ta l (rimage ( , j ))r=s/d

    e n d f o r

    xc en te r=mean( r )p r i n t , x c e n t er p r i n t , x c e n t e r

    ; f i n d i n g y c en te rf o r j=p , xq do b eg in

    s=0f o r i = 0,y1 d o b eg i n

    a=i l o n g ( r i m a ge ( j , i ) )s=s+a

    e n d f o r

    13

  • 8/4/2019 Limb darkening in solar image and photon transfer curve of a CCD detector

    15/17

    d= t o t a l ( r i m a g e ( j , ) )ry=s/d

    e n d f o rycenter=mean(ry)p r i n t , y c e n t er

    p r i n t , y c e n t e r

    ; 3 . S h i f ti n g image t o t he c a lc u la t e d c en te rx s h i f t = x c e n t e r (x/21)y s h i f t = y c e n t e r (y/21)s i m a ge= s h i f t ( r i ma g e , x s h i f t , y s h i f t )s e t p l o t , x window , 0 , x s i z e = 50 4 , y s i z e =508t v s c l , s i m ag e

    ; 4 . F in di ng r a di u s o f s h i f t e d image

    xc=round( xc en te r )yc=round( yc en te r )b l a c k = 0 . 0 5 s image ( x c , y c)dia1=0dia2=0f o r m= 0 ,5 00 do b e g i n

    i f s i ma g e ( x c ,m) g t b l a c k t h en d i a 1=d i a 1 +1i f s i ma g e (m, y c ) g t b l a c k t h en d i a 2=d i a 2 +1

    e n d f o rra di us =(dia 1+dia2 )/4p r i n t , r a d i u s

    p r in t , r a d i u s

    ; 5 . Image c r e a t io n u si ng d i st a n ce f u nc t i ond im g= d i s t ( x , y )s di mg= s h i f t ( d img , x / 2 , y / 2 )window , 1 , x si z e =504, y si z e =508tv s c l , s dimg

    ; 6 . Onion p i l l i n g o f t he Sunrad=0im g= f l o a t ( s i m a g e )

    f o r i =0 ,3 0 do b e g ini n d e x=w he r e ( ( s di mg g t r a d ) a nd ( s di mg l e r a d + 7 ))sd=stdd ev (img( inde x ))avg=mean( img ( in de x ))n r i n g =w he r e ( i mg l e a vg +2sd ) o r ( img ge avg2sd )ri nga vg=mean(img( nri ng ) )img( index )=ring av grad=rad+radius/31

    e n d f o rim g ( w h e re ( i mg e q 0 ) )= 1

    14

  • 8/4/2019 Limb darkening in solar image and photon transfer curve of a CCD detector

    16/17

    ; 7 . Removing l i mb d a r k e ni n gr e f i m g =( f l o a t ( s im a ge ) / i mg )ref max=max( re fi mg )f i n i m g = r e f i m g ( 2 5 5 / r e f m a x )window , 1 , x si z e =504, y si z e =508

    t v s c l , f i n i m gen d

    3.2 Appendix B

    IDL code for Photon transfer curve.

    p ro p t c; 1 . S ea rc hi ng t he f i l e s , d e f in i ng a rr ay sf i l e s=f i l e s e a r c h ( / home/md/ i d l /165/.TIF)n f i l e s =n e l e m e n t s ( f i l e s )s i g n a l = f l t a r r ( n f i l e s / 3)n o i s e= f l t a r r ( n f i l e s /3 )

    ; 2 . A v ec to r with a l l th e ex po su re t im esex po s ur es =[1 00 ,10 ,11 0 ,11 4 ,11 8 ,12 2 ,12 6 ,13 0 ,13 5 ,14 0 ,15 0 ,16 0 ,17 0 ,18 0 ,19 0 ,20 0 ,2 0 ,2 10 ,220 ,23 0 ,3 0 ,4 0 ,5 0 ,5 ,60 ,70 ,8 0 ,9 0]

    ; 3 . Opening a t a b le t o w r it e s i gn a l , n o i se and e xp os ur e t im esc l o s e , 1openw , 1 , / home/md/ i d l / tab . dat

    ; 4 . C a lc u la t i ng mean s i g n a l and t o t a l v a ri a nc e

    f o r n =0 , ( n f i l e s /3)1 d o b e g i ns g n 1= r e a d t i f f ( f i l e s ( 3n+1))s g n 2= r e a d t i f f ( f i l e s ( 3n+2))dark=r e a d t i f f ( f i l e s (3n ) )s gn1=congr id ( s gn1 ,504 ,50 8)s gn2=congr id ( s gn2 ,504 ,50 8)dark=congr id ( dark ,504 ,5 08 )s ignal=(s gn1+s gn2)/2d ar k ; s u b t r a c t in g d ar k f r am em e an s i gn a l=mean ( s i g n a l ) ; o f a l l t he p i x e l v a l u esv a r s i g n a l =v a r i an c e ( s i g n a l ) ; t o t a l v a r i an c en o i s e = ( s g n 1sg n2 ) / s q r t ( 2 ) ; f i x e d n o i se s o ur c es c an c el e d o utv a r n o i s e=v a r i an c e ( n o i s e ) ; c a l c u l a t i n g t o t a l v a r ia n cp r i n t f , 1 , m e a n s i g n a l , v a r n o i s e , v a r s i g n a l , e x p o s u r e s ( n )

    e n d f o rc l o s e , 1

    ; 5 . C re at in g f l o a t i n g a rr ay f o r IDL p l o tt i n gcd , / home/md/ i d l / n exp os ur es=f i l e l i n e s ( tab . dat )

    15

  • 8/4/2019 Limb darkening in solar image and photon transfer curve of a CCD detector

    17/17

    d a ta= f l t a r r ( 4 , n e x p o s u r e s )openr , 1 , tab . dat read f , 1 , datantab=data [ , s o r t ( d a t a [ 3 , ] ) ] ; s o r t i n g a nd s e qu en ci ngsgn=ntab [ 0 , ] ; d e f i n i n g wh ic h r ow m eans w hatn=nta b [ 1 , ]var=ntab [2 , ]time=ntab [3 , ]

    ; 6 . P lo tt in gs e t p l o t , p s de vi ce , f i l e =/home/md/ i d l / l i n . eps ,/ c o l o rplo t , time , sgn , psym=7,syms=0.5 , $

    x t i t = ( E xp os ur e t i me [ ms ] ) , y t i t = ( S i g n a l [ADU ] ) , $t i t = CCD l i n e a r i t y p l o t , $x s t y = 1 . 8 , y s t y = 1 . 8 , x t h i c k = 1 .8 , y t h i c k = 1 .8 , t h i c k =1 . 8 , $

    c h a r t h i c k = 2, c h a r s i z e = 1 .4 , $x ra =[0 ,240 ] , y ra =[0 ,400 0]

    l i n=l i n f i t ( t ime (0 :1 4) , s gn (0 :1 4) , s igma=a , y f i t=y , s dev=s dev , mea s u re er ro rs =err )e r r =s q r t ( a b s ( y ) )er rp lo t , t ime , y+err , ye r r , l i n e s t y l e =0pr in t , chi , probd e v i c e , / c l o s ede vi ce , f i l e =/home/md/ i d l / pt cl og . eps , / co l o rplo t , sgn , var , psym=6, $

    / x l o g , / y l o g , x t i t = ( L og mean s i g n a l [ADU ] ) , $y t i t = ( Log t o t a l v a r i a n c e [ADU] ) , $

    t i t = Photon t r a n s f e r c ur ve ( t o t a l n o i s e ) , $x s t y = 1 . 8 , y s t y = 1 . 8 , x t h i c k = 1 .8 , y t h i c k = 1 .8 , t h i c k = 1. 8 , c h a r t h i c k = 2, $c h a r s i z e = 1. 4 , $x ra =[1 50 ,430 0] , y ra =[7 00 ,1.5 e5 ]

    d e v i c e , / c l o s ede vi ce , f i l e =/home/md/ i d l / ptc . eps ,/ c o l o rplot , s gn , n , psym=6, $

    x t it =(Mean s i gn al [ADU] ) , y t it =( Nois e [ADU] ) , $t i t = C l a s s i c a l P ho to n T r a n s f e r Cu rve (PTC ) , $x s t y = 1 . 8 , y s t y = 1 . 8 , x t h i c k = 1 .8 , y t h i c k = 1 .8 , t h i c k = 1. 8 , c h a r t h i c k = 2, $c h a r s i z e = 1. 4 , $

    x ra =[0 ,400 0] , y ra =[0 ,45 0]

    ; 7 . L i n e a r f i t t i n gl i n = l i n f i t ( s g n ( 0 : 1 2 ) , n ( 0 : 1 2 ) , s i gm a= l i n v a r , y f i t = l i n y f )o p l o t , s gn , l i n y f , l i n e s =0d e v i c e , / c l o s e

    ; 8 . F in di ng t he v a l u es o f Gain a nd Read n o i s ep r i n t , l i np r i n t , l i n v a ren d

    16