- Timestamp:
- Oct 31, 2017 1:09:55 PM (5 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_HDF5_Read.ipf
r1063 r1072 468 468 String fname 469 469 470 Print "reading atten transmission" 470 471 String path = "entry:instrument:attenuator:attenuator_transmission" 471 472 return(V_getRealValueFromHDF5(fname,path)) -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_HDF5_Write.ipf
r1063 r1072 1164 1164 //// number of attenuators actually dropped in 1165 1165 //// an integer value 1166 //Function V_writeAtten_num_dropped(fname,val)1167 //String fname1168 //Variable val1169 //1170 // //String path = "entry:instrument:attenuator:thickness"1171 //1172 //Make/O/I/N=1 wTmpWrite1173 // //Make/O/R/N=1 wTmpWrite1174 //String groupName = "/entry/instrument/attenuator"1175 //String varName = "num_atten_dropped"1176 //wTmpWrite[0] = val1177 // 1178 //variable err1179 //err = V_WriteWaveToHDF(fname, groupName, varName, wTmpWrite)1180 //if(err)1181 //Print "HDF write err = ",err1182 //endif1183 //// now be sure to kill the data folder to force a re-read of the data next time this file is read in1184 // //err = V_KillNamedDataFolder(fname)1185 // //if(err)1186 // //Print "DataFolder kill err = ",err1187 // //endif1188 //return(err)1189 //end1166 Function V_writeAtten_num_dropped(fname,val) 1167 String fname 1168 Variable val 1169 1170 // String path = "entry:instrument:attenuator:thickness" 1171 1172 Make/O/I/N=1 wTmpWrite 1173 // Make/O/R/N=1 wTmpWrite 1174 String groupName = "/entry/instrument/attenuator" 1175 String varName = "num_atten_dropped" 1176 wTmpWrite[0] = val 1177 1178 variable err 1179 err = V_WriteWaveToHDF(fname, groupName, varName, wTmpWrite) 1180 if(err) 1181 Print "HDF write err = ",err 1182 endif 1183 // now be sure to kill the data folder to force a re-read of the data next time this file is read in 1184 // err = V_KillNamedDataFolder(fname) 1185 // if(err) 1186 // Print "DataFolder kill err = ",err 1187 // endif 1188 return(err) 1189 end 1190 1190 1191 1191 // thickness of the attenuator (PMMA) - units?? -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Instrument_Resolution.ipf
r1064 r1072 391 391 392 392 393 394 395 396 ////////Transmission397 //******************398 //lookup tables for attenuator transmissions399 //400 //401 // new calibration done June 2007, John Barker402 //403 Proc MakeNG3AttenTable()404 405 NewDataFolder/O root:myGlobals:Attenuators406 //do explicitly to avoid data folder problems, redundant, but it must work without fail407 Variable num=10 //10 needed for tables after June 2007408 409 Make/O/N=(num) root:myGlobals:Attenuators:ng3att0410 Make/O/N=(num) root:myGlobals:Attenuators:ng3att1411 Make/O/N=(num) root:myGlobals:Attenuators:ng3att2412 Make/O/N=(num) root:myGlobals:Attenuators:ng3att3413 Make/O/N=(num) root:myGlobals:Attenuators:ng3att4414 Make/O/N=(num) root:myGlobals:Attenuators:ng3att5415 Make/O/N=(num) root:myGlobals:Attenuators:ng3att6416 Make/O/N=(num) root:myGlobals:Attenuators:ng3att7417 Make/O/N=(num) root:myGlobals:Attenuators:ng3att8418 Make/O/N=(num) root:myGlobals:Attenuators:ng3att9419 Make/O/N=(num) root:myGlobals:Attenuators:ng3att10420 421 // and a wave for the errors at each attenuation factor422 Make/O/N=(num) root:myGlobals:Attenuators:ng3att0_err423 Make/O/N=(num) root:myGlobals:Attenuators:ng3att1_err424 Make/O/N=(num) root:myGlobals:Attenuators:ng3att2_err425 Make/O/N=(num) root:myGlobals:Attenuators:ng3att3_err426 Make/O/N=(num) root:myGlobals:Attenuators:ng3att4_err427 Make/O/N=(num) root:myGlobals:Attenuators:ng3att5_err428 Make/O/N=(num) root:myGlobals:Attenuators:ng3att6_err429 Make/O/N=(num) root:myGlobals:Attenuators:ng3att7_err430 Make/O/N=(num) root:myGlobals:Attenuators:ng3att8_err431 Make/O/N=(num) root:myGlobals:Attenuators:ng3att9_err432 Make/O/N=(num) root:myGlobals:Attenuators:ng3att10_err433 434 435 //each wave has 10 elements, the transmission of att# at the wavelengths436 //lambda = 4,5,6,7,8,10,12,14,17,20 (4 A and 20 A are extrapolated values)437 Make/O/N=(num) root:myGlobals:Attenuators:ng3lambda={4,5,6,7,8,10,12,14,17,20}438 439 // new calibration done June 2007, John Barker440 root:myGlobals:Attenuators:ng3att0 = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }441 root:myGlobals:Attenuators:ng3att1 = {0.444784,0.419,0.3935,0.3682,0.3492,0.3132,0.2936,0.2767,0.2477,0.22404}442 root:myGlobals:Attenuators:ng3att2 = {0.207506,0.1848,0.1629,0.1447,0.1292,0.1056,0.09263,0.08171,0.06656,0.0546552}443 root:myGlobals:Attenuators:ng3att3 = {0.092412,0.07746,0.06422,0.05379,0.04512,0.03321,0.02707,0.02237,0.01643,0.0121969}444 root:myGlobals:Attenuators:ng3att4 = {0.0417722,0.03302,0.02567,0.02036,0.01604,0.01067,0.00812,0.006316,0.00419,0.00282411}445 root:myGlobals:Attenuators:ng3att5 = {0.0187129,0.01397,0.01017,0.007591,0.005668,0.003377,0.002423,0.001771,0.001064,0.000651257}446 root:myGlobals:Attenuators:ng3att6 = {0.00851048,0.005984,0.004104,0.002888,0.002029,0.001098,0.0007419,0.0005141,0.000272833,0.000150624}447 root:myGlobals:Attenuators:ng3att7 = {0.00170757,0.001084,0.0006469,0.0004142,0.0002607,0.0001201,7.664e-05,4.06624e-05,1.77379e-05,7.30624e-06}448 root:myGlobals:Attenuators:ng3att8 = {0.000320057,0.0001918,0.0001025,6.085e-05,3.681e-05,1.835e-05,6.74002e-06,3.25288e-06,1.15321e-06,3.98173e-07}449 root:myGlobals:Attenuators:ng3att9 = {6.27682e-05,3.69e-05,1.908e-05,1.196e-05,8.738e-06,6.996e-06,6.2901e-07,2.60221e-07,7.49748e-08,2.08029e-08}450 root:myGlobals:Attenuators:ng3att10 = {1.40323e-05,8.51e-06,5.161e-06,4.4e-06,4.273e-06,1.88799e-07,5.87021e-08,2.08169e-08,4.8744e-09,1.08687e-09}451 452 // percent errors as measured, May 2007 values453 // zero error for zero attenuators, appropriate average values put in for unknown values454 root:myGlobals:Attenuators:ng3att0_err = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }455 root:myGlobals:Attenuators:ng3att1_err = {0.15,0.142,0.154,0.183,0.221,0.328,0.136,0.13,0.163,0.15}456 root:myGlobals:Attenuators:ng3att2_err = {0.25,0.257,0.285,0.223,0.271,0.405,0.212,0.223,0.227,0.25}457 root:myGlobals:Attenuators:ng3att3_err = {0.3,0.295,0.329,0.263,0.323,0.495,0.307,0.28,0.277,0.3}458 root:myGlobals:Attenuators:ng3att4_err = {0.35,0.331,0.374,0.303,0.379,0.598,0.367,0.322,0.33,0.35}459 root:myGlobals:Attenuators:ng3att5_err = {0.4,0.365,0.418,0.355,0.454,0.745,0.411,0.367,0.485,0.4}460 root:myGlobals:Attenuators:ng3att6_err = {0.45,0.406,0.473,0.385,0.498,0.838,0.454,0.49,0.5,0.5}461 root:myGlobals:Attenuators:ng3att7_err = {0.6,0.554,0.692,0.425,0.562,0.991,0.715,0.8,0.8,0.8}462 root:myGlobals:Attenuators:ng3att8_err = {0.7,0.705,0.927,0.503,0.691,1.27,1,1,1,1}463 root:myGlobals:Attenuators:ng3att9_err = {1,0.862,1.172,0.799,1.104,1.891,1.5,1.5,1.5,1.5}464 root:myGlobals:Attenuators:ng3att10_err = {1.5,1.054,1.435,1.354,1.742,2,2,2,2,2}465 466 467 End468 469 470 471 472 473 //returns the transmission of the attenuator (at NG3) given the attenuator number474 //which must be an integer(to select the wave) and given the wavelength.475 //the wavelength may be any value between 4 and 20 (A), and is interpolated476 //between calibrated wavelengths for a given attenuator477 //478 // Mar 2010 - abs() added to attStr to account for ICE reporting -0.0001 as an attenuator position, which truncates to "-0"479 Function LookupAttenNG3(lambda,attenNo,atten_err)480 Variable lambda, attenNo, &atten_err481 482 Variable trans483 String attStr="root:myGlobals:Attenuators:ng3att"+num2str(trunc(abs(attenNo)))484 String attErrWStr="root:myGlobals:Attenuators:ng3att"+num2str(trunc(abs(attenNo)))+"_err"485 String lamStr = "root:myGlobals:Attenuators:ng3lambda"486 487 if(attenNo == 0)488 return (1) //no attenuation, return trans == 1489 endif490 491 if( (lambda < 4) || (lambda > 20 ) )492 Abort "Wavelength out of calibration range (4,20). You must manually enter the absolute parameters"493 Endif494 495 if(!(WaveExists($attStr)) || !(WaveExists($lamStr)) || !(WaveExists($attErrWStr)))496 Execute "MakeNG3AttenTable()"497 Endif498 //just in case creating the tables fails....499 if(!(WaveExists($attStr)) || !(WaveExists($lamStr)) )500 Abort "Attenuator lookup waves could not be found. You must manually enter the absolute parameters"501 Endif502 503 //lookup the value by interpolating the wavelength504 //the attenuator must always be an integer505 Wave att = $attStr506 Wave attErrW = $attErrWStr507 Wave lam = $lamstr508 trans = interp(lambda,lam,att)509 atten_err = interp(lambda,lam,attErrW)510 511 // the error in the tables is % error. return the standard deviation instead512 atten_err = trans*atten_err/100513 514 // Print "trans = ",trans515 // Print "trans err = ",atten_err516 517 return trans518 End519 520 521 522 523 // a utility function so that I can get the values from the command line524 // since the atten_err is PBR525 //526 Function PrintAttenuation(instr,lam,attenNo)527 String instr528 Variable lam,attenNo529 530 Variable atten_err, attenFactor531 532 // 22 FEB 2013 - not sure what changed with the writeout of ICE data files... but ....533 // to account for ICE occasionally writing out "3" as 2.9998, make sure I can construct534 // a single digit -> string "3" to identify the proper wave in the lookup table535 536 attenNo = round(attenNo)537 538 strswitch(instr)539 case "CGB":540 case "NG3":541 attenFactor = LookupAttenNG3(lam,attenNo,atten_err)542 break543 default:544 //return error?545 DoAlert 0, "No matching instrument -- PrintAttenuation"546 attenFactor=1547 endswitch548 549 Print "atten, err = ", attenFactor, atten_err550 551 return(0)552 End553 554 555 //556 //returns the proper attenuation factor based on the instrument (NG3, NG5, or NG7)557 //NG5 values are taken from the NG7 tables (there is very little difference in the558 //values, and NG5 attenuators have not been calibrated (as of 8/01)559 //560 // filestr is passed from TextRead[3] = the default directory561 // lam is passed from RealsRead[26]562 // AttenNo is passed from ReaslRead[3]563 //564 // Attenuation factor as defined here is <= 1565 //566 // HFIR can pass ("",1,attenuationFactor) and have this function simply567 // spit back the attenuationFactor (that was read into rw[3])568 //569 // called by Correct.ipf, ProtocolAsPanel.ipf, Transmission.ipf570 //571 //572 // as of March 2011, returns the error (one standard deviation) in the attenuation factor as the last parameter, by reference573 Function AttenuationFactor(fileStr,lam,attenNo,atten_err)574 String fileStr575 Variable lam,attenNo, &atten_err576 577 Variable attenFactor=1,loc578 String instr=fileStr[1,3] //filestr is "[NGnSANSn] " or "[NGnSANSnn]" (11 characters total)579 580 581 // 22 FEB 2013 - not sure what changed with the writeout of ICE data files... but ....582 // to account for ICE occasionally writing out "3" as 2.9998, make sure I can construct583 // a single digit -> string "3" to identify the proper wave in the lookup table584 585 attenNo = round(attenNo)586 587 588 strswitch(instr)589 case "CGB":590 case "NG3":591 attenFactor = LookupAttenNG3(lam,attenNo,atten_err)592 break593 default:594 //return error?595 DoAlert 0, "No matching instrument -- PrintAttenuation"596 attenFactor=1597 endswitch598 // print "instr, lambda, attenNo,attenFactor = ",instr,lam,attenNo,attenFactor599 return(attenFactor)600 End601 602 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Protocol_Reduction.ipf
r1071 r1072 2572 2572 2573 2573 //get the necessary variables for the calculation of kappa 2574 Variable countTime,monCnt,sdd,pixel 2574 Variable countTime,monCnt,sdd,pixel_x,pixel_y 2575 2575 String detStr,junkStr,errStr 2576 2576 … … 2693 2693 monCnt = V_getBeamMonNormData("RAW") 2694 2694 2695 pixel = V_getDet_x_pixel_size("RAW",detPanel_toSum) 2696 pixel /= 10 //convert mm to cm, since sdd in cm 2695 pixel_x = V_getDet_x_pixel_size("RAW",detPanel_toSum) 2696 pixel_x /= 10 //convert mm to cm, since sdd in cm 2697 pixel_y = V_getDet_y_pixel_size("RAW",detPanel_toSum) 2698 pixel_y /= 10 //convert mm to cm, since sdd in cm 2697 2699 sdd = V_getDet_ActualDistance("RAW",detPanel_toSum) 2698 2700 2699 // kappa = emptyCts/countTime/empAttenFactor*1.0e8/(monCnt/countTime)*(pixel /sdd)^22701 // kappa = emptyCts/countTime/empAttenFactor*1.0e8/(monCnt/countTime)*(pixel_x*pixel_y/sdd^2) 2700 2702 kappa = emptyCts/countTime/empAttenFactor*1.0e8/(monCnt/countTime) 2701 2703 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Transmission.ipf
r1064 r1072 87 87 WAVE groupIDW = root:Packages:NIST:VSANS:CatVSHeaderInfo:Group_ID 88 88 WAVE transmW = root:Packages:NIST:VSANS:CatVSHeaderInfo:Transmission 89 WAVE/T intentW = root:Packages:NIST:VSANS:CatVSHeaderInfo:Intent 89 90 90 91 // TODO … … 105 106 // TODO x- set the popup string to the matching name on exit 106 107 Variable targetID = groupIDW[ii] 107 String list = V_getFilePurposeList("TRANSMISSION",0) 108 // String list = V_getFilePurposeList("TRANSMISSION",0) 109 String list = V_getFileIntentPurposeList("SAMPLE","TRANSMISSION",0) 110 108 111 WAVE/T purposeW = root:Packages:NIST:VSANS:CatVSHeaderInfo:Purpose 109 112 for(ii=0;ii<np;ii+=1) 110 if(cmpstr(purposeW[ii],"TRANSMISSION")==0 && groupIDW[ii] == targetID)113 if(cmpstr(purposeW[ii],"TRANSMISSION")==0 && cmpstr(intentW[ii],"SAMPLE")==0 && groupIDW[ii] == targetID) 111 114 Print "transmission file match at ",filenameW[ii] 112 115 SetVariable setvar_2,value=labelW[ii] 113 116 SetVariable setvar_3,value=groupIDW[ii] 114 PopupMenu popup_1,mode=WhichListItem(fileNameW[ii], list )+1 117 PopupMenu popup_1,mode=WhichListItem(fileNameW[ii], list )+1,popValue=fileNameW[ii] 115 118 break 116 119 endif … … 122 125 // x- Detector Panel field is hard-wired for "B" 123 126 // 124 WAVE/T intentW = root:Packages:NIST:VSANS:CatVSHeaderInfo:Intent125 127 list = V_getFileIntentList("EMPTY BEAM",0) 126 128 … … 129 131 Print "empty beam match at ",filenameW[ii] 130 132 SetVariable setvar_4,value=labelW[ii] 131 PopupMenu popup_2,mode=WhichListItem(fileNameW[ii], list )+1 133 PopupMenu popup_2,mode=WhichListItem(fileNameW[ii], list )+1,popValue=fileNameW[ii] 132 134 133 135 // SetVariable setvar_6,value =_STR:"ML"
Note: See TracChangeset
for help on using the changeset viewer.