The LAMP Application

Generated by IDLdoc

single page | use frames     summary     class     fields     routine details     file attributes

lamp_mac/FIGARO/

fcosmos.pro


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; cosmos_v239 MAG 30/07/2012: Simply added a warning at start to indicate that this program is obsolete and new cosmos should be used instead. MAG 14/05/2012 modified on 1/12/2011 by PG Based on Cosmos code from D17 (/home/cs/lambda/macros/D17/GENERAL/cosmos.pro) PG modifications: - 30/11/11 -Calculation of wavelength resolution --> Care: Bug in err_ray (factor of 2 missing)!!!! and angular resolution corrected -Interslit distance is read in for D17 now -Corrected the detector center for D17 MAG modifications: - Calculation Options: Introduce different choices for each angle. - Added Figaro values so that both D17 and FIGARO data can be treated. - Added reading of monitor (needed for FIGARO) and related arrays - Added possibility of selecting a different detector range for each angle - Added possibility of giving different values for the machine options for each angle - Added possibility of using monitor when the direct beam has not been measured - Added possibility of selecting a monitor run as direct beam (using m ###### in Direct box) - 15/5/09: Added new anal_factor routine from Bob Cubitt and changed format g10.4 --> g11.4 when writing AFT files. - 25/5/09: Corrected bug in call to cosmos_anal_run (the last variable passed to cosmos_anal_run was always 1, so the code was using always the options defined for the first angle, even for angles 2 and 3) - 08/6/09: Disabled warnings concerning small useful x-range. Added new gravity correction routine from Bob Cubitt. Modified text in machine options for d0 Modified text in calculation options for low res/statistics points - 08/7/09: Changed error calculation in cosmos_anal_run routines - 23/7/09: Added parameter slitsproduct used in D17 in order to normalize by the slits opening. This is needed if the direct and reflected beam have not been measured using the same slits values. To note that parameters S2X and S3X (param2[93] and param2[95]) seem to be wrong or at least they do not correspond to the slits widths s2w and s3w calculated as in LAMP as param2[8]+param2[9] and param2[12]+param2[13], which seem to be the correct values. So slits computed now in this way for D17. - 01/9/09: Names of procedures and functions changed in order to avoid duplications and problems in the LAMP runtime code. - 10/9/09: Corrected writing of AFT files. - 13/10/09: Corrected small differences with Cosmos due to: 1. Typo error in an IF command: 'd17' --> 'D17 ', so the normalization by slitsproduct was skipped. 2. Different weighting scheme in anal_mean: weightfactor = 1/dy^2 --> y/dy^2 weightedmeanerr = 1/sqrt(sumweights) --> weightedmean*sqrt(sumerrsq) - 28/10/09: Added option refdown for FIGARO to determine if the configuration employed is reflection down instead of the standard one. If so the gravity correction for theta is done in the same way as the standard case, but the newtheta is varied on the opposite sense. Corrected also a bug that made that the newtheta calculated in cosmos_grav was not employed in computing Q (angle_bragg was used instead). - 19/11/09: Changes in function cosmos_anal_log to remove only the negative points, but keep those where y < dy - 20/04/10: Remove +1 from the error estimation in cosmos_anal_run, cosmos_anal_run_nodirect, cosmos_anal_run_monitor Added printing of poff, openangle, d0 and pixelwidth in dialogue window (constants used in calculating lambda) No default values for poff, openangle, d0 and pixelwidth (set to zero) - 27/04/10: Corrected bug in the output to the dialog window of the background ranges (direct and reflect were inverted). - 15/06/10: Added new file format used in D17 from June 2010. Data are not written in a single block, but using a TOF block per detector line. - 21/06/10: Detector format option modified because the new format for XY acquisitions have not changed, so the program crashed when trying to read a water file. Now detector_format = 2 if the keyword '2' is in the second line of the numor file, but set back to 1 if the number of TOF channels = 1. - 15/07/10: Slight modification to the routine inserting the rows (added alignment=2 and /editable keywords). Also added some lines to routine cosmos_load_vars, so that when the saved table is loaded the row labels are correctly shown.(Affects FIGARO & D17). - 11/09/10: Modified writing of header of AFT files to avoid crashes due to IDL getting out of logical units. (This happened when there was no reflected beam for the first angle. In that case the command 'Results for reflect beam ' + reflect1[0] produced an error - as reflect1[0] is an integer = 0 and not a string - and the program continued without writing the afit file and without closing the logical unit). - 29/10/10: Corrected small bug that makes that table is not written. In cosmos_save_vars use if save_lun gt 0 then free_lun,save_lun instead of if free_lun gt 0 then free_lun,save_lun - 29/10/10: Added line files = strtrim(string(files),2) in cosmos_raw_read to avoid that the program gets stacked when a beam is missing and files is an integer = 0 instead of a string. - 25/11/10: Getting cosmos to work with FIGARO kinetic files. - 19/04/11: Read sample offset position and use it in the gravity correction procedure. Added parameters offset, slit3, and slit2 for this. And cosmos_grav routine changed in order to treat all the tof channels in one call and remove the do loop - 21/04/11: Bug if some points are removed in the "tidy floating point errors" section, as then the number of points is not equal to the value of result_size calculated before. Furthermore there can be additional problems if in a kinetic run, the number of removed points changes from slice to the other. I try to correct this using the first slice as reference (TO BE CHECKED WITH A REAL KINETIC SCAN). - 12/05/11: Parameter indicating the sample offset position changed from par1[24] to par1[23]. - 17/05/11: Corrected bug. In line 1550 anal.searchy --> anal.searchy3. - 20/06/11: The chopper separation for D17 is read from the numor parameters instead of being hardcoded. Note that if the value written in the parameter file (par2[14]) is <= 0.0 then the hardcoded value (85e-3) will be used. If the value written in par2[14] is < 10.0, then it is multiplied by 0.01. Otherwise the value read is multiplied by 0.001. The chopper separation is written in the dialog window, under "Constants used in calculating wavelength resolution" and should be ~0.08 m for D17. - 07/07/11: The region defined to search for the peak is only applied to the reflected beam, not to the direct beam. For the latter the peak search is done over the full useful range of the detector. This is done to avoid problems when the peak positions are not the same for direct and reflect. In the future one could envisage to give the possibility of defining two different regions for direct and reflected beams. - 14/05/12: Corrected bug on the analysis of kinetic runs. The background subtraction was only applied to the first slice. This has been corrected now in the routine cosmos_anal_run. The only modification was to put the calls to cosmos_anal_backgroundaverage and cosmos_anal_backgroundfit out of the "if islice eq 0 then begin ... endif" block. Note also that the cosmos_anal_run_nodirect and cosmos_anal_run_monitor routines cannot deal with kinetic scans. DID modifications: - 11/07/10: Cosmos add compile keyword (return immediatly) cosmos_ev_opencalcwindow add BASE_parent keyword to create the window in a TAB modify the frame sizes to fit in a TAB cosmos_ev_opendetectwindow add BASE_parent keyword to create the window in a TAB modify the frame sizes to fit in a TAB cosmos_ev_openmachwindow add BASE_parent keyword to create the window in a TAB modify the frame sizes to fit in a TAB Check for unmatched Free_lun(s). - 20/07/10: cosmos_dialogue_create add BASE_parent keyword to create the window in a TAB modify the frame sizes to fit in a TAB cosmos_save_vars , cosmos_load_vars , cosmos_ev_load , cosmos_background , cosmos_ev_go: WIDGET_ID.TABLE points either to COSMOS or to COSMOS_SHEET which may have different tables --> COSMOS_BI_SPREADSHEET Developed from Cosmos, version 1.7, written by Mark Laver: Modified July 05 so that data is grouped before calculating reflectivity (but after calculating q) such that grouping factor specifies a multiple of the instrument resolution at each q point Modified June 05 with better overlap routine (anal_factor) and better bundling algorithm Calculates relectivity data from D17 runs version 2 : uses errors instead of min/max values Fundamental changes from d17tof : errors = sqrt(count + 1) angle / tof distance correction ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Routines

cosmos_init_vars
cosmos_init_detector
result = cosmos_anal_append(array1, array2)
result = cosmos_anal_log(array)
cosmos_anal_backgroundaverage, arr, err, mask
result = cosmos_anal_peaksearchbasic(array)
result = cosmos_anal_peaksearchrefined(array, search, foregd)
cosmos_anal_peaksearchpro, cnt, xrange, usefulx, maximum, peakrange
result = cosmos_anal_sort(dataset)
result = cosmos_array_norm(array)
result = cosmos_str_make(value)
result = cosmos_str_split(original)
cosmos_str_value, original, remainder, value, floating=floating, integer=integer
result = cosmos_anal_calcangleoffset(peakpos, xoff, density, distance)
cosmos_close_subwins
cosmos_dialogue_add, txt
cosmos_dialogue_warn, txt
result = cosmos_anal_mean(array, weightoption)
result = cosmos_anal_factor(array_a, array_b)
result = cosmos_anal_factor_old(array_a, array_b)
cosmos_anal_peaksearchpro_newer, cnt, xrange, usefulx, maximum, peakrange
cosmos_ev_clear
cosmos_ev_insertrow
cosmos_ev_quit
cosmos_ev_updatecalc
cosmos_ev_updatedetect
cosmos_ev_updatemach
cosmos_ev_winclose, window_id
cosmos_lamp_write, workspace, array, workspacetitle
cosmos_main_getvars
result = cosmos_plot_add(array, plottitle)
cosmos_plot_finish
cosmos_save_vars
result = cosmos_str_formtheta(angle)
result = cosmos_getnumors(intlist)
result = cosmos_str_parse(original, float=float, integer=integer, flt_range=flt_range, int_range=int_range, string_set=string_set)
cosmos_table_labelupdate
cosmos_anal_ranges
cosmos_anal_backgroundfit, arr, err, mask, str
result = cosmos_anal_group(result, groupnum)
cosmos_anal_discard, result
cosmos_anal_bundle, result, maxres
cosmos_anal_bundle_old, result, resf
result = cosmos_anal_correctangle(angle, dirpeakpos, refpeakpos, dirxoff, refxoff, density, dirdist, refdist)
result = cosmos_anal_correctdistance(peakpos, xoff, density, distance)
cosmos_dialogue_create, BASE_parent=BASE_parent
cosmos_dialogue_finish
cosmos_ev_filldown
cosmos_ev_opencalcwindow, BASE_parent=BASE_parent
cosmos_ev_opencolumnwindow
cosmos_ev_opendetectwindow, BASE_parent=BASE_parent
cosmos_ev_openmachwindow, BASE_parent=BASE_parent
cosmos_ev_plotevent
cosmos_ev_save
cosmos_ev_updatecolumns
cosmos_file_write, outfile, result, direct1, direct2, direct3, reflect1, reflect2, reflect3, instr1, instr2, instr3, theta1, theta2, theta3, water_file, aft=aft, dat=dat, out=out, raw=raw
result = cosmos_load_vars()
cosmos_plot_create
cosmos_raw_read, files, monitors, counts, params
result = cosmos_str_theta(string)
cosmos_grav, theta0, lambda, newtheta, delta, dz, poffoff, openofflam, xchopper, xslits3, xslits2, refdown
cosmos_direct_read, newfiles, mondir, cntdir, pardir, runno
cosmos_anal_run, result, groupedresult, direct, reflect, instr, theta, runno
cosmos_anal_run_nodirect, result, groupedresult, reflect, instr, theta, runno
cosmos_anal_run_monitor, result, groupedresult, direct, reflect, instr, theta, runno
cosmos_ev_load
cosmos_ev_background
cosmos_ev_go
cosmos_ev_poll, event
cosmos_bi_spreadsheet, flag, value

cosmos, compile=compile
fcosmos

Routine details

top cosmos_init_vars

cosmos_init_vars

top cosmos_init_detector

cosmos_init_detector

top cosmos_anal_append

result = cosmos_anal_append(array1, array2)

Parameters

array1
array2

top cosmos_anal_log

result = cosmos_anal_log(array)

Parameters

array

top cosmos_anal_backgroundaverage

cosmos_anal_backgroundaverage, arr, err, mask

Parameters

arr
err
mask

top cosmos_anal_peaksearchbasic

result = cosmos_anal_peaksearchbasic(array)

Parameters

array

top cosmos_anal_peaksearchrefined

result = cosmos_anal_peaksearchrefined(array, search, foregd)

Parameters

array
search
foregd

top cosmos_anal_peaksearchpro

cosmos_anal_peaksearchpro, cnt, xrange, usefulx, maximum, peakrange

Parameters

cnt
xrange
usefulx
maximum
peakrange

top cosmos_anal_sort

result = cosmos_anal_sort(dataset)

Parameters

dataset

top cosmos_array_norm

result = cosmos_array_norm(array)

Parameters

array

top cosmos_str_make

result = cosmos_str_make(value)

Parameters

value

top cosmos_str_split

result = cosmos_str_split(original)

Parameters

original

top cosmos_str_value

cosmos_str_value, original, remainder, value, floating=floating, integer=integer

Parameters

original
remainder
value

Keywords

floating
integer

top cosmos_anal_calcangleoffset

result = cosmos_anal_calcangleoffset(peakpos, xoff, density, distance)

Parameters

peakpos
xoff
density
distance

top cosmos_close_subwins

cosmos_close_subwins

top cosmos_dialogue_add

cosmos_dialogue_add, txt

Parameters

txt

top cosmos_dialogue_warn

cosmos_dialogue_warn, txt

Parameters

txt

top cosmos_anal_mean

result = cosmos_anal_mean(array, weightoption)

Parameters

array
weightoption

top cosmos_anal_factor

result = cosmos_anal_factor(array_a, array_b)

Parameters

array_a
array_b

top cosmos_anal_factor_old

result = cosmos_anal_factor_old(array_a, array_b)

Parameters

array_a
array_b

top cosmos_anal_peaksearchpro_newer

cosmos_anal_peaksearchpro_newer, cnt, xrange, usefulx, maximum, peakrange

Parameters

cnt
xrange
usefulx
maximum
peakrange

top cosmos_ev_clear

cosmos_ev_clear

top cosmos_ev_insertrow

cosmos_ev_insertrow

top cosmos_ev_quit

cosmos_ev_quit

top cosmos_ev_updatecalc

cosmos_ev_updatecalc

top cosmos_ev_updatedetect

cosmos_ev_updatedetect

top cosmos_ev_updatemach

cosmos_ev_updatemach

top cosmos_ev_winclose

cosmos_ev_winclose, window_id

Parameters

window_id

top cosmos_lamp_write

cosmos_lamp_write, workspace, array, workspacetitle

Parameters

workspace
array
workspacetitle

top cosmos_main_getvars

cosmos_main_getvars

top cosmos_plot_add

result = cosmos_plot_add(array, plottitle)

Parameters

array
plottitle

top cosmos_plot_finish

cosmos_plot_finish

top cosmos_save_vars

cosmos_save_vars

top cosmos_str_formtheta

result = cosmos_str_formtheta(angle)

Parameters

angle

top cosmos_getnumors

result = cosmos_getnumors(intlist)

Parameters

intlist

top cosmos_str_parse

result = cosmos_str_parse(original, float=float, integer=integer, flt_range=flt_range, int_range=int_range, string_set=string_set)

Parameters

original

Keywords

float
integer
flt_range
int_range
string_set

top cosmos_table_labelupdate

cosmos_table_labelupdate

top cosmos_anal_ranges

cosmos_anal_ranges

top cosmos_anal_backgroundfit

cosmos_anal_backgroundfit, arr, err, mask, str

Parameters

arr
err
mask
str

top cosmos_anal_group

result = cosmos_anal_group(result, groupnum)

Parameters

result
groupnum

top cosmos_anal_discard

cosmos_anal_discard, result

Parameters

result

top cosmos_anal_bundle

cosmos_anal_bundle, result, maxres

Parameters

result
maxres

top cosmos_anal_bundle_old

cosmos_anal_bundle_old, result, resf

Parameters

result
resf

top cosmos_anal_correctangle

result = cosmos_anal_correctangle(angle, dirpeakpos, refpeakpos, dirxoff, refxoff, density, dirdist, refdist)

Parameters

angle
dirpeakpos
refpeakpos
dirxoff
refxoff
density
dirdist
refdist

top cosmos_anal_correctdistance

result = cosmos_anal_correctdistance(peakpos, xoff, density, distance)

Parameters

peakpos
xoff
density
distance

top cosmos_dialogue_create

cosmos_dialogue_create, BASE_parent=BASE_parent

Keywords

BASE_parent

top cosmos_dialogue_finish

cosmos_dialogue_finish

top cosmos_ev_filldown

cosmos_ev_filldown

top cosmos_ev_opencalcwindow

cosmos_ev_opencalcwindow, BASE_parent=BASE_parent

Keywords

BASE_parent

top cosmos_ev_opencolumnwindow

cosmos_ev_opencolumnwindow

top cosmos_ev_opendetectwindow

cosmos_ev_opendetectwindow, BASE_parent=BASE_parent

Keywords

BASE_parent

top cosmos_ev_openmachwindow

cosmos_ev_openmachwindow, BASE_parent=BASE_parent

Keywords

BASE_parent

top cosmos_ev_plotevent

cosmos_ev_plotevent

top cosmos_ev_save

cosmos_ev_save

top cosmos_ev_updatecolumns

cosmos_ev_updatecolumns

top cosmos_file_write

cosmos_file_write, outfile, result, direct1, direct2, direct3, reflect1, reflect2, reflect3, instr1, instr2, instr3, theta1, theta2, theta3, water_file, aft=aft, dat=dat, out=out, raw=raw

Parameters

outfile
result
direct1
direct2
direct3
reflect1
reflect2
reflect3
instr1
instr2
instr3
theta1
theta2
theta3
water_file

Keywords

aft
dat
out
raw

top cosmos_load_vars

result = cosmos_load_vars()

top cosmos_plot_create

cosmos_plot_create

top cosmos_raw_read

cosmos_raw_read, files, monitors, counts, params

Parameters

files
monitors
counts
params

top cosmos_str_theta

result = cosmos_str_theta(string)

Parameters

string

top cosmos_grav

cosmos_grav, theta0, lambda, newtheta, delta, dz, poffoff, openofflam, xchopper, xslits3, xslits2, refdown

Parameters

theta0
lambda
newtheta
delta
dz
poffoff
openofflam
xchopper
xslits3
xslits2
refdown

top cosmos_direct_read

cosmos_direct_read, newfiles, mondir, cntdir, pardir, runno

Parameters

newfiles
mondir
cntdir
pardir
runno

top cosmos_anal_run

cosmos_anal_run, result, groupedresult, direct, reflect, instr, theta, runno

Parameters

result
groupedresult
direct
reflect
instr
theta
runno

top cosmos_anal_run_nodirect

cosmos_anal_run_nodirect, result, groupedresult, reflect, instr, theta, runno

Parameters

result
groupedresult
reflect
instr
theta
runno

top cosmos_anal_run_monitor

cosmos_anal_run_monitor, result, groupedresult, direct, reflect, instr, theta, runno

Parameters

result
groupedresult
direct
reflect
instr
theta
runno

top cosmos_ev_load

cosmos_ev_load

top cosmos_ev_background

cosmos_ev_background

top cosmos_ev_go

cosmos_ev_go

top cosmos_ev_poll

cosmos_ev_poll, event

Parameters

event

top cosmos_bi_spreadsheet

cosmos_bi_spreadsheet, flag, value

** ********************* ** ** Set/Get value using Cosmos table OR Cosmos_sheet table

Parameters

flag
value

top cosmos

cosmos, compile=compile

Keywords

compile

top fcosmos

fcosmos

File attributes

Modification date: Tue Oct 1 14:42:05 2013
Lines: 5,644