pro acs_correct_cte, FILES, $ DATA_DIR=data_dir, $ INDEX=index, $ START=start, $ FINISH=finish, $ AMPLIFIERS=amplifiers, $ DELETE_OLD=delete_old, $ REVERSE_ORDER=reverse_order, $ JAVA_DIR=java_dir, $ WELL_DEPTH=well_depth, $ WELL_NOTCH_DEPTH=well_notch_depth, $ WELL_FILL_POWER=well_fill_power, $ TRAP_DENSITY=trap_density, $ TRAP_LIFETIME=trap_lifetime, $ TRAP_LOCATION_SEED=trap_location_seed, $ TRAP_INITIAL_DENSITY=trap_initial_density, $ TRAP_PERMANENT_RATE=trap_permanent_rate, $ TRAP_REMOVABLE_RATE=trap_removable_rate, $ N_ITERATIONS=n_iterations, $ KEEP_TEMP_FILES=keep_temp_files, $ CLUSTER_FARM=cluster_farm, $ CLUSTER_BOSS=cluster_boss, $ CLUSTER_NODES=cluster_nodes, $ CLUSTER_PROCESSORS=cluster_processors, $ CLUSTER_TEMPDIRS=cluster_tempdirs, $ CLUSTER_LOADS=cluster_loads, $ CLUSTER_CHECK=cluster_check ;+ ; NAME: ; ACS_CORRECT_CTE ; ; CATEGORY: ; Pixel-by-pixel correction of trailing due to charge transfer inefficiency in CCD ; detectors. ; ; PURPOSE: ; Iteratively uses Chris Stoughton's CCD readout model code to remove CTI trails. ; ; INPUTS: ; If none are specified, it takes a guess at everything. ; ; OPTIONAL INPUTS: ; FILES - String or string array containing the absolute file name of the science ; image(s) to be corrected, stripped of the suffix and extension. ; If that is not specified, the routine looks for files in: ; DATA_DIR - The directory where the _raw.fits (and _bia.fits) files are stored. ; A subset of the images can be selected via (either INDEX or START/FINISH, not both) ; INDEX - Which of the input files to correct e.g. [0,13,14] DEFAULT: all ; START - The index of the first image to correct DEFAULT: the first one ; FINISH - The index of the final image to correct DEFAULT: the last one ; AMPLIFIER- Which of the amplifiers to correct DEFAULT: ["A","B","C","D"] ; Many options concerning the correction itself can also be specified here. These are ; merely passed on to acs_clock_charge.pro, which also contains the default values. ; CLUSTER_B- Name of the master node (used to simplify farming jobs to this machine) ; DEFAULT: this one, as determined by the *nix command 'hostname'. ; CLUSTER_N- String array containing a list of the slave machine names. They can include ; username information (e.g. rjm@ishtar.caltech.edu) if required, although ; ssh keys need to be set up to allow non-interactive login to all these ; machines. The IDL and Java code also need to be available on all of them. ; NB: this can also be just a sinlge string containing the current host name, ; if that has more than one processor/core, and you want to hit them all. ; CLUSTER_P- Integer array specifying the number of processors/cores on each slave. ; This variable needs to have the same number of elements as cluster_nodes. ; CLUSTER_T- Either a string array containing the path to a directory on each slave ; where temporary files can be stored, or a single string that works on them ; all. In the latter case, it could be a different disc on each node, which ; just symbolic links with the same name, or a cross-mounted disc readable ; everywhere. ; CLUSTER_L- Floating point array containing the current loads on the cluster nodes. If ; this is not specified, they will be checked, but this is useful internally. ; ; KEYWORD PARAMETERS: ; DELETE_OL- ; CLUSTER_F- Run, in the background, on a free processor from a cluster. This feature ; is intended to emulate a formal job queueing/scheduling system, which was not ; available on the processors that I used for the COSMOS analysis. ; NB: SSH public/private keys need to be set up so that it is possible to ; log into the target nodes without interatively entering a password. ; NB: Once the process starts, this routine returns, and IDL moves on ; to the next task. No reporting is done when the image is ready! ; Clashes between temporary file names should not occur, so long as input ; images are not processed twice simultaneously. ; CLUSTER_C- Check the load on each cluster node EVERY time a new job is farmed out. ; DEFAULT: gas bill style estimate, interpolating a while from last reading. ; ; OUTPUTS: ; Four images are written to disc, each containing the data read through one amplifier. ; ; PROCEDURES USED: ; acs_split.pro, acs_clock_charge.pro, acs_trap_density and various others from the IDL ; Astronomy Users' Library (including fits_read.pro, fits_write.pro, etc.) ; ; MODIFICATION HISTORY: ; Nov 09 - JAVA_DIR keyword parsed through to ; Jul 08 - Cluster control mechanisms moved here from acs_clock_charge.pro by RM. ; Feb 08 - Written by Richard Massey. ;- ; Parse inputs starttime=systime(/seconds) if not keyword_set(suffix) then suffix=["_raw","_cte"] if not keyword_set(extension) then extension="fits" if not keyword_set(files) then files=acs_find_data(index=index,reverse=reverse_order,data_dir=data_dir,/check_bias,suffix=suffix[0],extension=extension) & n_files=n_elements(files) if not keyword_set(amplifiers) then amplifiers=["A","B","C","D"] & n_amplifiers=n_elements(amplifiers) if n_elements(start) ne 1 then start=0 if n_elements(finish) ne 1 then finish=n_files-1 if keyword_set(cluster_farm) then begin ;cluster_nodes=["oich.local","rjm@moel.caltech.edu"] & cluster_processors=[8,4] ;if not keyword_set(cluster_nodes) then cluster_nodes=["oich.local","rjm@"+["moel","kishar"+strtrim(indgen(12)+1,2),"elen","hebog","elidir"]+".caltech.edu"];,"ishtar.caltech.edu"] if not keyword_set(cluster_nodes) then cluster_nodes="rjm@"+["moel","kishar"+strtrim(indgen(12)+1,2),"ishtar","elen","hebog","elidir"]+".caltech.edu" if not keyword_set(cluster_processors) then cluster_processors=[4.3,0,2,0,2,0,0,replicate(2,6),0,1,1,2] if not keyword_set(cluster_tempdirs) then cluster_tempdirs="/scr2/rjm/cte/" ; This could also be an array, with one string for each node if not keyword_set(cluster_load_thresh) then cluster_load_thresh=0.8 ; This much load needs to be free for a process to run if not keyword_set(cluster_boss) then spawn,"hostname",cluster_boss if n_elements(cluster_nodes) ne n_elements(cluster_processors) then message,"The number of defined cluster names and the number of their processors do not agree!" if not keyword_set(max_processes) then begin ;spawn,"sudo sysctl -w kern.maxproc=400 ; sudo sysctl -w kern.maxprocperuid=400" ; You may want to run this, but it requires root access to the master node spawn,"sysctl -a | grep kern.maxprocperuid:",max_processesperuid,junk spawn,"sysctl -a | grep kern.maxproc:",max_processes,junk max_processes=fix(strmid(max_processes,(reverse(strsplit(max_processes)))[0]))& "+file_log+" &",junk,PID=pid message,/INFO,"Executing local process "+strtrim(pid,2)+" to manage a remote script on "+cluster_target+"." delvarx,cluster_target process_id[i,j]=pid>1 wait,5 ; Pause a moment to allow copying some time to at least get going before we move on to the next image endelse endfor ; ; ; Reassemble the four amplifiers into one combined fits file ; ; if total(process_id[i,*]) eq 0 then begin ; This includes the cases of not keyword_set(cluster_farm) and images for all the individual amps being done but the final acs_split, /unsplit, files[i]+suffix[1]+"."+extension, suffix=suffix, extension=extension message,/INFO,"Still running at "+systime()+", for "+strmid(strtrim((systime(/seconds)-starttime)/3600,2),0,5)+" hours." endif else begin ; Otherwise, periodically check progress on those processes that we know have been started on slave nodes n_loop=-1 if (i gt 2 or i eq finish) then while n_loop lt 200*(i eq finish) do begin in_progress=start+where(total(process_id[start:start>(i+n_loop-2)