source: sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_IQ_Utilities.ipf @ 1076

Last change on this file since 1076 was 1076, checked in by srkline, 5 years ago

woking on routines to correctly reduce data colloected with slit apertures. trying to get the data to absolute scale, with proper errro bars and resolution information.

Still not there yet.

File size: 18.2 KB
RevLine 
[984]1#pragma TextEncoding = "MacRoman"               // For details execute DisplayHelpTopic "The TextEncoding Pragma"
2#pragma rtGlobals=3             // Use modern global access method and strict wave access.
3
[1023]4
[984]5//
[1023]6// Operation does no scaling, only the basic (default) trim of the ends, concatenate, sort, and save
[1030]7// -- if data has been converted to WORK and the solid angle correction was done, then the data
[1023]8//   is per unit solid angle, and matches up - at least the simulated data does...
[1030]9//   It should match up in real VSANS data since the flux conditions are identical for
10//   all panels, only the geometry is different.
[984]11//
[999]12//
[1023]13// V_DataPlotting.ipf is where the I(q) panel is drawn and the binning is set
14//
[999]15// see the VCALC BinAllMiddlePanels() for an example of this
16// see the binning routines in VC_DetectorBinning_Utils.ipf for the details
17//
[1023]18
[999]19// TODO
[1022]20//
21// -- verify the binning for slit mode. Looks correct, but verify
22// -- DOCUMENT
23//
[999]24// x- detector "B" is currently skipped since the calibration waves are not faked
25//    when the raw data is loaded. Then the qxqyqz waves are not generated.
26//
[1022]27// x- REDO the logic here. It's a mess, and will get the calculation wrong
[999]28//
[1022]29// x- figure out the binning type (where is it set for VSANS?)
30// x- don't know, so currently VSANS binning type is HARD-WIRED
31// x- figure out when this needs to be called to (force) re-calculate I vs Q
[999]32//
[1022]33
34
[1036]35
[1038]36//
[1035]37// NOTE
38// this is the master conversion function
39// ***Use no others
40// *** When other bin types are developed, DO NOT reassign these numbers.
41//  instead, skip the old numbers and assign new ones.
[1073]42//
43// - the numbers here in the switch can be out of order - it's fine
44//
45// old modes can be removed from the string constant ksBinTypeStr(n) (in V_Initialize.ipf), but the
[1035]46// mode numbers are what many different binning, plotting, and reduction functions are
47// switching on. In the future, it may be necessary to change the key (everywhere) to a string
48// switch, but for now, stick with the numbers.
[1073]49//
50// Strconstant ksBinTypeStr = "F4-M4-B;F2-M2-B;F1-M1-B;F2-M1-B;F1-M2xTB-B;F2-M2xTB-B;SLIT-F2-M2-B;"
51//
52//
[1035]53Function V_BinTypeStr2Num(binStr)
54        String binStr
55       
56        Variable binType
57        strswitch(binStr)       // string switch
[1073]58                case "F4-M4-B":
[1035]59                        binType = 1
60                        break           // exit from switch
[1073]61                case "F2-M2-B":
[1035]62                        binType = 2
63                        break           // exit from switch
[1073]64                case "F1-M1-B":
[1035]65                        binType = 3
66                        break           // exit from switch
[1073]67                case "SLIT-F2-M2-B":
[1035]68                        binType = 4
69                        break           // exit from switch
70
[1073]71                case "F2-M1-B":
72                        binType = 5
73                        break
74                case "F1-M2xTB-B":
75                        binType = 6
76                        break
77                case "F2-M2xTB-B":
78                        binType = 7
79                        break
80                       
[1035]81                default:                        // optional default expression executed
82                        binType = 0
83                        Abort "Binning mode not found"// when no case matches
84        endswitch       
[1073]85       
[1035]86        return(binType)
87end
88
[1044]89//
90// TODO -- binType == 4 (slit mode) should never end up here
91// -- new logic in calling routines to dispatch to proper routine
92// -- AND need to write the routine for binning_SlitMode
93//
94Function V_QBinAllPanels_Circular(folderStr,binType)
[999]95        String folderStr
[1027]96        Variable binType
[999]97
98        // do the back, middle, and front separately
99       
100//      figure out the binning type (where is it set?)
[1027]101        Variable ii,delQ
[999]102        String detStr
103
[1027]104//      binType = V_GetBinningPopMode()
[1022]105
[1073]106        // set delta Q for binning (used later inside VC_fDoBinning_QxQy2D)
107        for(ii=0;ii<ItemsInList(ksDetectorListAll);ii+=1)
108                detStr = StringFromList(ii, ksDetectorListAll, ";")
109               
110                delQ = SetDeltaQ(folderStr,detStr)              // this sets (overwrites) the global value for each panel type
111        endfor
[999]112       
113
[1073]114        switch(binType)
115                case 1:
116                        VC_fDoBinning_QxQy2D(folderStr,"FL")
117                        VC_fDoBinning_QxQy2D(folderStr,"FR")
118                        VC_fDoBinning_QxQy2D(folderStr,"FT")
119                        VC_fDoBinning_QxQy2D(folderStr,"FB")
120                        VC_fDoBinning_QxQy2D(folderStr,"ML")
121                        VC_fDoBinning_QxQy2D(folderStr,"MR")
122                        VC_fDoBinning_QxQy2D(folderStr,"MT")
123                        VC_fDoBinning_QxQy2D(folderStr,"MB")                   
124                        VC_fDoBinning_QxQy2D(folderStr, "B")           
[999]125
[1073]126                        break
127                case 2:
128                        VC_fDoBinning_QxQy2D(folderStr,"FLR")
129                        VC_fDoBinning_QxQy2D(folderStr,"FTB")
130                        VC_fDoBinning_QxQy2D(folderStr,"MLR")
131                        VC_fDoBinning_QxQy2D(folderStr,"MTB")
132                        VC_fDoBinning_QxQy2D(folderStr, "B")           
[999]133
[1073]134                        break
135                case 3:
136                        VC_fDoBinning_QxQy2D(folderStr,"MLRTB")
137                        VC_fDoBinning_QxQy2D(folderStr,"FLRTB")
138                        VC_fDoBinning_QxQy2D(folderStr, "B")           
139                       
140                        break
141                case 4:                         /// this is for a tall, narrow slit mode       
142                        VC_fBinDetector_byRows(folderStr,"FL")
143                        VC_fBinDetector_byRows(folderStr,"FR")
144                        VC_fBinDetector_byRows(folderStr,"ML")
145                        VC_fBinDetector_byRows(folderStr,"MR")
146                        VC_fBinDetector_byRows(folderStr,"B")
[999]147
[1073]148                        break
149                case 5:
150                        VC_fDoBinning_QxQy2D(folderStr,"FTB")
151                        VC_fDoBinning_QxQy2D(folderStr,"FLR")
152                        VC_fDoBinning_QxQy2D(folderStr,"MLRTB")
153                        VC_fDoBinning_QxQy2D(folderStr, "B")           
[999]154               
[1073]155                        break
156                case 6:
157                        VC_fDoBinning_QxQy2D(folderStr,"FLRTB")
158                        VC_fDoBinning_QxQy2D(folderStr,"MLR")
159                        VC_fDoBinning_QxQy2D(folderStr, "B")           
[999]160               
[1073]161                        break
162                case 7:
163                        VC_fDoBinning_QxQy2D(folderStr,"FTB")
164                        VC_fDoBinning_QxQy2D(folderStr,"FLR")
165                        VC_fDoBinning_QxQy2D(folderStr,"MLR")
166                        VC_fDoBinning_QxQy2D(folderStr, "B")           
[999]167               
[1073]168                        break
169                       
170                default:
171                        Abort "Binning mode not found in V_QBinAllPanels_Circular"// when no case matches       
172        endswitch
[999]173       
174
175        return(0)
176End
177
[1027]178// concatenates and sorts the 1D data in "type" WORK folder
179// uses the current display if type==""
180//
[1039]181Function V_ConcatenateForSave(pathStr,type,tagStr,binType)
182        String pathStr,type,tagStr
[1027]183        Variable binType
184       
185// get the current display type, if null string passed in
186        SVAR curtype = root:Packages:NIST:VSANS:Globals:gCurDispType
187       
188        if(strlen(type)==0)
189                type = curType
190        endif
[999]191
[984]192// trim the data if needed
[1002]193        // remove the q=0 point from the back detector, if it's there
[1027]194        // does not need to know binType
[1076]195        NVAR gIgnoreDetB = root:Packages:NIST:VSANS:Globals:gIgnoreDetB
196        if(!gIgnoreDetB)
197                V_RemoveQ0_B(type)
198        endif
[984]199
200// concatenate the data sets
[1023]201// TODO x- figure out which binning was used (this is done in V_1DConcatenate())
[1002]202        // clear the old tmp waves first, if they still exist
[1039]203//      SetDataFolder $("root:Packages:NIST:VSANS:"+type)
204        SetDataFolder $(pathStr+type)
[1064]205        Killwaves/Z tmp_q,tmp_i,tmp_s,tmp_sq,tmp_qb,tmp_fs
[1002]206        setDataFolder root:
[1039]207        V_1DConcatenate(pathStr,type,tagStr,binType)
[984]208       
209// sort the data set
[1039]210        V_TmpSort1D(pathStr,type)
[984]211       
[1027]212        return(0)
213End
214
215//
[1057]216// this is only called from the button on the data panel (**not anymore**)
[1027]217// so the type is the currently displayed type, and the binning is from the panel
218//
[1039]219Function V_SimpleSave1DData(pathStr,type,tagStr,saveName)
220        String pathStr,type,tagStr,saveName
[1027]221
222//
223// get the current display type, if null string passed in
224        SVAR curtype = root:Packages:NIST:VSANS:Globals:gCurDispType
225        Variable binType = V_GetBinningPopMode()
226       
[1039]227        V_ConcatenateForSave(pathStr,curType,tagStr,binType)
[1027]228       
[984]229// write out the data set to a file
[1027]230        if(strlen(saveName)==0)
231                Execute "V_GetNameForSave()"
232                SVAR newName = root:saveName
233                saveName = newName
234        endif
235       
[1039]236        V_Write1DData(pathStr,curtype,saveName)
[984]237
[999]238End
[984]239
[1027]240
[999]241Proc V_GetNameForSave(str)
242        String str
[1027]243        String/G root:saveName=str
[984]244End
245
246
[1002]247// blindly assumes that there is only one zero at the top of the wave
248// could be more sophisticated in the future...
249Function V_RemoveQ0_B(type)
250        String type
251       
252        SetDataFolder $("root:Packages:NIST:VSANS:"+type)
253
254        WAVE/Z qBin = qBin_qxqy_B
255        WAVE/Z iBin = iBin_qxqy_B
256        WAVE/Z eBin = eBin_qxqy_B
257        WAVE/Z nBin = nBin_qxqy_B
258        WAVE/Z iBin2 = iBin2_qxqy_B
259
[1064]260        // resolution waves
261        Wave/Z sigQ = sigmaQ_qxqy_B
262        Wave/Z qBar = qBar_qxqy_B
263        Wave/Z fSubS = fSubS_qxqy_B
264
[1002]265        if(qBin[0] == 0)
[1064]266                DeletePoints 0, 1, qBin,iBin,eBin,nBin,iBin2,sigQ,qBar,fSubS
[1002]267        endif
268       
269        SetDataFolder root:
270        return(0)
271end
272
273
[984]274// concatentate data in folderStr
275//
276// TODO:
[1073]277// x- !!! Resolution waves are currently skipped - these must be added
[1051]278//
[1023]279// x- this currently ignores the binning type (one, two, etc. )
[1036]280// x- change the Concatenate call to use the waveList, to eliminate the need to declare all of the waves
[984]281// -- this currently assumes that all of the waves exist
282// -- need robust error checking for wave existence
283// -- wave names are hard-wired and their name and location may be different in the future
[1023]284// x- if different averaging options were chosen (bin type of 2, 4 etc) then
[984]285//    although waves may exist, they may not be the right ones to use. There
286//    will be a somewhat complex selection process
[1002]287// x- detector B is currently skipped
[984]288//
[1023]289// this seems like a lot of extra work to do something so simple...but it's better than a loop
[984]290//
291//  root:Packages:NIST:VSANS:RAW:iBin_qxqy_FB
[1023]292//
[1073]293// Now, the extensions needed for each binType are handled in a loop using the strings
294// defined globally for each of the numbered binTypes
295//
[1023]296// binType = 1 = one
297// binType = 2 = two
298// binType = 3 = four
299// binType = 4 = Slit Mode
[1073]300// binType = 5...
[1023]301//
[1027]302// if binType is passed in as -9999, get the binning mode from the popup
303// otherwise the value is assumed good (from a protocol)
304//
[1039]305// pathStr must have the trailing colon
306// tagStr is normally null, but is "_trim" for data to be trimmed
[1036]307//
[1039]308Function V_1DConcatenate(pathStr,folderStr,tagStr,binType)
309        String pathStr,folderStr,tagStr
[1027]310        Variable binType
[984]311       
[1073]312
[1027]313        if(binType==-9999)
314                binType = V_GetBinningPopMode()
315        endif   
[1023]316       
[1073]317        String binTypeString = V_getBinTypeString(binType)
318        if(strlen(binTypeString) == 0)
319                DoAlert 0,"binTypeString is null in V_1DConcatenate"
320                return(0)
321        endif
322       
[1039]323//      SetDataFolder $("root:Packages:NIST:VSANS:"+folderStr)
324        SetDataFolder $(pathStr+folderStr)
[1023]325
[1031]326        //kill these waves before starting, or the new concatenation will be added to the old
[1064]327        KillWaves/Z tmp_q,tmp_i,tmp_s,tmp_qb,tmp_sq,tmp_fs
[1051]328
[1073]329        String q_waveListStr=""
330        String i_waveListStr=""
331        String s_waveListStr=""
332        String sq_waveListStr=""
333        String qb_waveListStr=""
334        String fs_waveListStr=""
335       
336        Variable num,ii
337        String item=""
338       
339        //Generate string lists of the waves to be concatenated based on the
340        // binTypeString (a global string constant with the extensions)
341        //
342       
[1051]343        NVAR gIgnoreDetB = root:Packages:NIST:VSANS:Globals:gIgnoreDetB
[1073]344        if(!gIgnoreDetB)
345                q_waveListStr =  "qBin_qxqy_B" + tagStr + ";"
346                i_waveListStr =  "iBin_qxqy_B" + tagStr + ";"
347                s_waveListStr =  "eBin_qxqy_B" + tagStr + ";"
348                sq_waveListStr =  "sigmaQ_qxqy_B" + tagStr + ";"
349                qb_waveListStr =  "qBar_qxqy_B" + tagStr + ";"
350                fs_waveListStr =  "fSubS_qxqy_B" + tagStr + ";"
[1036]351        endif
352
[1073]353        num = ItemsInList(binTypeString, ";")
354        for(ii=0;ii<num;ii+=1)
355                item = StringFromList(ii, binTypeString  ,";") 
356       
357        // "B" was handled outside the loop, be sure to skip here
358                if(cmpstr(item,"B") != 0)
359                        q_waveListStr +=  "qBin_qxqy_" + item + tagStr + ";"
360                        i_waveListStr +=  "iBin_qxqy_" + item + tagStr + ";"
361                        s_waveListStr +=  "eBin_qxqy_" + item + tagStr + ";"
362                        sq_waveListStr +=  "sigmaQ_qxqy_" + item + tagStr + ";"
363                        qb_waveListStr +=  "qBar_qxqy_" + item + tagStr + ";"
364                        fs_waveListStr +=  "fSubS_qxqy_" + item + tagStr + ";" 
[1051]365                endif
[1073]366        endfor
367       
368        // concatenate each of the sets
[1036]369
[1073]370        Concatenate/NP/O q_waveListStr, tmp_q
371       
372        Concatenate/NP/O i_waveListStr, tmp_i
[1036]373               
[1073]374        Concatenate/NP/O s_waveListStr, tmp_s
[1039]375               
[1073]376        Concatenate/NP/O sq_waveListStr, tmp_sq
[1036]377
[1073]378        Concatenate/NP/O qb_waveListStr, tmp_qb
[1039]379               
[1073]380        Concatenate/NP/O fs_waveListStr, tmp_fs
381                                                                               
[1036]382
383
384// Can't kill here, since they are still needed to sort and write out!
385//      KillWaves/Z tmp_q,tmp_i,tmp_s,tmp_res0,tmp_res1,tmp_res2,tmp_res3       
386       
387        SetDataFolder root:
388       
389        return(0)               
390End
391
392// TODO:
393// -- resolution waves are ignored, since they don't exist (yet)
394// -- only a sort is done, no rescaling of data sets
395//    (it's too late now anyways, since the data was concatenated)
396//
397// see Auto_Sort() in the SANS Automation ipf for the rest of the details of
398// how to combine the resolution waves (they also need to be concatenated, which is currently not done)
399//
[1039]400Function V_TmpSort1D(pathStr,folderStr)
401        String pathStr,folderStr
[1036]402       
[1039]403        SetDataFolder $(pathStr+folderStr)
[1036]404
405        Wave qw = tmp_q
406        Wave iw = tmp_i
407        Wave sw = tmp_s
[1064]408        Wave sq = tmp_sq
409        Wave qb = tmp_qb
410        Wave fs = tmp_fs
[1036]411       
412
[1064]413        Sort qw, qw,iw,sw,sq,qb,fs
[1036]414
415
416        SetDataFolder root:
417        return(0)
418End
419
420
421//
[1042]422Proc V_Load_Data_ITX()
[1038]423        V_Load_itx("","",0,0)
424end
425
[1037]426// TODO
427// -- fill in
428// -- link somewhere?
429//
430// a function to load in the individual I(q) sets which were written out to a single
431// file, in itx format.
432//
433// The data, like other 1D data sets, is to be loaded to its own folder under root
434//
435// Then, the data sets can be plotted as VSANS data sets, depending on which data extensions are present.
436// (and color coded)
437// (and used for setting the trimming)
438// (and...)
439//
440//
441// see A_LoadOneDDataToName(fileStr,outStr,doPlot,forceOverwrite)
442//
443Function V_Load_itx(fileStr,outStr,doPlot,forceOverwrite)
444        String fileStr, outstr
445        Variable doPlot,forceOverwrite
446
447        SetDataFolder root:             //build sub-folders for each data set under root
448
449        // if no fileStr passed in, display dialog now
450        if (cmpStr(fileStr,"") == 0)
451                fileStr = DoOpenFileDialog("Select a data file to load")
452                if (cmpstr(fileStr,"") == 0)
453                        String/G root:Packages:NIST:gLastFileName = ""
454                        return(0)               //get out if no file selected
455                endif
456        endif
457
458        //Load the waves, using default waveX names
459        //if no path or file is specified for LoadWave, the default Mac open dialog will appear
460        LoadWave/O/T fileStr
461//      LoadWave/G/D/A/Q fileStr
462        String fileNamePath = S_Path+S_fileName
463//              String basestr = ParseFilePath(3,ParseFilePath(5,fileNamePath,":",0,0),":",0,0)
464
465        String basestr
466        if (!cmpstr(outstr, ""))                //Outstr = "", cmpstr returns 0
467//                      enforce a short enough name here to keep Igor objects < 31 chars
468                baseStr = ShortFileNameString(CleanupName(S_fileName,0))
469                baseStr = CleanupName(baseStr,0)                //in case the user added odd characters
470                //baseStr = CleanupName(S_fileName,0)
471        else
472                baseStr = outstr                        //for output, hopefully correct length as passed in
473        endif
474
475//              print "basestr :"+basestr
476        String fileName =  ParseFilePath(0,ParseFilePath(5,filestr,":",0,0),":",1,0)
477//              print "filename :"+filename
478       
479        Variable ii,num=ItemsinList(S_waveNames)
480       
481        if(DataFolderExists("root:"+baseStr))
482                if (!forceOverwrite)
483                        DoAlert 1,"The file "+S_filename+" has already been loaded. Do you want to load the new data file, overwriting the data in memory?"
484                        if(V_flag==2)   //user selected No, don't load the data
485                                SetDataFolder root:
486                                for(ii=0;ii<num;ii+=1)         
487                                        KillWaves $(StringFromList(ii, S_waveNames))    // kill the waves that were loaded
488                                endfor
489                                if(DataFolderExists("root:Packages:NIST"))
490                                        String/G root:Packages:NIST:gLastFileName = filename
491                                endif
492                                return(0)       //quits the macro
493                        endif
494                endif
495                SetDataFolder $("root:"+baseStr)
496        else
497                NewDataFolder/S $("root:"+baseStr)
498        endif
499       
500//                      ////overwrite the existing data, if it exists
501
502// a semicolon-delimited list of wave names loaded
503//S_waveNames
504        for(ii=0;ii<num;ii+=1)         
505                Duplicate/O $("root:"+StringFromList(ii, S_waveNames)), $(StringFromList(ii, S_waveNames))
506        endfor
507
508
509// clean up
510        SetDataFolder root:
511
512        for(ii=0;ii<num;ii+=1)         
513                KillWaves $(StringFromList(ii, S_waveNames))    // kill the waves that were loaded
514        endfor
515//                      Duplicate/O $("root:"+n0), $w0
516//                      Duplicate/O $("root:"+n1), $w1
517//                      Duplicate/O $("root:"+n2), $w2
518       
[1073]519        // no resolution matrix to make
[1037]520
521       
522        return(0)
[1038]523End
524
525
[1073]526
527// string function to select the correct string constant
528// that corresponds to the selected binType. This string constant
529// contains the list of extensions to be used for plotting, saving, etc.
[1039]530//
[1073]531// returns null string if no match
532//
533Function/S V_getBinTypeString(binType)
[1038]534        Variable binType
535       
[1073]536        String detListStr=""
[1038]537        if(binType == 1)
538                detListStr = ksBinType1
539        endif
540        if(binType == 2)
541                detListStr = ksBinType2
542        endif
543        if(binType == 3)
544                detListStr = ksBinType3
545        endif
546        if(binType == 4)
547                detListStr = ksBinType4
548        endif
[1073]549        if(binType == 5)
550                detListStr = ksBinType5
551        endif
552        if(binType == 6)
553                detListStr = ksBinType6
554        endif
555        if(binType == 7)
556                detListStr = ksBinType7
557        endif
558       
559       
560        return(detListStr)
561End
562
563// given strings of the number of points to remove, loop over the detectors
564//
565// TODO
566// -- currently uses global strings or default strings
567// -- if proper strings (non-null) are passed in, they are used, otherwise global, then default
568Function V_Trim1DDataStr(folderStr,binType,nBegStr,nEndStr)
569        String folderStr
570        Variable binType
571        String nBegStr,nEndStr
572       
573        String detListStr=""
574
575        detListStr = V_getBinTypeString(binType)                //the list of extensions
[1038]576        if(strlen(detListStr)==0)
577                return(0)
578        endif
[1039]579
[1038]580       
[1039]581        //use global, then default values if null string passed in
[1038]582        if(strlen(nBegStr)==0)
[1039]583                SVAR/Z gBegPtsStr=root:Packages:NIST:VSANS:Globals:Protocols:gBegPtsStr
584                SVAR/Z gEndPtsStr=root:Packages:NIST:VSANS:Globals:Protocols:gEndPtsStr
585       
586                if(!SVAR_exists(gBegPtsStr) || !SVAR_exists(gEndPtsStr) || strlen(gBegPtsStr)==0 || strlen(gEndPtsStr)==0)
587                        nBegStr = ksBinTrimBegDefault
588                        nEndStr = ksBinTrimEndDefault
589                else
590                        nBegStr = gBegPtsStr
591                        nEndStr = gEndPtsStr
592                endif
[1038]593        endif   
594
595        Variable num, ii,nBeg,nEnd
596        String item,detstr
597       
598        num = ItemsInList(detListStr)
599        for(ii=0;ii<num;ii+=1)
600                detStr = StringFromList(ii, detListStr)
601                nBeg = NumberByKey(detStr, nBegStr,"=",";")
602                nEnd = NumberByKey(detStr, nEndStr,"=",";")
603                V_TrimOneSet(folderStr,detStr,nBeg,nEnd)
604        endfor
605
606        return(0)
607End
608
609// TODO
[1064]610// x- make this resolution-aware
[1038]611//
612Function V_TrimOneSet(folderStr,detStr,nBeg,nEnd)
613        String folderStr,detStr
614        Variable nBeg,nEnd
615       
616        SetDataFolder $("root:Packages:NIST:VSANS:"+folderStr)
617
618        Printf "%d points removed from beginning, %d points from the end  of %s \r",nbeg,nend,detStr
619
620// TODO
621// for each binType block:
622// --declare the waves
623// --make a copy of the waves??
624//      //--Break out resolution wave into separate waves
625// --delete the beginning points from everything
626        // --trim off the last nEnd points from everything
627//      --DeletePoints num-nEnd,nEnd, qw,iw,sw
628//      // --delete all points where the shadow is < 0.98
629////--Put resolution contents back???
630
631                Wave/Z qw = $("qBin_qxqy_"+detStr)
632                Wave/Z iw = $("iBin_qxqy_"+detStr)
633                Wave/Z ew = $("eBin_qxqy_"+detStr)
[1064]634                // resolution waves
635                Wave/Z sigQ = $("sigmaQ_qxqy_"+detStr)
636                Wave/Z qBar = $("qBar_qxqy_"+detStr)
637                Wave/Z fSubS = $("fSubS_qxqy_"+detStr)
[1038]638                       
[1064]639                DeletePoints 0,nBeg, qw,iw,ew,sigQ,qBar,fSubS
[1038]640
641                Variable npt
642                npt = numpnts(qw)
[1064]643                DeletePoints npt-nEnd,nEnd, qw,iw,ew,sigQ,qBar,fSubS
[1038]644       
645        return(0)
[1064]646End
647
648
[1076]649////
650//// returns 1 if the val is non-negative, other value
651//// indicates that the resoution data is USANS data.
652////
653//// TODO:
654//// -- this DUPLICATES a same-named SANS procedure, so there could be a clash at some point
655//// -- bigger issue - I'll need a better way to identify and load the different resolution
656////            conditions with VSANS
657////
658////
659//xFunction isSANSResolution(val)
660//      Variable val
661//     
662//      if(val >= 0)
663//              return(1)
664//      else
665//              return(0)
666//      endif
667//End
[1064]668
669
Note: See TracBrowser for help on using the repository browser.