- Timestamp:
- Oct 13, 2017 3:16:27 PM (5 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/VSANS_Includes.ipf
r1064 r1071 104 104 #include "V_Write_VSANS_QIS" 105 105 106 // 107 #include "V_Attenuation" 106 108 107 109 108 110 111 112 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_DIVUtils.ipf
r1061 r1071 207 207 NewDataFolder/O/S root:VSANS_DIV_file:entry 208 208 Make/O/T/N=1 title = "This is a DIV file for VSANS: VSANS_DIV" 209 Make/O/T/N=1 start_date = "201 5-02-28T08:15:30-5:00"209 Make/O/T/N=1 start_date = "2017-02-28T08:15:30-5:00" 210 210 NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument 211 211 Make/O/T/N=1 name = "NG3_VSANS" 212 212 NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_B 213 Make/O/D/N=(150,150) data = 1 + (enoise(0.1))213 Make/O/D/N=(150,150) data = 1 //+ (enoise(0.1)) 214 214 Make/O/D/N=(150,150) linear_data_error = 0.01*abs(gnoise(1)) 215 215 NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_MR 216 Make/O/D/N=(48,128) data 217 data[][0] = 1+enoise(0.1)218 data[][] = data[p][0]216 Make/O/D/N=(48,128) data = 1 217 // data[][0] = 1+enoise(0.1) 218 // data[][] = data[p][0] 219 219 Make/O/D/N=(48,128) linear_data_error = 0.01*abs(gnoise(1)) 220 220 NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_ML 221 Make/O/D/N=(48,128) data 222 data[][0] = 1+enoise(0.1)223 data[][] = data[p][0]221 Make/O/D/N=(48,128) data = 1 222 // data[][0] = 1+enoise(0.1) 223 // data[][] = data[p][0] 224 224 Make/O/D/N=(48,128) linear_data_error = 0.01*abs(gnoise(1)) 225 225 NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_MT 226 Make/O/D/N=(128,48) data = 1 + (enoise(0.1))226 Make/O/D/N=(128,48) data = 1// + (enoise(0.1)) 227 227 Make/O/D/N=(128,48) linear_data_error = 0.01*abs(gnoise(1)) 228 228 NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_MB 229 Make/O/D/N=(128,48) data = 1 + (enoise(0.1))229 Make/O/D/N=(128,48) data = 1 //+ (enoise(0.1)) 230 230 Make/O/D/N=(128,48) linear_data_error = 0.01*abs(gnoise(1)) 231 231 NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_FR 232 Make/O/D/N=(48,128) data 233 data[][0] = 1+enoise(0.1)234 data[][] = data[p][0]232 Make/O/D/N=(48,128) data = 1 233 // data[][0] = 1+enoise(0.1) 234 // data[][] = data[p][0] 235 235 Make/O/D/N=(48,128) linear_data_error = 0.01*abs(gnoise(1)) 236 236 NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_FL 237 Make/O/D/N=(48,128) data 238 data[][0] = 1+enoise(0.1)239 data[][] = data[p][0]237 Make/O/D/N=(48,128) data = 1 238 // data[][0] = 1+enoise(0.1) 239 // data[][] = data[p][0] 240 240 Make/O/D/N=(48,128) linear_data_error = 0.01*abs(gnoise(1)) 241 241 NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_FT 242 Make/O/D/N=(128,48) data = 1 + (enoise(0.1))242 Make/O/D/N=(128,48) data = 1 //+ (enoise(0.1)) 243 243 Make/O/D/N=(128,48) linear_data_error = 0.01*abs(gnoise(1)) 244 244 NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_FB 245 Make/O/D/N=(128,48) data = 1 + (enoise(0.1))245 Make/O/D/N=(128,48) data = 1 //+ (enoise(0.1)) 246 246 Make/O/D/N=(128,48) linear_data_error = 0.01*abs(gnoise(1)) 247 248 // 249 // version that is NOT perfect, LR detectors are "striped" 250 // 251 // NewDataFolder/O/S root:VSANS_DIV_file:entry 252 // Make/O/T/N=1 title = "This is a DIV file for VSANS: VSANS_DIV" 253 // Make/O/T/N=1 start_date = "2017-02-28T08:15:30-5:00" 254 // NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument 255 // Make/O/T/N=1 name = "NG3_VSANS" 256 // NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_B 257 // Make/O/D/N=(150,150) data = 1 + (enoise(0.1)) 258 // Make/O/D/N=(150,150) linear_data_error = 0.01*abs(gnoise(1)) 259 // NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_MR 260 // Make/O/D/N=(48,128) data 261 // data[][0] = 1+enoise(0.1) 262 // data[][] = data[p][0] 263 // Make/O/D/N=(48,128) linear_data_error = 0.01*abs(gnoise(1)) 264 // NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_ML 265 // Make/O/D/N=(48,128) data 266 // data[][0] = 1+enoise(0.1) 267 // data[][] = data[p][0] 268 // Make/O/D/N=(48,128) linear_data_error = 0.01*abs(gnoise(1)) 269 // NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_MT 270 // Make/O/D/N=(128,48) data = 1 + (enoise(0.1)) 271 // Make/O/D/N=(128,48) linear_data_error = 0.01*abs(gnoise(1)) 272 // NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_MB 273 // Make/O/D/N=(128,48) data = 1 + (enoise(0.1)) 274 // Make/O/D/N=(128,48) linear_data_error = 0.01*abs(gnoise(1)) 275 // NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_FR 276 // Make/O/D/N=(48,128) data 277 // data[][0] = 1+enoise(0.1) 278 // data[][] = data[p][0] 279 // Make/O/D/N=(48,128) linear_data_error = 0.01*abs(gnoise(1)) 280 // NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_FL 281 // Make/O/D/N=(48,128) data 282 // data[][0] = 1+enoise(0.1) 283 // data[][] = data[p][0] 284 // Make/O/D/N=(48,128) linear_data_error = 0.01*abs(gnoise(1)) 285 // NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_FT 286 // Make/O/D/N=(128,48) data = 1 + (enoise(0.1)) 287 // Make/O/D/N=(128,48) linear_data_error = 0.01*abs(gnoise(1)) 288 // NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_FB 289 // Make/O/D/N=(128,48) data = 1 + (enoise(0.1)) 290 // Make/O/D/N=(128,48) linear_data_error = 0.01*abs(gnoise(1)) 291 247 292 248 293 // fake, empty folders so that the generic loaders can be used -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_DetectorCorrections.ipf
r1063 r1071 1154 1154 V_CopyHDFToWorkFolder(type,"ABS") 1155 1155 1156 1157 w_moncount = V_getMonitorCount(type) //monitor count in "type" 1156 // TODO: -- which monitor to use? Here, I think it should already be normalized to 10^8 1157 // 1158 // w_moncount = V_getMonitorCount(type) //monitor count in "type" 1159 1160 w_moncount = V_getBeamMonNormData(type) 1161 1162 1158 1163 if(w_moncount == 0) 1159 1164 //zero monitor counts will give divide by zero --- -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Protocol_Reduction.ipf
r1064 r1071 2565 2565 2566 2566 Variable err,loc,refnum 2567 2568 Variable ii 2569 2570 Variable kappa=1 2571 Variable kappa_err 2572 2573 //get the necessary variables for the calculation of kappa 2574 Variable countTime,monCnt,sdd,pixel 2575 String detStr,junkStr,errStr 2576 2577 Variable empAttenFactor, emp_atten_err 2578 2579 //get the XY box and files 2580 Variable x1,x2,y1,y2,emptyCts,empty_ct_err 2581 String emptyFileName,tempStr,divFileName,detPanel_toSum 2582 2567 2583 //ask user if he wants to use a transmision file for absolute scaling 2568 2584 //or if he wants to enter his own information … … 2574 2590 else 2575 2591 //empty beam flux file selected, prompt for file, and use this to calculate KAPPA 2576 Variable kappa=1 2577 Variable kappa_err 2578 2579 //get the necessary variables for the calculation of kappa 2580 Variable countTime,monCnt,sdd,pixel 2581 String detStr,junkStr,errStr 2582 2583 Variable empAttenFactor, emp_atten_err 2584 2585 //get the XY box and files 2586 Variable x1,x2,y1,y2,emptyCts,empty_ct_err 2587 String emptyFileName,tempStr,divFileName 2588 2592 2589 2593 // TODO 2590 2594 // x- need an empty beam file name … … 2596 2600 endif 2597 2601 2602 // TODO 2603 // x- need panel 2604 // 2605 Prompt detPanel_toSum,"Panel with Direct Beam",popup,ksDetectorListAll 2606 DoPrompt "Select Panel",detPanel_toSum 2607 if (V_Flag) 2608 return 0 // user canceled 2609 endif 2610 2598 2611 //need the detector sensitivity file - make a guess, allow to override 2599 2612 Prompt divFileName,"DIV File",popup,V_PickDIVButton("") … … 2606 2619 2607 2620 WAVE xyBoxW = V_getBoxCoordinates(emptyFileName) 2608 // TODO2609 // -- need to get the panel string for the sum.2610 // -- the detector string is currently hard-wired2611 detStr = "B"2612 2621 2613 2622 … … 2627 2636 V_LoadAndPlotRAW_wName(emptyFileName) 2628 2637 // convert raw->SAM 2629 V_Raw_to_work("SAM") 2630 V_UpdateDisplayInformation("SAM") 2638 // V_Raw_to_work("SAM") 2639 // V_UpdateDisplayInformation("SAM") 2640 V_UpdateDisplayInformation("RAW") 2641 2642 // do the DIV correction 2643 if (gDoDIVCor == 1) 2644 // need extra check here for file existence 2645 // if not in DIV folder, load. 2646 // if unable to load, skip correction and report error (Alert?) (Ask to Load?) 2647 Print "Doing DIV correction"// for "+ detStr 2648 for(ii=0;ii<ItemsInList(ksDetectorListAll);ii+=1) 2649 detStr = StringFromList(ii, ksDetectorListAll, ";") 2650 Wave w = V_getDetectorDataW("RAW",detStr) 2651 Wave w_err = V_getDetectorDataErrW("RAW",detStr) 2652 2653 V_DIVCorrection(w,w_err,detStr,"RAW") // do the correction in-place 2654 endfor 2655 else 2656 Print "DIV correction NOT DONE" // not an error since correction was unchecked 2657 endif 2631 2658 2632 2659 // and determine box sum and error 2633 2660 // store these locally 2634 emptyCts = V_SumCountsInBox(xyBoxW[0],xyBoxW[1],xyBoxW[2],xyBoxW[3],empty_ct_err,"SAM",detStr) 2661 2662 // TODO 2663 // x- need to get the panel string for the sum. 2664 // x- the detector string is currently hard-wired 2665 // detStr = "MR" 2666 2667 emptyCts = V_SumCountsInBox(xyBoxW[0],xyBoxW[1],xyBoxW[2],xyBoxW[3],empty_ct_err,"RAW",detPanel_toSum) 2635 2668 2636 2669 Print "empty counts = ",emptyCts … … 2639 2672 // TODO 2640 2673 // -- get all of the proper values for the calculation 2641 // - -currently the attenuation is incorrect2674 // -x currently the attenuation is incorrect 2642 2675 // such that kappa_err = 1*kappa 2643 // -- verify the calculation (no solid angle needed )2644 2645 DoAlert 0,"This calculation is not reliable - attenuation is not calibrated"2676 // -- verify the calculation (no solid angle needed??) 2677 2678 DoAlert 0,"This calculation is not reliable - something is wrong" 2646 2679 2647 2680 // get the attenuation factor for the empty beam 2648 empAttenFactor = V_getAttenuator_transmission(emptyFileName) 2649 emp_atten_err = V_getAttenuator_trans_err(emptyFileName) 2650 2681 // TODO -- the attenuation is not written by NICE to the file 2682 // so I need to calculate it myself from the tables 2683 // 2684 // empAttenFactor = V_getAttenuator_transmission(emptyFileName) 2685 // emp_atten_err = V_getAttenuator_trans_err(emptyFileName) 2686 empAttenFactor = V_CalculateAttenuationFactor(emptyFileName) 2687 emp_atten_err = V_CalculateAttenuationError(emptyFileName) 2688 2651 2689 countTime = V_getCount_time(emptyFileName) 2652 2690 2653 2691 // TODO 2654 // -- not sure if this is the correct monitor count to use, but I do know to use "SAM" 2655 // rather than the file. 2656 monCnt = V_getBeamMonNormData("SAM") 2657 2658 2659 2660 // kappa = detCnt/countTime/attenTrans*1.0e8/(monCnt/countTime)*(pixel/sdd)^2 2692 // -- not sure if this is the correct monitor count to use 2693 monCnt = V_getBeamMonNormData("RAW") 2694 2695 pixel = V_getDet_x_pixel_size("RAW",detPanel_toSum) 2696 pixel /= 10 //convert mm to cm, since sdd in cm 2697 sdd = V_getDet_ActualDistance("RAW",detPanel_toSum) 2698 2699 // kappa = emptyCts/countTime/empAttenFactor*1.0e8/(monCnt/countTime)*(pixel/sdd)^2 2661 2700 kappa = emptyCts/countTime/empAttenFactor*1.0e8/(monCnt/countTime) 2701 2662 2702 2663 2703 kappa_err = (empty_ct_err/emptyCts)^2 + (emp_atten_err/empAttenFactor)^2
Note: See TracChangeset
for help on using the changeset viewer.