Welcome to iraf.net Friday, April 19 2024 @ 10:08 AM GMT


 Forum Index > Help Desk > Sources New Topic Post Reply
 SCRIPT to process CASLEO direct ccd data
   
sebastian
 07/08/2009 03:41AM (Read 5057 times)  
+++--
Chatty

Status: offline


Registered: 03/20/2007
Posts: 45
This is a script for processing images takeng with The ROPER 1300b ccd camera at casleo. It allows the user to choose between bias or overscan correction (by default, via interactive mode) and Flat correction.
Input images should be in fit format.
The .cl file should be placed along with the desired images.
The images should have the needed key in their headers,
binning factor BIN (1 or 2)
reading frequency LECTURA (100Khz or 1Mhz)
filter FILTER01 (R, V, I, etc)
ALSO, your object images should have IMAGETYP='object' .
The images headers would be edited to have the BIASEC and TRIMSEC
fields along with GAIN and RDNOISE parameters
Please check this values, GAIN 2, RDNOISE 5 and RDNOISE 7 are typical ones.
The images would be converted into .imh, while using the ushort and then the real format for aritmetic porpouses.
After selecting good flats by means of imstat within a region of the images
(non saturated and within the lineal response of the detector), the user would be able to choose between zero level correciton or overscan correction.
(Bad flats would be moved to a JUNK directory)*
Procesed images would be saved as pro_image name
in fits format using wfits in a created directory, PRO_biascor_(filter)_(lectura)
or PRO_oscancor_(filter)_(lectura), where filter and lectura stands for R, V, M, or k (M for 1Mhz images and k for 100Khz)
The .imh file are DELETED after saving the .fits files.* During my last run at casleo, there were a lot of saturated and
negative flats, even having -20 000 adus and plus 65535(saturated) in some
regions! (not just a classical signed image)
To overcome negative images, but not saturated, there is a step
that convert this signed images, again, saturated images are not used and
moved to the JUNK folder.
This negative images didn't recover after converting them into the ushort format. Using that step, their are usable.If you find it usefull or just interesting, please comment it.
Thanks
sebaI would be glad to provide the .cl file if there are problems when copying the code into a text editor.[code:1:e134b2a320]
procedure cas_pro (fil,lectura, bin)
#--------------------------------------------------------------------------------------------------------------------------------------------------
# By Sebastian Bruzzone 2008-2009
# contact: sbruzzone@fisica.edu.uy
# Los Molinos Observatory IAU code 844
# Departamento de Astronomia, Facultad de CIencias, Montevideo, Uruguay
#
#Final version August 14
# This script performs basic image calibration on images taken with the Roper 1300B CCD camera
# at CASLEO. The script would look for object and calibration images in each binning (bin) factor,
# reading frequency (lectura) and filter (fil), all of these, provided by the user.
# Also, there is a selection for bias processing or overscan region processing.
# Dome flats and sky flats are searched and analysed to select only non-saturated
# frames and those within the linearity of the CCD detector.
# After processing the images, calibration folders are created for each filter, bin factor and frequency
# The images are also converted to fits format
# Please note GAIN and RDNOISE values. AVSIGCLIP is used to perform the master Flat frame.
# Optional, run Maxim_header_v1a to enable MaximDL compatibility.
# Summary:
# 1. Images are converted to .imh file format, generating also the .pix files
# stored at the imdir directory
# 2. Header keywords are edited for the selected bin, lectura and filter desired
# by the user.
# 2a. Lists created: bin_lista1, bin_lista2 (bin factor images used)
# bias_list (zero images)
# list_R list_V(filtered images e.g. R or V)
# k_list, M_list (.imh images with selected freq)
# k_lista, M_lista (.fits images with selected freq)
# fltas_buenos (good flats)
# flats_malos (bad flats)
# flat_list (flat images)
# object_list (object images)
# salida_biascor_stat (statistics of calibrated files)
# salida_oscancor_stat (statistics of calibrated, via oscan files)
# salida_flat_stat (flats statistics)
#
# 3a. Domeflat and skyflat images are checked for linearity and non saturaded files, the good flats
# are selected, those saturated flats are moved to a created directory, the JUNK directory.
# 3b. Also, images with negative values, and non-saturated, are converted into
# positive values by adding the offset by this signed bits, those images are renamed
# as minus_file, where file stands for the original file.
# 4. The script prompts for a bias correction or overscan substraction method.
# 5. For the selected option, bias or oscan substraction is performed, also
# with the selected good flats, a flat calibration is also performed.
# 6. The calibrated images are moved to a folder, the PRO folder with
# information about the calibration method used, the list of the object files,
# the list of calibration images used and the master images, Zero and Flat
# 7. .imh files and lists are DELETED upon start of the script.
# 8. wfits is used to convert the .imh files to the standar .fits format
#--------------------------------------------------------------------------------------------------------------------------------------------------------
int bin {prompt='HEDIT_CASLEO: Binning factor of images (1 o 2): '}
string fil {prompt=' HEDIT_CASLEO: Filter (R,V): '}
string lectura {prompt='HEDIT CASLEO: Reading Frequency, 100khz( k ) or 1Mhz(M): ' }
bool resp {prompt="Would you like to continue? ", mode="q"}struct *list3
struct *list2
struct *list
begin

string filtro,read
bool resp2
real w
int dummy, inum,inumf, inumobj,inumbias, binning, j
filtro=fil
read=lectura
binning=bin

#.....................................................................................................deleting files before start


imdel ("*.imh")
del("list_R")
del("list_V")
del("bias_list")
del("bin_lista2")
del("bin_lista1")
del("list_R")
del("k_list")
del("k_lista")
del("flat_list")
del("flats_buenos")
del("flats_malos")
del("flats_negativos")
del("object_list")
del("salida_biascor_stat")
del("salida_oscancor_stat")
del("salida_flat_stat")
del("M_list")
del("M_lista")
del("flats")
del("all_imh")
del("all_fits")
del("pro_object")
del("pro_flats")
clear
print("**********************************************************************************************************")
print("")
print("Script for basic reduction of images from CASLEO's Roper 1300b CCD Camera")
print("This script would edit image headers and perform basic zero level and flat field corrections" )
print("Input images should be in .fit or .fits format. Images would be converted and handled as .imh files")
print("Place the script along with the desired images in the same folder. User would be asked to proceed")
print(" with calibration before starting")
print("Required fields defined: LECTURA, BIN, FILTER01, with values 100Khz or 1Mhz for LECTURA")
print("e.g. LECTURA='100Khz', BIN='2', FILTER01='R' ")
print("Input: Raw fit or fits images by: Binning factor (bin), reading frequency (LECTURA) and filter (fil)")
print("Output: Processed images in .imh format and .fits format")
print("Please check that the object images have the IMAGETYP='object' field defined. If not, edit it")
print("")
print("Images would be filtered by binning factor, filter and then frequency (LECTURA)")
print("packages noao.obsutil imred.ccdred should be loaded")
print("")
print("TRIMSEC and BIASSEC sections, for bin 1 images: [1:1340,1:1299] , [1:1340,1300:1309]")
print("TRIMSEC and BIASSEC sections, for bin 2 images: [1:670,1:649], [1:670,651:654]")
print("IF you don't agree with this regions, please edit them in the script ")
print("")
print("")
print("Sebastian Bruzzone 2009 ")
print("contact: sbruzzone@fisica.edu.uy ")
print("Los Molinos Observatory IAU code 844 Departamento de Astronomia, Fac de Ciencias ")
print("********************************************************************************************************")

if(resp){

print("...............................................")
print("Processing using filter: ",(filtro))
print(" with binning factor: ", (binning))
print(" at: ", (read))
print("................................................")



switch(binning) {
#........................................................Switch binning 1 (case 1)

case 1:
{
hselect("*.fit","$I","BIN=1", > "bin_lista1")
hselect("@bin_lista1", "$I","FILTER01?='"//filtro//"'", > "list_"//filtro)
hedit("@list_"//filtro,"BIASSEC","[1:1340,1300:1309]",add+,addonly+,up+,ver-)
hedit("@list_"//filtro,"TRIMSEC","[1:1340,1:1299]",add+,addonly+,up+,ver-)

#.......................................................................................................................begin of nested switch @bin1
switch(stridx(read, "k"))
{
case 1:
{
print("")
print(".......................................")
print(" Using bin1 images at 100Khz ")
print("Press any key to continue")
print(".......................................")
hselect("@bin_lista1","$I","IMAGETYP ?='zero'&&(LECTURA='100khz'||LECTURA='100kHZ'||LECTURA='100Khz')", > "k_lista")
hselect("@list_"//filtro,"$I","LECTURA='100khz'||LECTURA='100kHZ'||LECTURA='100Khz'", >> "k_lista")
!sed 's/.fit/.imh/g' k_lista > k_list
rfits("@k_lista","*","@k_list",datatype=u)
chpixtype("@k_list","@k_list",newpixty="real")
hedit("@k_list", "FILTERID",filtro, add+,up+,ver-)
hselect("@k_list", "$I","IMAGETYP?='zero'",> "bias_list")
hselect("@k_list","$I","IMAGETYP ?='object' ", > "object_list")
hselect("@k_list","$I","IMAGETYP ?='flat' ",> "flat_list")
hselect("@k_list","$I","IMAGETYP ?='sky' ",>> "flat_list")
hedit("@k_list","RDNOISE","5", add+, up+,ver-)
hedit("@k_list","GAIN","2", add+, up+,ver-)
}
case 0:
{
print(".................................")
print("Using bin1 images at 1Mhz")
print("Press any key to continue")
print(".......................................")
hselect("@bin_lista1","$I","IMAGETYP ?='zero'&&LECTURA ='1Mhz'", > "M_lista")
hselect("@list_"//filtro,"$I","LECTURA='1Mhz'", >> "M_lista")
!sed 's/.fit/.imh/g' M_lista > M_list
rfits("@M_lista","*","@M_list",datatype=u)
chpixtype("@M_list","@M_list",newpixty="real")
hedit("@M_list", "FILTERID",filtro, add+,up+,ver-)
hselect("@M_list","$I","IMAGETYP?='zero'",> "bias_list")
hselect("@M_list","$I","IMAGETYP?='object'", > "object_list")
hselect("@M_list","$I","IMAGETYP?='flat'",> "flat_list")
hselect("@M_list","$I","IMAGETYP?='sky'",>> "flat_list")
hedit("@M_list","RDNOISE","7", add+, up+,ver-)
hedit("@M_list","GAIN","2", add+, up+,ver-)
}
default:

print("Input error")

}
#....................................................................................................end of nested switch @bin1

}
case 2: #.....................................Switch binning 2 (case 2)
{
hselect("*.fit","$I","BIN=2", > "bin_lista2")
hselect("@bin_lista2", "$I","FILTER01?='"//filtro//"'", > "list_"//filtro)
hedit("@list_"//filtro,"BIASSEC","[1:670,651:654]",add+,addonly+,up+,ver-)
hedit("@list_"//filtro,"TRIMSEC","[1:670,1:649]",add+,addonly+,up+,ver-)
#.................................................begin of nested switch @bin2
switch(stridx(read, "k"))
{

case 1: #Gain value of 1.49 and RDNOISE 2.6 @ bin2 and 100khz with findgain

{
print("")
print("......................................")
print(" Using bin2 mages at 100Khz")
print(" Press any key to continue")
print(".......................................")
hselect("@bin_lista2","$I","IMAGETYP ?='zero'&&(LECTURA='100khz'||LECTURA='100kHZ'||LECTURA='100Khz')", > "k_lista")
hselect("@list_"//filtro,"$I","LECTURA='100khz'||LECTURA='100kHZ'||LECTURA='100Khz' ", >> "k_lista")
!sed 's/.fit/.imh/g' k_lista > k_list
rfits("@k_lista","*","@k_list", datatype=u)
chpixtype("@k_list","@k_list",newpixty="real")
hedit("@k_list", "FILTERID",filtro, add+,up+,ver-)
hselect("@k_list", "$I","IMAGETYP?='zero' ",> "bias_list")
hselect("@k_list","$I","IMAGETYP ?='object' ", > "object_list")
hselect("@k_list","$I","IMAGETYP ?='flat'",> "flat_list")
hselect("@k_list","$I","IMAGETYP ?='sky'",> "flat_list")
hedit("@k_list","RDNOISE","5", add+, up+,ver-)
hedit("@k_list","GAIN","2", add+, up+,ver-)

}
case 0:
{
print(".......................................")
print("Using bin2 images at 1Mhz ") #en bin2
print("Press any key to continue")
print(".......................................")
hselect("@bin_lista2","$I","IMAGETYP ?='zero'&&LECTURA='1Mhz'", > "M_lista")
hselect("@list_"//filtro,"$I","((LECTURA='1MHz')||(LECTURA='1Mhz')) ", >> "M_lista")
!sed 's/.fit/.imh/g' M_lista > M_list
rfits("@M_lista","*","@M_list", datatype=u)
chpixtype("@M_list","@M_list",newpixty="real")
hedit("@M_list", "FILTERID",filtro, add+,up+,ver-)
hselect("@M_list","$I","IMAGETYP?='zero'",> "bias_list")
hselect("@M_list","$I","IMAGETYP?='object'", > "object_list")
hselect("@M_list","$I","IMAGETYP?='flat'",> "flat_list")
hselect("@M_list","$I","IMAGETYP?='sky'",>> "flat_list")
hedit("@M_list","RDNOISE","7", add+, up+,ver-)
hedit("@M_list","GAIN","2", add+, up+,ver-)
}

}
} #...........................end of nested switch @bin2
default:
print("Input Error")
}
#....................................................................................................................Case 2 ending, main switch


#
#............................................................................................................counting objects, flats and bias imagesinumbias=0
if (access("bias_list")) {
count("bias_list") | scan (inumbias)
}
if(inumbias>0){
print("")
print("**********************************************")
print("Bias Files @"//read//": ",(inumbias))
print("**********************************************")
print("")
}
else{
print("***************************************")
print("There were NO Bias Images")
print("Check IMAGETYP key in you images ")
print("Bias files should have IMAGETYP='zero' ")
print("***************************************")
}
inumobj=0
if (access("object_list")) {
count("object_list") | scan (inumobj)
}
if(inumobj>0){
print("")
print("***************************************************")
print("Object files @100"//read//"hz: ",(inumobj))
print("***************************************************")
}
else{
print("")
print("*********************************")
print("THERE ARE NO OBJECT FILES")
print("**********************************")
}
#......................................................................... print("...............................................")
print("Looking for Non-saturated Flats")
print("...............................................")

count("flat_list") | scan(inum)
print("")
print("***********************************")
print("Flat files, inum=",(inum))
print("***********************************")
if(inum>0) { #................................looking for saturated flats
list="flat_list"
while (fscan(list,s1) !=EOF) {
imstat(s1//"[100:600,100:500]",fields="mean",format-,cache+) | scan (w)
if ( w < 40000 && w > 2000 ) {
files(s1,>>"flats_buenos")
}
else if (w>-32768 && w<-24768){
imarit(s1,'+',65535,s1) #................................adding 65535 adu's. See Note 1 at the end of the script
imrename(s1,"minus_"//s1)
files("minus_"//s1,>>"flats_buenos")
print("Negative flat found")
print("Renaming this file ",s1," as minus_"//s1)
} else
files(s1,>>"flats_malos")

}


if(access("flats_buenos")){
count("flats_buenos") | scan(inumf)
print("")
print("**************************")
print("Good Flats : ", inumf)
print("**************************")
}
else{
print("***************************")
print("There are no GOOD flats ")
print("***************************")
}
}
else{
print("..............................")
print("Therea are NO flats")
print(".............................")
}
#........................................movig bad flats to the JUNK directory
i=0
if (access("flats_malos")) {
count("flats_malos") | scan (i)
}
if(i>0){
print(".....................")
print("Bad Flats :",(i))
print(".......................")
mkdir("JUNK")
imcopy("@flats_malos","JUNK",ver+)
}#......................................................................................Bias or Oscan selection
print("")
print("")
print(".....................................................................")
print("Choose between Overscan correction('yes')" )
print("or Bias correction ('no') ")
print("If ('yes'), the interactive curve fiting mode would be enabled")
print("to fit the overscan profile")
print("")
print("Would you like to run the Overscan correction mode?")
print("...........................................................................")
print("")
#........................................................................

!cat "object_list" "flats_buenos" > "objetos_mas_flats" #merging the lists of objects and flats

dummy=scan(resp2)
if(resp2){
############
#Oscan Correction#..........................................................................................................................
############
print("")
print("**** Overscan Correction****")
print("")
#............................................................................................................1st run on ccdproc ccdproc("@objetos_mas_flats", output="",oversca+ ,trim+ ,zerocor- , darkcor- ,flatcor- ,readaxi="column",biassec="image", trimsec="image",interact+,functio="spline3",order=6,niterate=2)
#.............................................................................................................looking for flats
inumf=0
if (access("flats_buenos")) {
count("flats_buenos") | scan (inumf)
}
#There should be at least, 3 flats
if(inumf>3) {
print(".................................")
print(" Good flats: ",inumf)
print(".................................")
#..............................................................................................................Creating the Flatimcombine("@flats_buenos",output="Flat.imh",combine="median",reject="avsigclip",scale="mode")
imstat("@flats_buenos",> "salida_flat_stat")
}
else{
print("...................................................")
print("There wasn't enough flats images")
print("...................................................")
}
imstat("@object_list", > "salida_oscancor_stat")
#...............................................................................................................2nd run on ccdproc Flat correction ccdproc("@object_list",output="",oversca-,trim+,zerocor-, darkcor-,flatcor+,flat="Flat.imh",illum-,fringe-,readaxi="column",biassec="image",trimsec="image",interact-,functio="spline3",order=6)
#.............................................................................................................saving fits files using wfits at the PROC folder mkdir ("PROC_oscan_"//filtro//"_"//read)
list2="object_list"
while(fscan(list2,s2) != EOF){
imrename(s2, "pro_"//s2)
files("pro_"//s2,>>"pro_object")
}

list3="flats_buenos"
while(fscan(list3,s2) != EOF){
imrename(s2, "pro_"//s2)
files("pro_"//s2,>>"pro_flats")
}

!cat "pro_object" "pro_flats" > "all_imh"
!ls Flat.imh >> "all_imh"
!ls Zero.imh >> "all_imh"
!sed 's/.imh/.fits/g' all_imh > all_fits

wfits("@all_imh", "@all_fits")

imcopy("@all_fits", "PROC_oscan_"//filtro//"_"//read,ver+)


cp("salida_oscancor_stat","PROC_oscan_"//filtro//"_"//read)
cp("salida_flat_stat","PROC_oscan_"//filtro//"_"//read)
cp("object_lista","PROC_oscan_"//filtro//"_"//read)
cp("object_list","PROC_oscan_"//filtro//"_"//read)
cp("flats_buenos","PROC_oscan_"//filtro//"_"//read)
#..............................................................................................viewing the master Flat (could be ignored)
display("Flat.imh",1)

#...............................................................................................deleting files
imdel ("*.imh")
del("lista")
del("list")
del("list_R")
del("list_V")
del("bias_list")
del("flat_list")
del("flats_buenos")
del("flats_malos")
del("object_list")
del("salida_biascor_stat")
del("salida_oscancor_stat")
del("salida_flat_stat")

#........................................................................................................

print("*************************************")
print("Object images processed: ",(inumobj))
print("Flat images processed: ",(inum))
print("Images saved at PROC_ folder")
print("in fits format using wfits")
print("End of Script")
print("*************************************CAS_PRO") }
else{
###########
# Bias Correction#...........................................................................................................
###########

print("")
print("*** Bias Correction ***")
print("")
#..................................................................................Combining Bias frames and 1st run on ccdprocimcombine("@bias_list",output="Zero.imh",combine="average",reject="minmax",scale="none",nlow=0,nhigh=1,gain="image", rdnoise="image")ccdproc("@objetos_mas_flats", output="",oversca-,trim+,zerocor+, zero="Zero.imh", darkcor-,flatcor-,illum-,fringe-,readaxi="column",trimsec="image",interact-,functio="chebyshev",order=1)

#.......................................................................................looking for good flatsinumf=0
if (access("flats_buenos")) {
count("flats_buenos") | scan (inumf)
}
#......................there should be more than 3 flats
if(inumf>3) {print(".............................")
print("Good Flats: ",inumf)
print(".............................")#........................................................................................Creating the Flat imageimcombine("@flats_buenos",output="Flat.imh",combine="median",reject="avsigclip",scale="mode",rdnoise="rdnoise", gain="gain")
imstat("@flats_buenos",> "salida_flat_stat")
}
else {
print(".................................................................")
print("***There wasn't not enough flat images***")
print(".................................................................")
}imstat("@object_list", > "salida_biascor_stat")
#.......................................................................................................2nd run on ccdproc, Flat correction ccdproc("@object_list",output="",oversca-,trim+,zerocor+, zero="Zero.imh", darkcor-,flatcor+,flat="Flat.imh",illum-,fringe-,readaxi="column",trimsec="image",interact-,functio="chebyshev",order=1)

#........................................................................................................ saving images in fits format at the PROC folder
mkdir ("PROC_bias_"//filtro//"_"//read)
list2="object_list"
while(fscan(list2,s2) != EOF){
imrename(s2, "pro_"//s2)
files("pro_"//s2,>>"pro_object")
}

list3="flats_buenos"
while(fscan(list3,s2) != EOF){
imrename(s2, "pro_"//s2)
files("pro_"//s2,>>"pro_flats")
}
!ls Flat.imh >> "all_imh"
!ls Zero.imh >> "all_imh"
!cat "pro_object" "pro_flats" > "all_imh"
!sed 's/.imh/.fits/g' all_imh > all_fits

wfits("@all_imh", "@all_fits")
imcopy("@all_fits", "PROC_bias_"//filtro//"_"//read,ver+) cp("salida_biascor_stat","PROC_bias_"//filtro//"_"//read)
cp("salida_flat_stat","PROC_bias_"//filtro//"_"//read)
cp("flats_buenos","PROC_bias_"//filtro//"_"//read)
!sed 's/.imh/.fits/g' object_list > object_lista
cp("object_lista", "PROC_bias_"//filtro//"_"//read)
cp("object_list","PROC_bias_"//filtro//"_"//read)#.............................................................................................................viewing the Flat images (it could be ignored)
display("Flat.imh",1)

#.....................................................................................................................deleting files.......
imdel ("*.imh")
del("lista")
del("list")
del("list_R")
del("list_V")
del("bias_list")
del("flat_list")


#...................................................................................................................
print("*************************************")
print("Object images processed: ",(inumobj))
print("Flat images processed: ",(inum))
print("Images saved at PROC_ folder")
print("in fits format using wfits")
print("End of Script")
print("*************************************CAS_PRO")
}
}
end




#Note
#The negative valued images apeared in the last run at Casleo, also very saturated images, due maybe because of residual charges
#in the ccd detector.
[/code:1:e134b2a320]

 
Profile Email
 Quote
Gaba_p
 07/08/2009 03:41AM  
++++-
Regular Member

Status: offline


Registered: 10/10/2008
Posts: 104
Hi,I've also written a suite of scripts to help me automate image processing on direct ccd images from CASLEO observatory.
My first script is similar to the one you post here, but different. What it does is:* Adds TRIMSEC, BIASSES, GAIN, RDNOISE and FILTERS values to the image headers of all the files.
* Runs 'rfits' on ALL files to set datatype="ushort" (pixel value max: 64000).
* Runs 'zerocombine'.
* Runs 'ccdproc' to apply 'biassec', 'trimsec' and 'zerocor'.
* Runs 'flatcombine'.
* Runs 'ccdproc' to apply 'flatcor'.
* Runs 'imtranspose' to rotate the stars frames.The script assumes all files are *.fit files (these are not converted to *.imh files).
The names of the files [b:6c6b93c763]must have a specific format [/b:6c6b93c763] (this is very important since the FILTER id's are not written inside the image headers; so they have to be obtained from the actual file name) and the values: Gain, Rdnoise, Trimsec and Biassec, must be known. All images (bias, flats and star frames) must be on the working folder and after the script is done, flats, bias and combined flats and bias will be moved each to a single folder.
I also have 6 other scripts, the biggest one being 'casleopsf' which I use to help me automate the aperture and PSF photometry process.
Here's the code in case someone might find it useful (it's heavily commented).Cheers!
Gabriel
[code:1:6c6b93c763]
################################################################################
#
# ===========================================================
# SCRIPT TO PERFORM ZEROCOMBINE, FLATCOMBINE, ETC..
# ===========================================================
#
# To run properly this procedure must be executed inside the package:
# 'noao.imred.ccdred'
#
# by Gabriel Perren 2009
#
################################################################################ bool check, check2
int j,k,q,h,i,n,m,e,o
struct *flist, *flist2, *flist3
struct line,line2,line3,line4
string file_name,file_name2,file_name3,BIASSEC,TRIMSEC,biassec2,trimsec2
real gain, rdnoise
# ------------------------------------------------------------------------------------
# Control 0
# ------------------------------------------------------------------------------------
print ('')
print (' Before running this script, the task "setairmass" must be used')
print (' inside the folder where ALL the frames (bias, flats and standars)')
print (' are, in the following way:')
print ('')
print (' setarimass *.fit')
print ('')
print (' This task is located inside: noao/astutil')
print ('')
print ('Is this correct (else exit)? (y/n)')
print ('')
scan (check)
if (check == yes) {
}
else {
bye()
}# ------------------------------------------------------------------------------------
# Control 0
# ------------------------------------------------------------------------------------# ------------------------------------------------------------------------------------
# Control 1
# ------------------------------------------------------------------------------------
if (! defpac ("ccdred")) {
print ('')
print (' This script must be loaded inside the package noao/imred/ccdred')
bye()
}
else {
print (' Script loaded inside noao/imred/ccdred package')
print (' Oth Control correct')
print ('')
}
# ------------------------------------------------------------------------------------
# Control 1
# ------------------------------------------------------------------------------------# ------------------------------------------------------------------------------------
# Activate following controls
# ------------------------------------------------------------------------------------ print ('-----------------------------------------------------------------')
print ('Activate remaining 3 controls? (y/n)')
print ('If you dont know what this is, you should answer "yes"')
print ('')
scan (check) if (check == yes) { # ------------------------------------------------------------------------------------
# 1º Control
# ------------------------------------------------------------------------------------
print ('-----------------------------------------------------------------')
print ('1st Control')
print ('TODOS LOS ARCHIVOS (FLATS, BIAS, FRAMES DE CUMULOS Y ESTANDARS)')
print ('DEBEN ENCONTRARSE EN LA CARPETA DE TRABAJO')
print ('')
print ('Se encuentran todos los archivos en la carpeta de trabajo? (y/n)')
print ('')
scan (check2)
if (check2 == yes) { # Do nothing
}
else {
bye()
}
# ------------------------------------------------------------------------------------
# 1º Control
# ------------------------------------------------------------------------------------
# ------------------------------------------------------------------------------------
# 2º Control
# ------------------------------------------------------------------------------------
print ('-----------------------------------------------------------------')
print ('2nd Control')
print ('Esta tarea asume que los nombres de las imagenes de FLATS, BIAS,')
print ('FRAMES DE CUMULOS y ESTANDARS se encuentran en el siguiente formato:')
print (' ')
print ('- para FLATS: "flatwx.fit" o "skywx.fit"; donde "w" representa la')
print ('letra del filtro correspondiente (U, B, V, R, I) y "x" representa')
print ('el numero de flat. De esta manera el tercer FLAT tomado en el filtro B')
print ('tendria como nombre: "flatb3.fit" o "skyb3.fit".')
print (' ')
print ('- para BIAS: "biasx.fit"; donde "x" representa el numero de bias.')
print ('De esta manera el bias numero 5 tendria como nombre: "bias5.fit".')
print (' ')
print ('- para FRAMES DE CUMULOS Y ESTANDARS: "abcdwx.fit"; donde "abcd"')
print ('representa las cuatro letras que identifican al cumulo correspondiente')
print ('(es indistinto las cuatro letras que sean), "w" representa la letra')
print ('que identifica, al filtro y "x" representa el tiempo de exposicion.')
print ('De esta manera un frame de 30 seg tomado en el filtro B para el cumulo')
print ('Bochum 13 tendria como nombre: "bo13b30.fit".')
print (' ')
print ('Son correctos los nombres de los archivos? (y/n)')
print ('')
scan (check2)
if (check2 == yes) { # Do nothnig
}
else {
bye()
}
# ------------------------------------------------------------------------------------
# 2º Control
# ------------------------------------------------------------------------------------


# ------------------------------------------------------------------------------------
# 3º Control
# ------------------------------------------------------------------------------------
print ('-----------------------------------------------------------------')
print ('3rd Control ')
print ('Es necesario conocer los valores de TRIMSEC y BIASSEC')
print ('(si es que son necesarios) en los pasos siguientes.')
print (' ')
print ('Conoce estos valores? (y/n)')
print ('')
scan (check2)
if (check2 == yes) { # Do nothnig
}
else {
bye()
}
# ------------------------------------------------------------------------------------
# 3º Control
# ------------------------------------------------------------------------------------

# ------------------------------------------------------------------------------------
# 4º Control
# ------------------------------------------------------------------------------------
#print ('-----------------------------------------------------------------')
#print ('4th Control')
#print ('IMPORTANTE')
#print ('ANTES de correr este script debe haber ingresado en la')
#print ('linea de comandos de IRAF (o debe estar configurado por')
#print ('defecto) la sentencia:')
#print ('')
#print ('setinstrument=direct')
#print (' ')
#print ('Ha ingresado el comando o se encuentra configurado por defecto? (y/n)')
#print ('')
#scan (check2)
#if (check2 == yes) { # Do nothnig
#}
#else {
# bye()
#} setinstrument.instrument = "direct" # ------------------------------------------------------------------------------------
# 4º Control
# ------------------------------------------------------------------------------------
}
else { # Do nothnig
}

# ------------------------------------------------------------------------------------
# End of 'Activate following controls'
# ------------------------------------------------------------------------------------# ------------------------------------------------------------------------------------
# Add TRIMSEC, BIASSES, GAIN and RDNOISE to the image headers of all the files
# ------------------------------------------------------------------------------------ o = 1
h = 1
i = 1 while (o != 3) {
o=1 print ('Write BIASSEC to header? 1 = [25:1340,1301:1310], 2 = Other value, 3 = Do not write')
print ('(Not needed if no "overscan" correction is to be performed)')
print ('')
scan (q)

if (q == 2) {
print ('')
print ('Input BIASSEC with the following format: [num1:num2,num3:num4]')
print ('')
scan (BIASSEC)
}
else { # Do nothing
} print ('')
print ('Write TRIMSEC to header?')
print ('(Not needed if no "trim" correction is to be performed)')
print ('1 = [25:1340,1:1299], 2= [10:1339,1:1295], 3 = Other value, 4 = Do not write')
print ('')
scan (e)

if (e == 3) {
print ('Input TRIMSEC with the following format: [num1:num2,num3:num4]')
print ('')
scan (TRIMSEC)
}
else { # Do nothing
}
if (q == 1) {
o = o+1
}
else {
if (q == 2) {
o = o+1
}
else {
if (q == 3) {
o = o+1
}
else {
o = o+0
print ('')
print ('Wrong number. Try again..')
print ('')
}
}
}

if (e == 1) {
o = o+1
}
else {
if (e == 2) {
o = o+1
}
else {
if (e == 3) {
o = o+1
}
else {
if (e == 4) {
o = o+1
}
else {
o = o+0
print ('')
print ('Wrong number. Try again.')
print ('')
}
}
}
} } # This bracket closes the 'o != 3' while
print ('Adding TRIMSEC and BIASSEC...') if (q == 1) {
hedit (images="*.fit", fields="BIASSEC", value="[25:1340,1301:1310]", add=yes, addonly=yes, delete=no, verify=no, update=yes)
biassec2 = "[25:1340,1301:1310]"
}
else {
if (q == 2) {
hedit (images="*.fit", fields="BIASSEC", value=(BIASSEC), add=yes, addonly=no, delete=no, verify=no, update=yes)
biassec2 = BIASSEC
}
else {
if (q == 3) {
h=2
hedit (images="*.fit", fields="BIASSEC", value="", add=yes, addonly=no, delete=no, verify=no, update=yes)
biassec2 = ""
}
else {
}
}
}
if (e == 1) {
hedit (images="*.fit", fields="TRIMSEC", value="[25:1340,1:1299]", add=yes, addonly=yes, delete=no, verify=no, update=yes)
trimsec2 = "[25:1340,1:1299]"
}
else {
if (e == 2) {
hedit (images="*.fit", fields="TRIMSEC", value="[10:1339,1:1295]", add=yes, addonly=no, delete=no, verify=no, update=yes)
trimsec2 = "[10:1339,1:1295]"
}
else {
if (e == 3) {
hedit (images="*.fit", fields="TRIMSEC", value=(TRIMSEC), add=yes, addonly=no, delete=no, verify=no, update=yes)
trimsec2 = TRIMSEC
}
else {
if (e == 4) {
i=2
hedit (images="*.fit", fields="TRIMSEC", value="", add=yes, addonly=no, delete=no, verify=no, update=yes)
trimsec2 = ""
}
else {
}
}
}
} print ('Adding GAIN y RDNOISE...')
print ('')
print ('Input GAIN value (CASLEO: 3.98e/ADU)')
scan (gain)
print ('Input RDNOISE value (CASLEO: 4.09e)')
scan (rdnoise)
hedit (images="*.fit", fields="GAIN", value=(gain), add=no, addonly=yes, delete=no, verify=no, update=yes)
hedit (images="*.fit", fields="RDNOISE", value=(rdnoise), add=no, addonly=yes, delete=no, verify=no, update=yes) print (gain,rdnoise, > "gain_rdnoise") # This file will be used by the 'casleopsf' script later on

# ------------------------------------------------------------------------------------
# End of 'Add TRIMSEC, BIASSES, GAIN and RDNOISE to the image headers of all the files'
# ------------------------------------------------------------------------------------# ------------------------------------------------------------------------------------
# Move BIAS frames and create folder to move FLATS later on
# ------------------------------------------------------------------------------------ print ('Moving biad frames to folder bias/...')
print ('')
mkdir bias
mkdir flats # In this folder we'll store the FLATS frames later on
mv bias*.fit bias/

# ------------------------------------------------------------------------------------
# End of 'Move BIAS frames and create folder to move FLATS later on'
# ------------------------------------------------------------------------------------# ------------------------------------------------------------------------------------
# Rfits on BIAS frames to set datatype="ushort" (pixel value max: 64000)
# ------------------------------------------------------------------------------------ print ('Rfits on BIAS frames to set datatype="ushort"...')
files bias/*.fit > fitfiles
rename (files="bias/*.fit", newname="fits", field="extn")
files bias/*.fits > fitsfiles rfits (fits_file="@fitsfiles", file_list="0", iraf_file="@fitfiles", make_image=yes,
long_header=no, short_header=yes, datatype="ushort", blank=0., scale=yes, oldirafname=no,
offset=0) delete bias/*.fits
delete fitfiles
delete fitsfiles

# ------------------------------------------------------------------------------------
# End of 'Rfits on BIAS frames to set datatype="ushort" (pixel value max: 64000)'
# ------------------------------------------------------------------------------------# ------------------------------------------------------------------------------------
# Add missing data to FLAT image headers
# ------------------------------------------------------------------------------------ print ('Adding missing data to FLAT image headers')
print ('')

files sky*.* > temp.sky
files flat*.* > temp.flats file_name2 = "temp.flats"
file_name3 = "temp.sky" flist2 = file_name2
flist3 = file_name3 n=0
while (fscan (flist2,line3) != EOF) {
n = n + 1
} m=0
while (fscan (flist3,line4) != EOF) {
m = m + 1
} if (n == 0 && m != 0) {
print ('No flat*.* files')
print ('Using sky*.* files...')
k=2
sleep 2
}
else {
if (m == 0 && n != 0) {
print ('No sky*.* files')
print ('Using flat*.* files...')
k=1
sleep 2
}
else {
if (m == 0 && n == 0) {
print ('No FLAT files of any kind found.')
print ('Closing...')
sleep 2
bye()
}
else { # Do nothing
}
}
}

delete temp.flats
delete temp.sky if (k == 1) {
hedit (images="flatu*.fit", fields="FILTERS", value="U", add=yes, addonly=no, delete=no, verify=no, update=yes)
hedit (images="flatb*.fit", fields="FILTERS", value="B", add=yes, addonly=no, delete=no, verify=no, update=yes)
hedit (images="flatv*.fit", fields="FILTERS", value="V", add=yes, addonly=no, delete=no, verify=no, update=yes)
hedit (images="flati*.fit", fields="FILTERS", value="I", add=yes, addonly=no, delete=no, verify=no, update=yes)
hedit (images="flat*.fit", fields="IMAGETYP", value="flat", add=yes, addonly=no, delete=no, verify=no, update=yes)
mv flat*.fit flats/
}
else {
if (k == 2){
hedit (images="skyu*.fit", fields="FILTERS", value="U", add=yes, addonly=yes, delete=no, verify=no, update=yes)
hedit (images="skyb*.fit", fields="FILTERS", value="B", add=yes, addonly=yes, delete=no, verify=no, update=yes)
hedit (images="skyv*.fit", fields="FILTERS", value="V", add=yes, addonly=yes, delete=no, verify=no, update=yes)
hedit (images="skyi*.fit", fields="FILTERS", value="I", add=yes, addonly=yes, delete=no, verify=no, update=yes)
hedit (images="sky*.fit", fields="IMAGETYP", value="flat", add=yes, addonly=yes, delete=no, verify=no, update=yes)
mv sky*.fit flats/
}
else {
print ('No FLAT files of any kind found.') # Redundant control.
print ('Closing...')
sleep 2
bye()
}
}# ------------------------------------------------------------------------------------
# End of 'Add missing data to FLAT image headers'
# -----------------------------------------------------------------------------------# ------------------------------------------------------------------------------------
# Rfits on FLAT frames to set datatype="ushort" (pixel value max: 64000)
# ------------------------------------------------------------------------------------ print ('Rfits on FLAT frames...')
print ('')
files flats/*.fit > fitfiles
rename (files="flats/*.fit", newname="fits", field="extn")
files flats/*.fits > fitsfiles rfits (fits_file="@fitsfiles", file_list="0", iraf_file="@fitfiles", make_image=yes,
long_header=no, short_header=yes, datatype="ushort", blank=0., scale=yes, oldirafname=no,
offset=0) delete flats/*.fits
delete fitfiles
delete fitsfiles# ------------------------------------------------------------------------------------
# End of 'Rfits on FLAT frames to set datatype="ushort" (pixel value max: 64000)'
# ------------------------------------------------------------------------------------# ------------------------------------------------------------------------------------
# Add filter data to standards and clusters frame's image headers
# ------------------------------------------------------------------------------------ print ('')
print (' Adding filter data to standards and clusters frames image headers...') files *.fit > fitfiles file_name = "fitfiles"
flist = file_name while (fscan (flist,line) != EOF) {
j = strlen (line)
if (substr (line, j-3, j) == ".fit") {
line2 = substr (line, 5, 5)
if (line2 == "u") {
hedit (images=(line), fields="FILTERS", value="U", add=yes, addonly=no, delete=no, verify=no, update=yes)
print (line, >> 'imagenes')
}
else {
if (line2 == "b") {
hedit (images=(line), fields="FILTERS", value="B", add=yes, addonly=no, delete=no, verify=no, update=yes)
print (line, >> 'imagenes')
}
else {
if (line2 == "v") {
hedit (images=(line), fields="FILTERS", value="V", add=yes, addonly=no, delete=no, verify=no, update=yes)
print (line, >> 'imagenes')
}
else {
if (line2 == "i") {
hedit (images=(line), fields="FILTERS", value="I", add=yes, addonly=no, delete=no, verify=no, update=yes)
print (line, >> 'imagenes')
}
else {
print ('ERROR IN FILENAME OF FILE: '//line)
print ('Filter value found: '//line2)
print ('Actual extension found: '//(substr (line, j-3, j))
print ('The file "imagenes" holds the names of the files correctly modified')
print ('Closing...')
bye()
}
}
}
}
}
else {
print ('ERROR IN FILENAME OF FILE: '//line)
print ('Actual extension found: '//(substr (line, j-3, j))
print ('The file "imagenes" holds the names of the files correctly modified')
print ('Closing...')
bye()
}
}# ------------------------------------------------------------------------------------
# End of 'Add filter data to standards and clusters frame's image headers'
# ------------------------------------------------------------------------------------# ------------------------------------------------------------------------------------
# Rfits on standards and clusters frames to set datatype="ushort" (pixel value max: 64000)
# ------------------------------------------------------------------------------------ print ('')
print ('Rfits on standards and clusters frames...')
print ('')
#files *.fit > fitfiles # Already done
rename (files="*.fit", newname="fits", field="extn")
files *.fits > fitsfiles rfits (fits_file="@fitsfiles", file_list="0", iraf_file="@fitfiles", make_image=yes,
long_header=no, short_header=yes, datatype="ushort", blank=0., scale=yes, oldirafname=no,
offset=0) delete *.fits
delete fitfiles
delete fitsfiles# ------------------------------------------------------------------------------------
# End of 'Rfits on standards and clusters frames to set datatype="ushort" (pixel value max: 64000)'
# ------------------------------------------------------------------------------------# ------------------------------------------------------------------------------------
# Zerocombine on BIAS frames
# ------------------------------------------------------------------------------------ zerocombine ("bias/bias*.fit",
output="Zero", combine="average", reject="minmax", ccdtype="zero", process=no,
delete=no, clobber=no, scale="none", statsec="", nlow=0, nhigh=1, nkeep=1,
mclip=yes, lsigma=3., hsigma=3., rdnoise="RDNOISE", gain="GAIN", snoise="0.",
pclip=-0.5, blank=0.)# ------------------------------------------------------------------------------------
# End of 'Zerocombine on BIAS frames'
# ------------------------------------------------------------------------------------# ------------------------------------------------------------------------------------
# 1º 'ccdproc' run to apply 'biassec', 'trimsec' and 'zerocor'
# ------------------------------------------------------------------------------------ #biassec (overscan)
#1 = [25:1340,1301:1310], 2 = Otro valor, 3 = Do not write (h = 2) #trimsec (trim)
#1 = [25:1340,1:1299], 2= [10:1339,1:1295], 3 = Otro valor, 4 = Do not write (i = 2) print ('')
print ('Ccdproc run to apply "overscan", "trim" and "zerocor"')
print ('')
print ('Standards and cluster frames...')
print ('')
if (h == 2 && i == 2) {
ccdproc ("*.fit",
output=" ", ccdtype=" ", max_cache=0, noproc=no, fixpix=no, overscan=no,
trim=no, zerocor=yes, darkcor=no, flatcor=no, illumcor=no, fringecor=no,
readcor=no, scancor=no, readaxis="line", fixfile=" ",
biassec="image", trimsec="image", zero="Zero", dark="",
flat=" ", illum=" ", fringe="", minreplace=1., scantype="shortscan", nscan=1,
interactive=no, function="chebyshev", order=4, sample="*", naverage=1,
niterate=1, low_reject=3., high_reject=3., grow=1.)
}
else {
if (h == 2 && i == 1) {
ccdproc ("*.fit",
output=" ", ccdtype=" ", max_cache=0, noproc=no, fixpix=no, overscan=no,
trim=yes, zerocor=yes, darkcor=no, flatcor=no, illumcor=no, fringecor=no,
readcor=no, scancor=no, readaxis="line", fixfile=" ",
biassec="image", trimsec="image", zero="Zero", dark="",
flat=" ", illum=" ", fringe="", minreplace=1., scantype="shortscan", nscan=1,
interactive=no, function="chebyshev", order=4, sample="*", naverage=1,
niterate=1, low_reject=3., high_reject=3., grow=1.)
}
else {
if (h ==1 && i == 2) {
ccdproc ("*.fit",
output=" ", ccdtype=" ", max_cache=0, noproc=no, fixpix=no, overscan=yes,
trim=no, zerocor=yes, darkcor=no, flatcor=no, illumcor=no, fringecor=no,
readcor=no, scancor=no, readaxis="line", fixfile=" ",
biassec="image", trimsec="image", zero="Zero", dark="",
flat=" ", illum=" ", fringe="", minreplace=1., scantype="shortscan", nscan=1,
interactive=no, function="chebyshev", order=4, sample="*", naverage=1,
niterate=1, low_reject=3., high_reject=3., grow=1.)
}
else { #(h == 1 && i == 1)
ccdproc ("*.fit",
output=" ", ccdtype=" ", max_cache=0, noproc=no, fixpix=no, overscan=yes,
trim=yes, zerocor=yes, darkcor=no, flatcor=no, illumcor=no, fringecor=no,
readcor=no, scancor=no, readaxis="line", fixfile=" ",
biassec="image", trimsec="image", zero="Zero", dark="",
flat=" ", illum=" ", fringe="", minreplace=1., scantype="shortscan", nscan=1,
interactive=no, function="chebyshev", order=4, sample="*", naverage=1,
niterate=1, low_reject=3., high_reject=3., grow=1.)
}
}
} print ('')
print ('Flat frames...')
print ('')
if (h == 2 && i == 2) {
ccdproc ("flats/*.fit",
output=" ", ccdtype="flat", max_cache=0, noproc=no, fixpix=no, overscan=no,
trim=no, zerocor=yes, darkcor=no, flatcor=no, illumcor=no, fringecor=no,
readcor=no, scancor=no, readaxis="line", fixfile=" ",
biassec="image", trimsec="image", zero="Zero", dark="",
flat=" ", illum=" ", fringe="", minreplace=1., scantype="shortscan", nscan=1,
interactive=no, function="chebyshev", order=4, sample="*", naverage=1,
niterate=1, low_reject=3., high_reject=3., grow=1.)
}
else {
if (h == 2 && i == 1) {
ccdproc ("flats/*.fit",
output=" ", ccdtype="flat", max_cache=0, noproc=no, fixpix=no, overscan=no,
trim=yes, zerocor=yes, darkcor=no, flatcor=no, illumcor=no, fringecor=no,
readcor=no, scancor=no, readaxis="line", fixfile=" ",
biassec="image", trimsec="image", zero="Zero", dark="",
flat=" ", illum=" ", fringe="", minreplace=1., scantype="shortscan", nscan=1,
interactive=no, function="chebyshev", order=4, sample="*", naverage=1,
niterate=1, low_reject=3., high_reject=3., grow=1.)
}
else {
if (h ==1 && i == 2) {
ccdproc ("flats/*.fit",
output=" ", ccdtype="flat", max_cache=0, noproc=no, fixpix=no, overscan=yes,
trim=no, zerocor=yes, darkcor=no, flatcor=no, illumcor=no, fringecor=no,
readcor=no, scancor=no, readaxis="line", fixfile=" ",
biassec="image", trimsec="image", zero="Zero", dark="",
flat=" ", illum=" ", fringe="", minreplace=1., scantype="shortscan", nscan=1,
interactive=no, function="chebyshev", order=4, sample="*", naverage=1,
niterate=1, low_reject=3., high_reject=3., grow=1.)
}
else { #(h == 1 && i == 1)
ccdproc ("flats/*.fit",
output=" ", ccdtype="flat", max_cache=0, noproc=no, fixpix=no, overscan=yes,
trim=yes, zerocor=yes, darkcor=no, flatcor=no, illumcor=no, fringecor=no,
readcor=no, scancor=no, readaxis="line", fixfile=" ",
biassec="image", trimsec="image", zero="Zero", dark="",
flat=" ", illum=" ", fringe="", minreplace=1., scantype="shortscan", nscan=1,
interactive=no, function="chebyshev", order=4, sample="*", naverage=1,
niterate=1, low_reject=3., high_reject=3., grow=1.)
}
}
}
# ------------------------------------------------------------------------------------
# End of '1º 'ccdproc' run to apply 'biassec', 'trimsec' and 'zerocor''
# ------------------------------------------------------------------------------------# ------------------------------------------------------------------------------------
# Flatcombine on flat frames
# ------------------------------------------------------------------------------------ unlearn ccdproc
ccdproc.output=" "
ccdproc.ccdtype="flat"
ccdproc.max_cache=0
ccdproc.noproc=no
ccdproc.fixpix=no
ccdproc.overscan=no
ccdproc.trim=no
ccdproc.zerocor=no
ccdproc.darkcor=no
ccdproc.flatcor=yes
ccdproc.illumcor=no
ccdproc.fringecor=no
readcor=no
ccdproc.scancor=no
ccdproc.readaxis="line"
ccdproc.fixfile=""
ccdproc.biassec="image"
ccdproc.trimsec="image"
ccdproc.zero="Zero"
ccdproc.dark=""
ccdproc.flat=" "
ccdproc.illum=" "
ccdproc.fringe=""
ccdproc.minreplace=1.
ccdproc.scantype="shortscan"
ccdproc.nscan=1
ccdproc.interactive=no
ccdproc.function="chebyshev"
ccdproc.order=4
ccdproc.sample="*"
ccdproc.naverage=1
ccdproc.niterate=1
ccdproc.low_reject=3.
ccdproc.high_reject=3.
ccdproc.grow=1. print ('')
print ('Flatcombine on flat frames')
print ('') if (k == 1) {
flatcombine ("flats/flat*.fit",
output="Flat", combine="average", reject="crreject", ccdtype="flat", process=yes,
subsets=yes, delete=no, clobber=no, scale="mode", statsec="", nlow=1, nhigh=1,
nkeep=1, mclip=yes, lsigma=3., hsigma=3., rdnoise=(rdnoise), gain=(gain),
snoise="0.", pclip=-0.5, blank=1.)
}
else {
if (k == 2){
flatcombine ("flats/sky*.fit",
output="Flat", combine="average", reject="crreject", ccdtype="flat", process=yes,
subsets=yes, delete=no, clobber=no, scale="mode", statsec="", nlow=1, nhigh=1,
nkeep=1, mclip=yes, lsigma=3., hsigma=3., rdnoise=(rdnoise), gain=(gain),
snoise="0.", pclip=-0.5, blank=1.)
}
else {
print ('No flat files found.') # Redundant control
print ('Closing...')
bye()
}
}# ------------------------------------------------------------------------------------
# End of 'Flatcombine on flat frames'
# ------------------------------------------------------------------------------------# ------------------------------------------------------------------------------------
# 2º 'ccdproc' run to apply 'flatcor'
# ------------------------------------------------------------------------------------ print ('')
print ('Ccdproc run to apply "flatcor"') if (h == 2 && i == 2) {
ccdproc ("*.fit",
output=" ", ccdtype="object", max_cache=0, noproc=no, fixpix=no, overscan=no,
trim=no, zerocor=no, darkcor=no, flatcor=yes, illumcor=no, fringecor=no,
readcor=no, scancor=no, readaxis="column", fixfile=" ",
biassec="", trimsec="", zero="Zero", dark="",
flat="Flat*", illum=" ", fringe="", minreplace=1., scantype="shortscan",
nscan=1, interactive=no, function="chebyshev", order=4, sample="*",
naverage=1, niterate=1, low_reject=3., high_reject=3., grow=1.)
}
else {
ccdproc ("*.fit",
output=" ", ccdtype="object", max_cache=0, noproc=no, fixpix=no, overscan=no,
trim=no, zerocor=no, darkcor=no, flatcor=yes, illumcor=no, fringecor=no,
readcor=no, scancor=no, readaxis="column", fixfile=" ",
biassec=(biassec2), trimsec=(trimsec2), zero="Zero", dark="",
flat="Flat*", illum=" ", fringe="", minreplace=1., scantype="shortscan",
nscan=1, interactive=no, function="chebyshev", order=4, sample="*",
naverage=1, niterate=1, low_reject=3., high_reject=3., grow=1.)
} mkdir calib
mv Flat*.* calib/ # Moves the Flat* files created by Flatcor and the Zero.out file created by Zerocor
mv Zero.* calib/ # to the folder "calib/"# ------------------------------------------------------------------------------------
# End of '2º 'ccdproc' run to apply 'flatcor''
# ------------------------------------------------------------------------------------# ------------------------------------------------------------------------------------
# Rotate the frames
# ------------------------------------------------------------------------------------print ('')
print('Rotating the frames: [-*,*]')imtranspose (input="*.fit[-*,*]", output="*.fit")# ------------------------------------------------------------------------------------
# End of 'Rotate the frames'
# ------------------------------------------------------------------------------------print ('')
print ('Script finished correctly! :)')
print ('')[/code:1:6c6b93c763]

 
Profile Email Website
 Quote
sebastian
 07/08/2009 03:41AM  
+++--
Chatty

Status: offline


Registered: 03/20/2007
Posts: 45
Nice!
The first script I wrote used the image names written with the format:
object_binning_filter_imagenumber.fits
i.e
2004GV9_bin2_R_001.fits
2002MS9_bin1_V_034.fits
from where it read binning factor and filter id.
The bad thing is that imagetyp='object'
must be on each image header for all objects.
Since there was just one reading frequency it was much simpler.
Again, it depended upon formating the name of the images in that maner, this time I get rid of that.
I'm trying to perform a blinking script so I could get rid of MaximDL when I'm trying to blink and detect very faint objects.
The alignment part is quite messy still.
Way ds9 or ximtool can't align images like MaximDL does?(using automatic start detection as Auto star matching etc) Rolling Eyes

 
Profile Email
 Quote
   
Content generated in: 0.09 seconds
New Topic Post Reply

Normal Topic Normal Topic
Sticky Topic Sticky Topic
Locked Topic Locked Topic
New Post New Post
Sticky Topic W/ New Post Sticky Topic W/ New Post
Locked Topic W/ New Post Locked Topic W/ New Post
View Anonymous Posts 
Anonymous users can post 
Filtered HTML Allowed 
Censored Content 
dog allergies remedies cialis 20 mg chilblain remedies


Privacy Policy
Terms of Use

User Functions

Login