- Timestamp:
- Mar 23, 2018 10:29:07 AM (5 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Analysis/Alpha/Tinker/FFT_Panel.ipf
r1000 r1092 1095 1095 else 1096 1096 list += num2str(V_max) + ";" 1097 MultiThread mz = mz[p][q] == V_max ? V_min : mz[p][q] // replace the max with min1097 MultiThread mz = mz[p][q][r] == V_max ? V_min : mz[p][q][r] // replace the max with min 1098 1098 endif 1099 1099 while(!done) 1100 1100 1101 1101 // Print "Found values in matrix = ",list 1102 KillWaves/Z mz1102 // KillWaves/Z mz 1103 1103 1104 1104 return(list) -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/VC_DetectorBinning_Utils.ipf
r1090 r1092 1418 1418 S1 = str2num(V_getSourceAp_size(folderStr)) 1419 1419 1420 // S2 = sample aperture diameter [ mm]1420 // S2 = sample aperture diameter [cm] 1421 1421 // as of 3/2018, the "internal" sample aperture is not in use, only the external 1422 S2 = V_getSampleAp2_size(folderStr)*10 // sample ap 1 or 2? 2 = the "external", but may not exist? 1422 // TODO : verify the units on the Ap2 (external) 1423 // sample aperture 1(internal) is set to report "12.7 mm" as a STRING 1424 // sample aperture 2(external) reports the number typed in... 1425 // 1426 // so I'm trusting [cm] is in the file 1427 S2 = V_getSampleAp2_size(folderStr)*10 // sample ap 1 or 2? 2 = the "external", convert to [cm] 1423 1428 1424 1429 // L1 = source to sample distance [m] -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/VC_VCALCPanel_MockUp.ipf
r1081 r1092 890 890 String/G gSourceShape = "circular;rectangular;converging pinholes;" 891 891 String/G gSourceDiam = "1.0 cm;2.0 cm;5.0 cm;" 892 String/G gSourceDiam_0g = "0.75 cm;1.5 cm;3.0 cm;" // values from John Mar 2018 892 893 String/G gDeltaLambda = "0.10;0.20;0.30;" 893 894 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_HDF5_Read.ipf
r1074 r1092 2616 2616 2617 2617 end 2618 2618 2619 // this is a NON NICE entered field 2620 // so if it's not there, it returns -999999 2621 // 2622 // this is a flag to mark the file as "flipped" so it prevents a 2nd flip 2623 // if the flip has been done, the field is written with a value of 1 (= true) 2624 // 2625 Function V_getLeftRightFlipDone(fname) 2626 String fname 2627 2628 String path = "entry:reduction:left_right_flip" 2629 return(V_getRealValueFromHDF5(fname,path)) 2630 end 2619 2631 2620 2632 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_HDF5_Write.ipf
r1083 r1092 6929 6929 end 6930 6930 6931 6932 // this is a NON NICE entered field 6933 // 6934 // this is a flag to mark the file as "flipped" so it prevents a 2nd flip 6935 // if the flip has been done, the field is written with a value of 1 (= true) 6936 // 6937 // to "un-mark" the file and allow the flip to be re-done, write -999999 6938 Function V_writeLeftRightFlipDone(fname,val) 6939 String fname 6940 Variable val 6941 6942 String path = "entry:reduction:left_right_flip" 6943 6944 Make/O/D/N=1 wTmpWrite 6945 // Make/O/R/N=1 wTmpWrite 6946 String groupName = "/entry/reduction" 6947 String varName = "left_right_flip" 6948 wTmpWrite[0] = val 6949 6950 variable err 6951 err = V_WriteWaveToHDF(fname, groupName, varName, wTmpWrite) 6952 if(err) 6953 Print "HDF write err = ",err 6954 endif 6955 // now be sure to kill the data folder to force a re-read of the data next time this file is read in 6956 // err = V_KillNamedDataFolder(fname) 6957 // if(err) 6958 // Print "DataFolder kill err = ",err 6959 // endif 6960 return(err) 6961 end 6931 6962 6932 6963 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Menu.ipf
r1083 r1092 49 49 "Copy_VCALC_to_VSANSFile",Copy_VCALC_to_VSANSFile() 50 50 "Flip Lateral Offset",V_PatchDet_Offset() 51 "Mark Lateral Flip Done",V_MarkLeftRightFlip_Done() 52 "Mark Lateral Flip NOT Done",V_MarkLeftRightFlip_Not_Done() 53 "-" 51 54 "Patch GroupID using CatTable",V_Patch_GroupID_catTable() 52 55 "Patch Purpose using CatTable",V_Patch_Purpose_catTable() -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_MultipleReduce.ipf
r1073 r1092 75 75 Button helpButton,pos={385,3},size={25,20},proc=V_ShowMRHelp,title="?" 76 76 Button helpButton,help={"Show the help file for reducing multiple files using the same protocol"} 77 PopupMenu MRFilesPopup,pos={3, 44},size={167,19},proc=V_MRedPopMenuProc,title="File(s) to Reduce"77 PopupMenu MRFilesPopup,pos={3,72},size={167,19},proc=V_MRedPopMenuProc,title="File(s) to Reduce" 78 78 PopupMenu MRFilesPopup,help={"The displayed file is the one that will be reduced. The entire list will be reduced if \"Reduce All..\" is selected. \r If no items, or the wrong items appear, click on the popup to refresh."} 79 79 PopupMenu MRFilesPopup,mode=1,popvalue="none",value= #"root:Packages:NIST:VSANS:Globals:MRED:gMRedList" 80 // SetVariable MRList,pos={3,72},size={350,13},proc=FileNumberListProc,title="File number list: "81 //SetVariable MRList,help={"Enter a comma delimited list of file numbers to reduce. Ranges can be entered using a dash."}82 //SetVariable MRList,limits={-Inf,Inf,1},value= root:Packages:NIST:VSANS:Globals:MRED:gFileNumList80 SetVariable MRList,pos={3,48},size={350,13},proc=V_FileNumberListProc,title="File number list: " 81 SetVariable MRList,help={"Enter a comma delimited list of file numbers to reduce. Ranges can be entered using a dash."} 82 SetVariable MRList,limits={-Inf,Inf,1},value= root:Packages:NIST:VSANS:Globals:MRED:gFileNumList 83 83 Button ReduceAllButton,pos={3,128},size={180,20},proc=V_ReduceAllPopupFiles,title="Reduce All Files in Popup" 84 84 Button ReduceAllButton,help={"This will reduce ALL of the files in the popup list, not just the top file."} 85 Button ReduceOneButton,pos={3,98},size={180,20},proc=V_ReduceTopPopupFile,title="Reduce Top File in Popup"86 Button ReduceOneButton,help={"This will reduce TOP files in the popup list, not all of the files."}85 // Button ReduceOneButton,pos={3,98},size={180,20},proc=V_ReduceTopPopupFile,title="Reduce Top File in Popup" 86 // Button ReduceOneButton,help={"This will reduce TOP files in the popup list, not all of the files."} 87 87 Button DoneButton,pos={290,128},size={110,20},proc=V_MRDoneButtonProc,title="Done Reducing" 88 88 Button DoneButton,help={"When done reducing files, this will close this control panel."} … … 95 95 // Button acceptList,pos={280,98},size={120,20},proc=AcceptMREDList,title="Accept List" 96 96 // Button acceptList,help={"Accept the list of files to reduce."} 97 PopupMenu MRProto_pop,pos={3, 72},size={119,19},proc=V_MRProtoPopMenuProc,title="Protocol "97 PopupMenu MRProto_pop,pos={3,98},size={119,19},proc=V_MRProtoPopMenuProc,title="Protocol " 98 98 PopupMenu MRProto_pop,help={"All of the data files in the popup will be reduced using this protocol"} 99 99 PopupMenu MRProto_pop,mode=1,popvalue="none",value= #"root:Packages:NIST:VSANS:Globals:MRED:gMRProtoList" … … 254 254 // get a list of all of the sample files, based on intent 255 255 // 256 //parses the file number list to get valid raw data filenames for reduction 257 // -if the numbers and full ranges can be translated to correspond to actual files 258 // on disk, the popup list is updated - otherwise the offending number is reported 259 // and the user must fix the problem before any reduction can be done 260 // 261 // V_ParseRunNumberList() does the work 262 // 263 // only accepts files in the list that are purpose=scattering 264 // 256 265 Function/S V_GetValidMRedPopupList() 257 266 258 String semiList = V_GetSAMList() 267 // String semiList = V_GetSAMList() 268 269 String commaList="",semiList="",fname="",purpose="" 270 SVAR numList=root:Packages:NIST:VSANS:Globals:MRED:gFileNumList 271 272 commaList = V_ParseRunNumberList(numList) 273 //convert commaList to a semicolon delimited list, checking that files are SCATTERING 274 Variable num=ItemsinList(commaList,","),ii 275 for(ii=0;ii<num;ii+=1) 276 fname = StringFromList(ii, commaList ,",") 277 purpose = V_getReduction_Purpose(fname) 278 if(cmpstr(purpose,"SCATTERING") == 0) 279 semiList += StringFromList(ii, commaList ,",") + ";" 280 endif 281 endfor 282 // print semiList 283 //sort the list 284 semiList = SortList(semiList,";",0) 285 return(semiList) 286 259 287 260 288 return(semiList) -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_PatchFiles.ipf
r1091 r1092 446 446 fname = S_path + fname 447 447 448 Variable nRows = 6448 Variable nRows = 9 449 449 Redimension/N=(nRows,3) ListWave 450 450 Redimension/N=(nRows,3) selWave … … 473 473 listWave[5][1] = "distance (source aperture) (cm)" 474 474 listWave[5][2] = num2str(V_getSourceAp_distance(fname)) 475 475 476 listWave[6][1] = "source aperture size (mm)" 477 listWave[6][2] = V_getSourceAp_size(fname) 478 479 listWave[7][1] = "sample aperture size (internal) (mm)" 480 listWave[7][2] = V_getSampleAp_size(fname) 481 482 listWave[8][1] = "sample aperture diam (external) (cm)" 483 listWave[8][2] = num2str(V_getSampleAp2_size(fname)) 484 476 485 return(0) 477 486 End … … 662 671 // (don't update the list - not until someone enters a search critera) -- Jul09 663 672 // 664 V_SetMatchStrProc("",0,"*","") //this is equivalent to finding everything, typical startup case 673 674 STRUCT WMSetVariableAction sva 675 sva.eventCode = 2 676 V_SetMatchStrProc(sva) //this is equivalent to finding everything, typical startup case 665 677 666 678 return(0) … … 845 857 End 846 858 859 847 860 //when text is entered in the match string, the popup list is refined to 848 861 //include only the selected files, useful for trimming a lengthy list, or selecting … … 850 863 //only one wildcard (*) is allowed 851 864 // 852 Function V_SetMatchStrProc(ctrlName,varNum,varStr,varName) : SetVariableControl 853 String ctrlName 854 Variable varNum 855 String varStr 856 String varName 857 858 //change the contents of gPatchList that is displayed 859 //based on selected Path, match str, and 860 //further trim list to include only RAW SANS files 861 //this will exclude version numbers, .AVE, .ABS files, etc. from the popup (which can't be patched) 862 863 String list = V_GetValidPatchPopupList() 864 865 String/G root:Packages:NIST:VSANS:Globals:Patch:gPatchList = list 866 ControlUpdate PatchPopup 867 PopupMenu PatchPopup,mode=1 868 869 if(strlen(list) > 0) 870 V_ShowHeaderButtonProc("SHButton") 871 endif 872 return(0) 873 End 874 865 //change the contents of gPatchList that is displayed 866 //based on selected Path, match str, and 867 //further trim list to include only RAW SANS files 868 //this will exclude version numbers, .AVE, .ABS files, etc. from the popup (which can't be patched) 869 Function V_SetMatchStrProc(sva) : SetVariableControl 870 STRUCT WMSetVariableAction &sva 871 872 switch( sva.eventCode ) 873 case 1: // mouse up 874 case 2: // Enter key 875 case 8: // edit end 876 Variable dval = sva.dval 877 String sval = sva.sval 878 879 String list = V_GetValidPatchPopupList() 880 881 String/G root:Packages:NIST:VSANS:Globals:Patch:gPatchList = list 882 ControlUpdate PatchPopup 883 PopupMenu PatchPopup,mode=1 884 885 if(strlen(list) > 0) 886 V_ShowHeaderButtonProc("SHButton") 887 endif 888 case 3: // Live update 889 890 break 891 case -1: // control being killed 892 break 893 endswitch 894 895 return 0 896 End 875 897 876 898 //displays the header of the selected file (top in the popup) when the button is clicked … … 1219 1241 err = V_writeSourceAp_distance(fname,val) 1220 1242 endif 1221 1222 1243 1244 if ((selWave[6][0] & 2^4) != 0) //"source aperture size (mm)" (a string with units) 1245 str = listWave[6][2] 1246 err = V_writeSourceAp_size(fname,str) 1247 endif 1248 1249 if ((selWave[7][0] & 2^4) != 0) //"sample aperture size (internal) (mm)" (a string with units) 1250 str = listWave[7][2] 1251 err = V_writeSampleAp_size(fname,str) 1252 endif 1253 1254 if ((selWave[8][0] & 2^4) != 0) //"sample aperture diam (external) (cm)" 1255 val = str2num(listWave[8][2]) 1256 err = V_writeSampleAp2_size(fname,val) 1257 endif 1258 1223 1259 return(0) 1224 1260 End … … 2346 2382 End 2347 2383 2348 // V_fReadDet_Offset(lo,hi) 2384 Proc V_MarkLeftRightFlip_Done(lo,hi) 2385 Variable lo,hi 2386 2387 V_fWriteFlipState(lo,hi,1) // value == 1 means flip done 2388 End 2389 2390 Proc V_MarkLeftRightFlip_Not_Done(lo,hi) 2391 Variable lo,hi 2392 2393 V_fWriteFlipState(lo,hi,-999999) // value == -999999 means flip not done 2394 End 2395 2349 2396 2350 2397 Proc V_Patch_GroupID_catTable() … … 2376 2423 V_fPatchDet_distance(lo,hi,dist_f,dist_m,dist_b) 2377 2424 End 2425 2426 2378 2427 // simple utility to patch the offset values in the file headers 2379 2428 // … … 2382 2431 // hi is the last file number (inclusive) 2383 2432 // 2433 // V_getLeftRightFlipDone(fname) 2434 // 2435 // 2436 // updated the function to check for the "already done" flag 2437 // - if already done, report this and do nothing. 2438 // - if not done, do the flip and set the flag 2439 // 2384 2440 Function V_fPatchDet_Offset(lo,hi) 2385 2441 Variable lo,hi 2386 2442 2387 2443 2388 Variable ii,jj 2444 Variable ii,jj,flipDone=0 2389 2445 String fname,detStr 2390 2446 … … 2397 2453 if(strlen(fname) != 0) 2398 2454 2399 offset_FL = V_getDet_LateralOffset(fname,"FL") 2400 offset_FR = V_getDet_LateralOffset(fname,"FR") 2401 2402 offset_ML = V_getDet_LateralOffset(fname,"ML") 2403 offset_MR = V_getDet_LateralOffset(fname,"MR") 2404 2405 // swap L/R offset values 2406 V_WriteDet_LateralOffset(fname,"FL",-offset_FR) 2407 V_WriteDet_LateralOffset(fname,"FR",-offset_FL) 2408 2409 V_WriteDet_LateralOffset(fname,"ML",-offset_MR) 2410 V_WriteDet_LateralOffset(fname,"MR",-offset_ML) 2411 2412 Print fname 2413 Print "swapped FL, FR = ",-offset_FR,-offset_FL 2414 Print "swapped ML, MR = ",-offset_MR,-offset_ML 2455 flipDone = V_getLeftRightFlipDone(fname) 2456 if(flipDone == 1) 2457 printf "run number %d already flipped - nothing done\r",jj 2458 else 2459 offset_FL = V_getDet_LateralOffset(fname,"FL") 2460 offset_FR = V_getDet_LateralOffset(fname,"FR") 2461 2462 offset_ML = V_getDet_LateralOffset(fname,"ML") 2463 offset_MR = V_getDet_LateralOffset(fname,"MR") 2464 2465 // swap L/R offset values 2466 V_WriteDet_LateralOffset(fname,"FL",-offset_FR) 2467 V_WriteDet_LateralOffset(fname,"FR",-offset_FL) 2468 2469 V_WriteDet_LateralOffset(fname,"ML",-offset_MR) 2470 V_WriteDet_LateralOffset(fname,"MR",-offset_ML) 2471 2472 // set the flag 2473 V_writeLeftRightFlipDone(fname,1) // value == 1 means the flip was done 2474 Print fname 2475 Print "swapped FL, FR = ",-offset_FR,-offset_FL 2476 Print "swapped ML, MR = ",-offset_MR,-offset_ML 2477 2478 endif 2415 2479 2416 2480 else 2417 2481 printf "run number %d not found\r",jj 2418 2482 endif 2483 2419 2484 endfor 2420 2485 2421 2486 return(0) 2422 2487 End 2488 2489 // utility to reset the flip state in the file headers 2490 // 2491 // lo is the first file number 2492 // hi is the last file number (inclusive) 2493 // 2494 // setting value == 1 means done 2495 // setting value == -999999 means not done (mimics a missing /entry) 2496 // 2497 Function V_fWriteFlipState(lo,hi,val) 2498 Variable lo,hi,val 2499 2500 2501 Variable ii,jj,flipDone=0 2502 String fname,detStr 2503 2504 Variable offset_ML,offset_MR,offset_FL,offset_FR 2505 2506 //loop over all files 2507 for(jj=lo;jj<=hi;jj+=1) 2508 fname = V_FindFileFromRunNumber(jj) 2509 if(strlen(fname) != 0) 2510 2511 // set the flag 2512 V_writeLeftRightFlipDone(fname,val) // 2513 Print fname 2514 printf "run number %d flag reset to %d\r",jj,val 2515 2516 else 2517 printf "run number %d not found\r",jj 2518 endif 2519 2520 endfor 2521 2522 return(0) 2523 End 2524 2525 2423 2526 2424 2527 // simple utility to read the detector offset stored in the file header -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Protocol_Reduction.ipf
r1088 r1092 583 583 Function/S V_GetBGDList() 584 584 585 String match="BLOCKED BEAM" 586 String list = V_getFileIntentList(match,0) 587 585 String intent="BLOCKED BEAM" 586 String purpose="SCATTERING" 587 // String list = V_getFileIntentList(match,0) 588 String list = V_getFileIntentPurposeList(intent,purpose,0) 589 588 590 // Printf "BGD files = %s\r",list 589 591 return(list) 590 592 end 591 593 592 594 // 595 // V_getFileIntentPurposeList(intent,purpose,method) 593 596 Function/S V_GetEMPList() 594 597 595 String match="EMPTY CELL" 596 String list = V_getFileIntentList(match,0) 598 String intent="EMPTY CELL" 599 String purpose="SCATTERING" 600 // String list = V_getFileIntentList(match,0) 601 String list = V_getFileIntentPurposeList(intent,purpose,0) 602 597 603 598 604 // Printf "EMP files = %s\r",list … … 755 761 756 762 757 758 763 759 764 return(list) … … 769 774 770 775 newList = V_Get_NotRawDataFileList() 776 newList = V_RemoveEXTFromList(newlist,"hst") // remove the event files 777 newList = V_RemoveEXTFromList(newlist,"ave") // remove the ave files 778 newList = V_RemoveEXTFromList(newlist,"abs") // remove the abs files 779 771 780 num=ItemsInList(newList) 772 781 … … 812 821 813 822 newList = V_Get_NotRawDataFileList() 823 newList = V_RemoveEXTFromList(newlist,"hst") // remove the event files 814 824 num=ItemsInList(newList) 815 825 … … 852 862 853 863 newList = V_Get_NotRawDataFileList() 864 newList = V_RemoveEXTFromList(newlist,"hst") // remove the event files 865 newList = V_RemoveEXTFromList(newlist,"ave") // remove the ave files 866 newList = V_RemoveEXTFromList(newlist,"abs") // remove the abs files 867 854 868 num=ItemsInList(newList) 855 869 … … 899 913 900 914 newList = V_Get_NotRawDataFileList() 915 newList = V_RemoveEXTFromList(newlist,"hst") // remove the event files 901 916 num=ItemsInList(newList) 902 917 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Utilities_General.ipf
r1084 r1092 962 962 End 963 963 964 // removes any item with ".EXT" from the list 965 // don't pass the "." 966 // returns a modified list 967 Function/S V_RemoveEXTFromList(list,ext) 968 String list,ext 969 970 ext = "*."+ext 971 Variable num=ItemsInList(list,";"),ii 972 String item,newList="" 973 974 for(ii=0;ii<num;ii+=1) 975 item = StringFromList(ii, list ,";") 976 977 if( !stringmatch(item,ext) ) 978 newlist += item + ";" 979 endif 980 981 endfor 982 return(newList) 983 End 964 984 965 985 //the following is a WaveMetrics procedure from <StrMatchList>
Note: See TracChangeset
for help on using the changeset viewer.