Changeset 892


Ignore:
Timestamp:
Mar 22, 2020 2:53:51 PM (3 years ago)
Author:
ilavsky
Message:

Clean up and fixes to bioSAXs code

Location:
trunk/User Procedures
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/User Procedures/Indra 2/IN2_GeneralProcedures.ipf

    r884 r892  
    11#pragma rtGlobals=2             // Use modern global access method.
    2 #pragma version = 2.21
     2#pragma version = 2.22
    33#pragma IgorVersion = 7.05
    44
     
    3535//*************************************************************************/
    3636//
     37//2.22 minor fix to IN2G_ColorTopGrphRainbow
    3738//2.21 added bunch of formating tools for graphs:
    3839                //IN2G_OffsetTopGrphTraces(LogXAxis, XOffset ,LogYAxis, YOffset)
     
    33593360        if( strlen(topGraph) )
    33603361                numTraces =  ItemsInList(TraceNameList(topGraph,";",3))
    3361                 //print TraceNameList(topGraph,";",3)
    33623362                if (numTraces > 4)
    33633363                    variable r,g,b,scale
     
    33653365                    wave M_colors
    33663366                         For(i=0;i<numTraces;i+=1)
    3367                                 scale =  (numTraces-i)  / (numTraces-1) * dimsize(M_colors,0)
     3367                                scale =  (numTraces-i-1)  / (numTraces-1) * dimsize(M_colors,0)
    33683368                                r = M_colors[scale][0]
    33693369                                g = M_colors[scale][1]
     
    33753375                endif
    33763376        endif
     3377        KillWaves/Z M_colors
    33773378end
    33783379////*****************************************************************************************************************
  • trunk/User Procedures/Irena/IR3_MultiDataPlot.ipf

    r891 r892  
    2121Function IR3L_MultiSamplePlot()
    2222
     23        IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
    2324        IN2G_CheckScreenSize("width",1000)
    2425        IN2G_CheckScreenSize("height",670)
     
    3637        IR3C_MultiUpdateListOfAvailFiles("root:Packages:Irena:MultiSamplePlot")
    3738end
    38 //*****************************************************************************************************************
    39 //*****************************************************************************************************************
     39//**********************************************************************************************************
     40//**********************************************************************************************************
     41//**********************************************************************************************************
    4042
    4143Function IR3L_MainCheckVersion()       
     
    5355        endif
    5456end
    55 
    56 //*****************************************************************************************************************
    57 //*****************************************************************************************************************
    58 
    59 Function IR3L_SetStartConditions()
     57//**********************************************************************************************************
     58//**********************************************************************************************************
     59//**********************************************************************************************************
     60
     61static Function IR3L_SetStartConditions()
    6062               
     63                IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
    6164                SVAR GraphWindowName = root:Packages:Irena:MultiSamplePlot:GraphWindowName
    6265                SVAR GraphUserTitle=root:Packages:Irena:MultiSamplePlot:GraphUserTitle
     
    9194//************************************************************************************************************
    9295Function IR3L_MultiSamplePlotPanelFnct()
     96        IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
    9397        PauseUpdate; Silent 1           // building window...
    9498        NewPanel /K=1 /W=(5.25,43.25,605,820) as "MultiData Ploting tool"
     
    112116
    113117        SetVariable GraphUserTitle,pos={280,140},size={310,20}, proc=IR3L_SetVarProc,title="\Zr120Graph title: "
    114         Setvariable GraphUserTitle,fStyle=2, variable=root:Packages:Irena:MultiSamplePlot:GraphUserTitle, help={"This is huma name for graph currently controlled by teh tool. You can change it."}
     118        Setvariable GraphUserTitle,fStyle=2, variable=root:Packages:Irena:MultiSamplePlot:GraphUserTitle, help={"This is human name for graph currently controlled by the tool. You can change it."}
    115119
    116120        //Plotting controls...
     
    124128        PopupMenu SelectedDataPlot,value=#"root:Packages:Irena:MultiSamplePlot:ListOfDefinedDataPlots",mode=1, popvalue=SelectedDataPlot, bodyWidth=150
    125129        PopupMenu SelectedDataPlot fstyle=5,fColor=(0,0,65535)
     130        TitleBox SelectedDataPlotInstructions title="\Zr100",size={245,15},pos={260,240},frame=0,fColor=(0,0,65535),labelBack=0
     131
    126132
    127133        TitleBox GraphAxesControls title="\Zr100Graph Axes Options",fixedSize=1,size={150,20},pos={350,260},frame=0,fstyle=1, fixedSize=1
     
    180186        PopupMenu ApplyStyle,pos={260,680},size={400,20},proc=IR3L_PopMenuProc, title="Apply style:",help={"Set tool setting to defined conditions and apply to graph"}
    181187        PopupMenu ApplyStyle,value=#"root:Packages:Irena:MultiSamplePlot:ListOfDefinedStyles",popvalue=SelectedStyle
    182         Button ApplyPresetFormating,pos={260,720},size={160,20}, proc=IR3L_ButtonProc,title="Apply All Formating", help={"Apply Preset Formating to update graph based on these choices"}
    183 
    184         Button ExportGraphJPG,pos={500,680},size={90,20}, proc=IR3L_ButtonProc,title="Export jpg", help={"Export as jpg file"}
    185         Button ExportGraphTIF,pos={500,705},size={90,20}, proc=IR3L_ButtonProc,title="Export tiff", help={"Export as tiff file"}
    186         Button SaveGraphAsFile,pos={500,730},size={90,20}, proc=IR3L_ButtonProc,title="Save Graph", help={"Save Graph As Igor experiment"}
    187 
    188 
    189         //IR3L_FixPanelControls()
     188        Button ApplyPresetFormating,pos={260,710},size={160,20}, proc=IR3L_ButtonProc,title="Apply All Formating", help={"Apply Preset Formating to update graph based on these choices"}
     189        Checkbox ApplyFormatingEveryTime, pos={250,735},size={76,14},title="Apply Formating automatically?", proc=IR3L_CheckProc, variable=root:Packages:Irena:MultiSamplePlot:ApplyFormatingEveryTime, help={"Should all formatting be applied after every data additon?"}
     190
     191       
     192        Button ExportGraphJPG,pos={450,680},size={140,20}, proc=IR3L_ButtonProc,title="Export as jpg", help={"Export as jpg file"}
     193        Button ExportGraphTIF,pos={450,705},size={140,20}, proc=IR3L_ButtonProc,title="Export as tiff", help={"Export as tiff file"}
     194        Button SaveGraphAsFile,pos={450,730},size={140,20}, proc=IR3L_ButtonProc,title="Export as pxp", help={"Save Graph As Igor experiment"}
     195
     196
     197        IR3L_FixPanelControls()
    190198end
    191199//**********************************************************************************************************
    192200//**********************************************************************************************************
    193201//**********************************************************************************************************
    194 Function/S IR3L_GraphListPopupString()
     202
     203static Function IR3L_FixPanelControls()
     204        //fix panel controls to whatever selection user made...
     205
     206        IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
     207        SVAR SelectedDataPlot=root:Packages:Irena:MultiSamplePlot:SelectedDataPlot
     208        strswitch(SelectedDataPlot)                                             // string switch
     209                case "X-Y (q-Int, etc.)":                               // execute if case matches expression
     210                        TitleBox SelectedDataPlotInstructions win=IR3L_MultiSamplePlotPanel, title="\Zr100Original data will be used"
     211                        break                                                                           // exit from switch
     212                case "Guinier (Q^2-ln(I))":                             // execute if case matches expression
     213                        TitleBox SelectedDataPlotInstructions win=IR3L_MultiSamplePlotPanel, title="\Zr100Guinier data will be created"
     214                        break
     215                case "Kratky (Q-IQ^2)":                                 // execute if case matches expression
     216                        TitleBox SelectedDataPlotInstructions win=IR3L_MultiSamplePlotPanel, title="\Zr100Kratky data will be created"
     217                        break
     218                case "DimLess Kratky (Q-I*(Q*Rg)^2/I0)":                                        // execute if case matches expression
     219                        TitleBox SelectedDataPlotInstructions win=IR3L_MultiSamplePlotPanel, title="\Zr100DimLess Kratky data will be created if Guinier fit results exist"
     220                        break
     221                case "Porod (Q^4-IQ^4)":                                        // execute if case matches expression
     222                        TitleBox SelectedDataPlotInstructions win=IR3L_MultiSamplePlotPanel, title="\Zr100Porod data will be created"
     223                        break
     224                default:                                                                                // optional default expression executed, this is basically X-Y case again
     225                                                                                                                // when no case matches
     226        endswitch
     227
     228end
     229//**********************************************************************************************************
     230//**********************************************************************************************************
     231//**********************************************************************************************************
     232
     233static Function/S IR3L_GraphListPopupString()
    195234        // Create some waves for demo purposes
     235        IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
    196236        string list = WinList("MultiDataPlot_*", ";", "WIN:1" )
    197237        list = SortList(list)
     
    217257//**********************************************************************************************************
    218258
    219 Function IR3L_InitMultiSamplePlot()     
    220 
    221 
    222         string oldDf=GetDataFolder(1)
     259static Function IR3L_InitMultiSamplePlot()     
     260        IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
     261        DfRef OldDf=GetDataFolderDFR()
    223262        string ListOfVariables
    224263        string ListOfStrings
     
    246285        ListOfVariables+="LogXAxis;LogYAxis;MajorGridXaxis;MajorGridYaxis;MinorGridXaxis;MinorGridYaxis;"
    247286        ListOfVariables+="Colorize;UseSymbols;UseLines;SymbolSize;LineThickness;"
    248         ListOfVariables+="XOffset;YOffset;DisplayErrorBars;"
     287        ListOfVariables+="XOffset;YOffset;DisplayErrorBars;ApplyFormatingEveryTime;"
    249288        ListOfVariables+="AddLegend;UseOnlyFoldersInLegend;LegendSize;"
    250289       
     
    289328        ListOfDefinedStyles = "Log-Log;Lin-Lin;Lin-Log;VolumeSizeDistribution;NumberSizeDistribution;"
    290329        SVAR ListOfDefinedDataPlots
    291         ListOfDefinedDataPlots = "X-Y (q-Int, etc.);Guinier (Q^2-ln(I));Kratky (Q-IQ^2);Porod (Q^4-IQ^4);"
     330        ListOfDefinedDataPlots = "X-Y (q-Int, etc.);Guinier (Q^2-ln(I));Kratky (Q-IQ^2);Porod (Q^4-IQ^4);DimLess Kratky (Q-I*(Q*Rg)^2/I0);"
    292331        SVAR SelectedStyle
    293332        if(strlen(SelectedStyle)<2)
     
    358397//**************************************************************************************
    359398//**************************************************************************************
    360 
    361 //*****************************************************************************************************************
    362 //*****************************************************************************************************************
    363 //**************************************************************************************
    364 //**************************************************************************************
    365 
    366399Function IR3L_CheckProc(cba) : CheckBoxControl
    367400        STRUCT WMCheckboxAction &cba
     
    459492End
    460493//**************************************************************************************
    461 //**************************************************************************************
    462 //**************************************************************************************
    463 //**************************************************************************************
    464 //**************************************************************************************
    465 //**************************************************************************************
    466 //**************************************************************************************
     494//**********************************************************************************************************
     495//**********************************************************************************************************
     496//**********************************************************************************************************
    467497
    468498Function IR3L_PopMenuProc(pa) : PopupMenuControl
     
    546576                IR3L_SetAndApplyStyle(SelectedStyle)   
    547577                PopupMenu ApplyStyle,win=IR3L_MultiSamplePlotPanel, popmatch=SelectedStyle
    548         endif
    549 
    550        
     578                IR3L_FixPanelControls()
     579        endif
    551580        DOWIndow/F IR3L_MultiSamplePlotPanel
    552581end
     
    607636//**************************************************************************************
    608637Function IR3L_DoubleClickAction(FoldernameStr)
    609                         string FoldernameStr
    610                         //if called with GraphWindowName = "---" need to create new graph and direct data there, or the tool doe snothing
    611                         SVAR GraphWindowName=root:Packages:Irena:MultiSamplePlot:GraphWindowName
    612                         string LocalGraphName
    613                         variable CreatedNewGraph=0
    614                         if(strlen(GraphWindowName)<2 || StringMatch(GraphWindowName, "---" ))
    615                                 LocalGraphName="none"
    616                         else
    617                                 LocalGraphName = GraphWindowName
    618                         endif
    619                         DOWIndow $(LocalGraphName)
    620                         if(V_Flag<1)                    //widnow does not exist, need new window to use...
    621                                 //set some meaningful values for these data first
    622                                 IR3L_SetPlotLegends()                                                           
    623                                 //Create new graph and append data to graph
    624                                 IR3L_CreateNewGraph()           
    625                                 CreatedNewGraph = 1
    626                         endif           
    627                         IR3L_AppendData(FoldernameStr)
    628                         if(CreatedNewGraph)
    629                                 IR3L_ApplyPresetFormating(GraphWindowName)
    630                         endif
     638                string FoldernameStr
     639                IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
     640                //if called with GraphWindowName = "---" need to create new graph and direct data there, or the tool doe snothing
     641                SVAR GraphWindowName=root:Packages:Irena:MultiSamplePlot:GraphWindowName
     642                string LocalGraphName
     643                variable CreatedNewGraph=0
     644                if(strlen(GraphWindowName)<2 || StringMatch(GraphWindowName, "---" ))
     645                        LocalGraphName="none"
     646                else
     647                        LocalGraphName = GraphWindowName
     648                endif
     649                DOWIndow $(LocalGraphName)
     650                if(V_Flag<1)                    //widnow does not exist, need new window to use...
     651                        //set some meaningful values for these data first
     652                        IR3L_SetPlotLegends()                                                           
     653                        //Create new graph and append data to graph
     654                        IR3L_CreateNewGraph()           
     655                        CreatedNewGraph = 1
     656                endif           
     657                IR3L_AppendData(FoldernameStr)
     658                if(CreatedNewGraph)
     659                        IR3L_ApplyPresetFormating(GraphWindowName)
     660                endif
    631661
    632662end
    633 
    634 
    635 //**************************************************************************************
    636 //**************************************************************************************
    637 Function IR3L_AppendData(FolderNameStr)
     663//**********************************************************************************************************
     664//**********************************************************************************************************
     665//**********************************************************************************************************
     666
     667static Function IR3L_AppendData(FolderNameStr)
    638668        string FolderNameStr
    639669       
    640         string oldDf=GetDataFolder(1)
     670        IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
     671        DfRef OldDf=GetDataFolderDFR()
    641672        SetDataFolder root:Packages:Irena:MultiSamplePlot                                       //go into the folder
    642         //IR3D_SetSavedNotSavedMessage(0)
    643 
    644673                SVAR DataStartFolder=root:Packages:Irena:MultiSamplePlot:DataStartFolder
    645674                SVAR DataFolderName=root:Packages:Irena:MultiSamplePlot:DataFolderName
     
    773802                        return 0
    774803                endif
     804                //create local copies of original data, inc case their are needed later
     805                Duplicate/Free SourceIntWv, SourceIntWvOrig
     806                Duplicate/Free SourceQWv, SourceQWvOrig
     807                if(WaveExists(SourceErrorWv))
     808                        Duplicate/Free SourceErrorWv, SourceErrorWvOrig
     809                endif
    775810                //create graph if needed.
    776811                if(StringMatch(GraphWindowName, "---" ))
     
    784819                endif
    785820                //now we need to create data, if they do not exist. Here is where we decide what data user wants to plot.
    786                 //      ListOfDefinedDataPlots = "X-Y (q-Int, etc.);Guinier (Q^2-ln(I));Kratky (Q-IQ^2);Porod (Q^4-IQ^4);"
     821                //      ListOfDefinedDataPlots = "X-Y (q-Int, etc.);Guinier (Q^2-ln(I));Kratky (Q-IQ^2);Porod (Q^4-IQ^4);DimLess Kratky (Q-I*(Q*Rg)^2/I0);"
    787822                strswitch(SelectedDataPlot)                                             // string switch
    788823                        case "X-Y (q-Int, etc.)":                               // execute if case matches expression
     
    799834                                if(WaveExists(SourceErrorWv))
    800835                                        Duplicate/O SourceErrorWv, $(DataFolderName+"Guinier_"+ErrorWaveName)
    801                                         Wave SourceErrorWvOrg=$(DataFolderName+ErrorWaveName)
    802                                         Wave SourceIntWvOrg=$(DataFolderName+IntensityWaveName)
    803                                         Wave SourceErrorWv=$(DataFolderName+"Guinier_"+ErrorWaveName)
    804                                         SourceErrorWv = SourceErrorWvOrg/SourceIntWvOrg
     836                                                Wave SourceErrorWv=$(DataFolderName+"Guinier_"+ErrorWaveName)
     837                                        SourceErrorWv = SourceErrorWvOrig/SourceIntWvOrig
    805838                                endif
    806839                                break
     
    816849                                        Wave SourceErrorWv=$(DataFolderName+"Kratky_"+ErrorWaveName)
    817850                                        SourceErrorWv = SourceErrorWv * SourceQWv^2
     851                                endif
     852                                break
     853                        case "DimLess Kratky (Q-I*(Q*Rg)^2/I0)":                                        // execute if case matches expression
     854                                //create and save Kraky data corrected for Rg and I0
     855                                //need to find Guinier fit results
     856                                Wave/Z/T SampleName =  root:GuinierFitResults:SampleName
     857                                Wave/Z GuinierI0 = root:GuinierFitResults:GuinierI0
     858                                Wave/Z GuinierRg = root:GuinierFitResults:GuinierRg
     859                                if(!WaveExists(SampleName) || !WaveExists(GuinierI0) ||!WaveExists(GuinierRg))
     860                                        Abort "Guinier results not found. In order to use this data type, you need to save results from Guinier fit using Simple Fits tool for all data you want to plot"
     861                                endif
     862                                variable I0 = IR3L_LookUpValueForWaveName(DataFolderName, SampleName,GuinierI0)
     863                                variable Rg = IR3L_LookUpValueForWaveName(DataFolderName, SampleName,GuinierRg)
     864                                if(numtype(I0) || numtype(Rg))
     865                                        Abort "Could not find Guinier results for "+DataFolderName+" in the Guinier fit results from Simple fit."
     866                                endif
     867                                Duplicate/O SourceIntWv, $(DataFolderName+"DLKratky_"+IntensityWaveName)
     868                                Duplicate/O SourceQWv, $(DataFolderName+"DLKratky_"+QWavename)
     869                                Wave SourceIntWv=$(DataFolderName+"DLKratky_"+IntensityWaveName)
     870                                Wave SourceQWv=$(DataFolderName+"DLKratky_"+QWavename)
     871                                SourceIntWv = SourceIntWv * ((Rg*SourceQWv)^2)/I0
     872                                if(WaveExists(SourceErrorWv))
     873                                        Duplicate/O SourceErrorWv, $(DataFolderName+"DLKratky_"+ErrorWaveName)
     874                                        Wave SourceErrorWv=$(DataFolderName+"DLKratky_"+ErrorWaveName)
     875                                        SourceErrorWv = SourceErrorWv * ((Rg*SourceQWv)^2)/I0
    818876                                endif
    819877                                break
     
    847905                endif
    848906                //append data to graph
     907                NVAR ApplyFormatingEveryTime = root:Packages:Irena:MultiSamplePlot:ApplyFormatingEveryTime
     908                if(ApplyFormatingEveryTime)
     909                        IR3L_ApplyPresetFormating(GraphWindowName)
     910                endif
    849911        SetDataFolder oldDf
    850912        return 1
     
    852914//**********************************************************************************************************
    853915//**********************************************************************************************************
    854 ////**********************************************************************************************************
    855 //**********************************************************************************************************
     916//**********************************************************************************************************
     917
     918static Function IR3L_LookUpValueForWaveName(SampleNameStr, SampleNameWV,ValueWv)
     919                string SampleNameStr                    //folder name only, no wabe nae and include ":" at the end.
     920                wave/T SampleNameWV
     921                Wave ValueWv
     922               
     923        IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
     924        variable i
     925        For (i=0;i<numpnts(SampleNameWV);i+=1)
     926                if(StringMatch(SampleNameStr, SampleNameWV[i]))
     927                        return ValueWv[i]
     928                endif
     929        endfor
     930        return NaN
     931end
     932//**********************************************************************************************************
     933//**********************************************************************************************************
     934//**********************************************************************************************************
     935
    856936Function IR3L_ButtonProc(ba) : ButtonControl
    857937        STRUCT WMButtonAction &ba
     
    882962                                IR3L_ApplyPresetFormating(GraphWindowName)
    883963                        endif
    884 
    885 
    886964                        if(stringmatch(ba.ctrlname,"AppendPlotData"))
    887965                                //append data to graph
     
    899977                                endfor                                          // Execute body code until continue test is FALSE
    900978                        endif
    901 
    902979                        if(stringmatch(ba.ctrlname,"ApplyPresetFormating"))
    903980                                //append data to graph
     
    9371014//**********************************************************************************************************
    9381015//**********************************************************************************************************
    939 Function IR3L_CreateNewGraph()
    940 
    941                 SVAR GraphWindowName=root:Packages:Irena:MultiSamplePlot:GraphWindowName
    942                 SVAR GraphUserTitle=root:Packages:Irena:MultiSamplePlot:GraphUserTitle
    943                 //first create a new GraphWindowName, this is new graph...
    944                 string basename="MultiDataPlot_"
    945                 GraphWindowName = UniqueName(basename, 6, 0)
    946                 Display /K=1/W=(1297,231,2097,841) as GraphUserTitle
    947                 DoWindow/C $(GraphWindowName)
    948                 AutoPositionWindow /M=0 /R=IR3L_MultiSamplePlotPanel $(GraphWindowName)
     1016static Function IR3L_CreateNewGraph()
     1017
     1018        IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
     1019        SVAR GraphWindowName=root:Packages:Irena:MultiSamplePlot:GraphWindowName
     1020        SVAR GraphUserTitle=root:Packages:Irena:MultiSamplePlot:GraphUserTitle
     1021        //first create a new GraphWindowName, this is new graph...
     1022        string basename="MultiDataPlot_"
     1023        GraphWindowName = UniqueName(basename, 6, 0)
     1024        Display /K=1/W=(1297,231,2097,841) as GraphUserTitle
     1025        DoWindow/C $(GraphWindowName)
     1026        AutoPositionWindow /M=0 /R=IR3L_MultiSamplePlotPanel $(GraphWindowName)
    9491027end
    9501028//**********************************************************************************************************
    9511029//**********************************************************************************************************
    9521030//**********************************************************************************************************
    953 Function IR3L_SetAndApplyStyle(WHichStyle)     
     1031static Function IR3L_SetAndApplyStyle(WHichStyle)       
    9541032        string WHichStyle
    9551033       
    956 //      ListOfDefinedStyles = "Log-Log;Lin-Log;VolumeSizeDistribution;NumberSizeDistribution;"
     1034        IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
     1035        //      ListOfDefinedStyles = "Log-Log;Lin-Log;VolumeSizeDistribution;NumberSizeDistribution;"
    9571036                SVAR GraphWindowName=root:Packages:Irena:MultiSamplePlot:GraphWindowName
    9581037                NVAR LogXAxis=root:Packages:Irena:MultiSamplePlot:LogXAxis
     
    10311110//**********************************************************************************************************
    10321111//**********************************************************************************************************
    1033 Function IR3L_ApplyPresetFormating(GraphNameString)
     1112static Function IR3L_ApplyPresetFormating(GraphNameString)
    10341113                string GraphNameString
    10351114
     1115        IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
    10361116        if(strlen(GraphNameString)<1)
    10371117                return 0
     
    11261206//**********************************************************************************************************
    11271207
    1128 Function IR3L_SetPlotLegends()                          //this function will set axis legends and otehr stuff based on waves
     1208static Function IR3L_SetPlotLegends()                           //this function will set axis legends and otehr stuff based on waves
    11291209                //applies only when creating new graph...
    11301210
     1211                IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
    11311212                NVAR UseIndra2Data=root:Packages:Irena:MultiSamplePlot:UseIndra2Data
    11321213                NVAR UseQRSdata=root:Packages:Irena:MultiSamplePlot:UseQRSdata
     
    12941375                                YAxislegend = "Intensity*Q\S2\M"
    12951376                                break
     1377                        case "DimLess Kratky (Q-I*(Q*Rg)^2/I0)":                                        // execute if case matches expression
     1378                                //create and save Kratky data
     1379                                GraphUserTitle = "Dimension less Kratky Plot for data"
     1380                                XAxisLegend = "Q [A\S-1\M]"
     1381                                YAxislegend = "Intensity/I0*(QRg)\S2\M"
     1382                                break
    12961383                        case "Porod (Q^4-IQ^4)":                                        // execute if case matches expression
    12971384                                //create and save Porod data
     
    13091396end
    13101397
    1311 //                              GraphUserTitle = "Size Distribution results"
    1312 //                              XAxisLegend = "Q [A\S-1\M]"
    1313 //                              YAxislegend = "Intensity [arb]"
    1314 //**********************************************************************************************************
    1315 //**********************************************************************************************************
    1316 //**********************************************************************************************************
    1317 //**********************************************************************************************************
    1318 ////**********************************************************************************************************
    1319 //Function IR3L_CreateLinearizedData()
    1320 //
    1321 //      string oldDf=GetDataFolder(1)
    1322 //      SetDataFolder root:Packages:Irena:MultiSamplePlot                                       //go into the folder
    1323 //      Wave OriginalDataIntWave=root:Packages:Irena:MultiSamplePlot:OriginalDataIntWave
    1324 //      Wave OriginalDataQWave=root:Packages:Irena:MultiSamplePlot:OriginalDataQWave
    1325 //      Wave OriginalDataErrorWave=root:Packages:Irena:MultiSamplePlot:OriginalDataErrorWave
    1326 //      SVAR SimpleModel=root:Packages:Irena:MultiSamplePlot:SimpleModel
    1327 //      Duplicate/O OriginalDataIntWave, LinModelDataIntWave, ModelNormalizedResidual
    1328 //      Duplicate/O OriginalDataQWave, LinModelDataQWave, ModelNormResXWave
    1329 //      Duplicate/O OriginalDataErrorWave, LinModelDataEWave
    1330 //      ModelNormalizedResidual = 0
    1331 //      if(stringmatch(SimpleModel,"Guinier"))
    1332 //              LinModelDataQWave = OriginalDataQWave^2
    1333 //              ModelNormResXWave = OriginalDataQWave^2
    1334 //      endif
    1335 //     
    1336 //     
    1337 //      SetDataFolder oldDf
    1338 //end
    1339 //
    1340 ////**********************************************************************************************************
    1341 
    1342 //Function IR3L_AppendDataToGraphModel()
    1343 //     
    1344 //      DoWindow IR3L_MultiSamplePlotPanel
    1345 //      if(!V_Flag)
    1346 //              return 0
    1347 //      endif
    1348 //      variable WhichLegend=0
    1349 //      variable startQp, endQp, tmpStQ
    1350 //
    1351 ////    Duplicate/O OriginalDataIntWave, LinModelDataIntWave, ModelNormalizedResidual
    1352 ////    Duplicate/O OriginalDataQWave, LinModelDataQWave, ModelNormResXWave
    1353 ////    Duplicate/O OriginalDataErrorWave, LinModelDataEWave
    1354 //
    1355 //      Wave LinModelDataIntWave=root:Packages:Irena:MultiSamplePlot:LinModelDataIntWave
    1356 //      Wave LinModelDataQWave=root:Packages:Irena:MultiSamplePlot:LinModelDataQWave
    1357 //      Wave LinModelDataEWave=root:Packages:Irena:MultiSamplePlot:LinModelDataEWave
    1358 //      CheckDisplayed /W=IR3L_MultiSamplePlotPanel#LogLogDataDisplay LinModelDataIntWave
    1359 //      if(!V_flag)
    1360 //              AppendToGraph /W=IR3L_MultiSamplePlotPanel#LinearizedDataDisplay  LinModelDataIntWave  vs LinModelDataQWave
    1361 //              ModifyGraph /W=IR3L_MultiSamplePlotPanel#LinearizedDataDisplay log=1, mirror(bottom)=1
    1362 //              Label /W=IR3L_MultiSamplePlotPanel#LinearizedDataDisplay left "\\Z"+IN2G_LkUpDfltVar("AxisLabelSize")+"Intensity"
    1363 //              Label /W=IR3L_MultiSamplePlotPanel#LinearizedDataDisplay bottom "\\Z"+IN2G_LkUpDfltVar("AxisLabelSize")+"Q [A\\S-1\\M]"
    1364 //              ErrorBars /W=IR3L_MultiSamplePlotPanel#LinearizedDataDisplay LinModelDataIntWave Y,wave=(LinModelDataEWave,LinModelDataEWave)           
    1365 //      endif
    1366 ////    NVAR DataQEnd = root:Packages:Irena:MultiSamplePlot:DataQEnd
    1367 ////    if(DataQEnd>0)                  //old Q max already set.
    1368 ////            endQp = BinarySearch(OriginalDataQWave, DataQEnd)
    1369 ////    endif
    1370 ////    if(endQp<1)     //Qmax not set or not found. Set to last point-1 on that wave.
    1371 ////            DataQEnd = OriginalDataQWave[numpnts(OriginalDataQWave)-2]
    1372 ////            endQp = numpnts(OriginalDataQWave)-2
    1373 ////    endif
    1374 ////    cursor /W=IR3L_MultiSamplePlotPanel#LogLogDataDisplay B, OriginalDataIntWave, endQp
    1375 //      DoUpdate
    1376 //
    1377 //      Wave/Z ModelNormalizedResidual=root:Packages:Irena:MultiSamplePlot:ModelNormalizedResidual
    1378 //      Wave/Z ModelNormResXWave=root:Packages:Irena:MultiSamplePlot:ModelNormResXWave
    1379 //      CheckDisplayed /W=IR3L_MultiSamplePlotPanel#ResidualDataDisplay ModelNormalizedResidual  //, ResultIntensity
    1380 //      if(!V_flag)
    1381 //              AppendToGraph /W=IR3L_MultiSamplePlotPanel#ResidualDataDisplay  ModelNormalizedResidual  vs ModelNormResXWave
    1382 //              ModifyGraph /W=IR3L_MultiSamplePlotPanel#LinearizedDataDisplay log=1, mirror(bottom)=1
    1383 //              Label /W=IR3L_MultiSamplePlotPanel#LinearizedDataDisplay left "\\Z"+IN2G_LkUpDfltVar("AxisLabelSize")+"Normalized res."
    1384 //              Label /W=IR3L_MultiSamplePlotPanel#LinearizedDataDisplay bottom "\\Z"+IN2G_LkUpDfltVar("AxisLabelSize")+"Q [A\\S-1\\M]"
    1385 //      endif
    1386 //
    1387 //
    1388 //
    1389 //      string Shortname1, ShortName2
    1390 //     
    1391 //      switch(V_Flag)  // numeric switch
    1392 //              case 0:         // execute if case matches expression
    1393 //                      Legend/W=IR3L_MultiSamplePlotPanel#LogLogDataDisplay /N=text0/K
    1394 //                      break                                           // exit from switch
    1395 ////            case 1:         // execute if case matches expression
    1396 ////                    SVAR DataFolderName=root:Packages:Irena:MultiSamplePlot:DataFolderName
    1397 ////                    Shortname1 = StringFromList(ItemsInList(DataFolderName1, ":")-1, DataFolderName1  ,":")
    1398 ////                    Legend/W=IR3L_MultiSamplePlotPanel#LogLogDataDisplay /C/N=text0/J/A=LB "\\s(OriginalData1IntWave) "+Shortname1
    1399 ////                    break
    1400 ////            case 2:
    1401 ////                    SVAR DataFolderName=root:Packages:Irena:MultiSamplePlot:DataFolderName
    1402 ////                    Shortname2 = StringFromList(ItemsInList(DataFolderName2, ":")-1, DataFolderName2  ,":")
    1403 ////                    Legend/W=IR3L_MultiSamplePlotPanel#LogLogDataDisplay /C/N=text0/J/A=LB "\\s(OriginalData2IntWave) " + Shortname2               
    1404 ////                    break
    1405 ////            case 3:
    1406 ////                    SVAR DataFolderName=root:Packages:Irena:MultiSamplePlot:DataFolderName
    1407 ////                    Shortname1 = StringFromList(ItemsInList(DataFolderName1, ":")-1, DataFolderName1  ,":")
    1408 ////                    Legend/W=IR3L_MultiSamplePlotPanel#LogLogDataDisplay /C/N=text0/J/A=LB "\\s(OriginalData1IntWave) "+Shortname1+"\r\\s(OriginalData2IntWave) "+Shortname2
    1409 ////                    break
    1410 ////            case 7:
    1411 ////                    SVAR DataFolderName=root:Packages:Irena:MultiSamplePlot:DataFolderName
    1412 ////                    Shortname1 = StringFromList(ItemsInList(DataFolderName1, ":")-1, DataFolderName1  ,":")
    1413 ////                    Legend/W=IR3L_MultiSamplePlotPanel#LogLogDataDisplay /C/N=text0/J/A=LB "\\s(OriginalData1IntWave) "+Shortname1+"\r\\s(OriginalData2IntWave) "+Shortname2+"\r\\s(ResultIntensity) Merged Data"
    1414 //                      break
    1415 //      endswitch
    1416 //
    1417 //     
    1418 //end
    1419 //**********************************************************************************************************
    1420 //**********************************************************************************************************
    1421 //
    1422 //
    1423 //Function IR3L_AppendDataToGraphLogLog()
    1424 //     
    1425 //      DoWindow IR3L_MultiSamplePlotPanel
    1426 //      if(!V_Flag)
    1427 //              return 0
    1428 //      endif
    1429 //      variable WhichLegend=0
    1430 //      variable startQp, endQp, tmpStQ
    1431 //      Wave OriginalDataIntWave=root:Packages:Irena:MultiSamplePlot:OriginalDataIntWave
    1432 //      Wave OriginalDataQWave=root:Packages:Irena:MultiSamplePlot:OriginalDataQWave
    1433 //      Wave OriginalDataErrorWave=root:Packages:Irena:MultiSamplePlot:OriginalDataErrorWave
    1434 //      CheckDisplayed /W=IR3L_MultiSamplePlotPanel#LogLogDataDisplay OriginalDataIntWave
    1435 //      if(!V_flag)
    1436 //              AppendToGraph /W=IR3L_MultiSamplePlotPanel#LogLogDataDisplay  OriginalDataIntWave  vs OriginalDataQWave
    1437 //              ModifyGraph /W=IR3L_MultiSamplePlotPanel#LogLogDataDisplay log=1, mirror(bottom)=1
    1438 //              Label /W=IR3L_MultiSamplePlotPanel#LogLogDataDisplay left "Intensity 1"
    1439 //              Label /W=IR3L_MultiSamplePlotPanel#LogLogDataDisplay bottom "Q [A\\S-1\\M]"
    1440 //              ErrorBars /W=IR3L_MultiSamplePlotPanel#LogLogDataDisplay OriginalDataIntWave Y,wave=(OriginalDataErrorWave,OriginalDataErrorWave)               
    1441 //      endif
    1442 //      NVAR DataQEnd = root:Packages:Irena:MultiSamplePlot:DataQEnd
    1443 //      if(DataQEnd>0)                  //old Q max already set.
    1444 //              endQp = BinarySearch(OriginalDataQWave, DataQEnd)
    1445 //      endif
    1446 //      if(endQp<1)     //Qmax not set or not found. Set to last point-1 on that wave.
    1447 //              DataQEnd = OriginalDataQWave[numpnts(OriginalDataQWave)-2]
    1448 //              endQp = numpnts(OriginalDataQWave)-2
    1449 //      endif
    1450 //      cursor /W=IR3L_MultiSamplePlotPanel#LogLogDataDisplay B, OriginalDataIntWave, endQp
    1451 //      DoUpdate
    1452 //
    1453 //      Wave/Z OriginalDataIntWave=root:Packages:Irena:MultiSamplePlot:OriginalDataIntWave
    1454 //      CheckDisplayed /W=IR3L_MultiSamplePlotPanel#LogLogDataDisplay OriginalDataIntWave  //, ResultIntensity
    1455 //      string Shortname1, ShortName2
    1456 //     
    1457 //      switch(V_Flag)  // numeric switch
    1458 //              case 0:         // execute if case matches expression
    1459 //                      Legend/W=IR3L_MultiSamplePlotPanel#LogLogDataDisplay /N=text0/K
    1460 //                      break                                           // exit from switch
    1461 ////            case 1:         // execute if case matches expression
    1462 ////                    SVAR DataFolderName=root:Packages:Irena:MultiSamplePlot:DataFolderName
    1463 ////                    Shortname1 = StringFromList(ItemsInList(DataFolderName1, ":")-1, DataFolderName1  ,":")
    1464 ////                    Legend/W=IR3L_MultiSamplePlotPanel#LogLogDataDisplay /C/N=text0/J/A=LB "\\s(OriginalData1IntWave) "+Shortname1
    1465 ////                    break
    1466 ////            case 2:
    1467 ////                    SVAR DataFolderName=root:Packages:Irena:MultiSamplePlot:DataFolderName
    1468 ////                    Shortname2 = StringFromList(ItemsInList(DataFolderName2, ":")-1, DataFolderName2  ,":")
    1469 ////                    Legend/W=IR3L_MultiSamplePlotPanel#LogLogDataDisplay /C/N=text0/J/A=LB "\\s(OriginalData2IntWave) " + Shortname2               
    1470 ////                    break
    1471 ////            case 3:
    1472 ////                    SVAR DataFolderName=root:Packages:Irena:MultiSamplePlot:DataFolderName
    1473 ////                    Shortname1 = StringFromList(ItemsInList(DataFolderName1, ":")-1, DataFolderName1  ,":")
    1474 ////                    Legend/W=IR3L_MultiSamplePlotPanel#LogLogDataDisplay /C/N=text0/J/A=LB "\\s(OriginalData1IntWave) "+Shortname1+"\r\\s(OriginalData2IntWave) "+Shortname2
    1475 ////                    break
    1476 ////            case 7:
    1477 ////                    SVAR DataFolderName=root:Packages:Irena:MultiSamplePlot:DataFolderName
    1478 ////                    Shortname1 = StringFromList(ItemsInList(DataFolderName1, ":")-1, DataFolderName1  ,":")
    1479 ////                    Legend/W=IR3L_MultiSamplePlotPanel#LogLogDataDisplay /C/N=text0/J/A=LB "\\s(OriginalData1IntWave) "+Shortname1+"\r\\s(OriginalData2IntWave) "+Shortname2+"\r\\s(ResultIntensity) Merged Data"
    1480 //                      break
    1481 //      endswitch
    1482 //
    1483 //     
    1484 //end
    1485 ////**********************************************************************************************************
    1486 //**********************************************************************************************************
    1487 //**********************************************************************************************************
    1488 //**************************************************************************************
    1489 //**************************************************************************************
    1490 //Function IR3L_UpdateListOfAvailFiles()
    1491 //
    1492 //
    1493 //      string OldDF=GetDataFolder(1)
    1494 //      setDataFolder root:Packages:Irena:MultiSamplePlot
    1495 //     
    1496 //      NVAR UseIndra2Data=root:Packages:Irena:MultiSamplePlot:UseIndra2Data
    1497 //      NVAR UseQRSdata=root:Packages:Irena:MultiSamplePlot:UseQRSData
    1498 //      NVAR UseResults=root:Packages:Irena:MultiSamplePlot:UseResults
    1499 //      SVAR StartFolderName=root:Packages:Irena:MultiSamplePlot:DataStartFolder
    1500 //      SVAR DataMatchString= root:Packages:Irena:MultiSamplePlot:DataMatchString
    1501 //      SVAR DataSubType = root:Packages:Irena:MultiSamplePlot:DataSubType
    1502 //      NVAR InvertGrepSearch=root:Packages:Irena:MultiSamplePlot:InvertGrepSearch
    1503 //      string LStartFolder, FolderContent
    1504 //      if(stringmatch(StartFolderName,"---"))
    1505 //              LStartFolder="root:"
    1506 //      else
    1507 //              LStartFolder = StartFolderName
    1508 //      endif
    1509 //      //build list of availabe folders here...
    1510 //      string CurrentFolders
    1511 //      if(UseIndra2Data && !(StringMatch(DataSubType, "DSM_Int")||StringMatch(DataSubType, "SMR_Int")))                //special folders...
    1512 //              CurrentFolders=IN2G_FindFolderWithWaveTypes(LStartFolder, 10, DataSubType, 1)                                                   //this does not clean up by matchstring...
    1513 //              if(strlen(DataMatchString)>0)                                                                                                                                                                                   //match string selections
    1514 //                      CurrentFolders = GrepList(CurrentFolders, DataMatchString, InvertGrepSearch)
    1515 //              endif
    1516 //      elseif(UseIndra2Data && (StringMatch(DataSubType, "DSM_Int")||StringMatch(DataSubType, "SMR_Int")))                     //DSM or SMR data wanted.
    1517 //              //need to check if user wants DSM or SMR data.
    1518 //              if(StringMatch(DataSubType, "DSM_Int"))
    1519 //                      CurrentFolders=IR3L_GenStringOfFolders(LStartFolder,UseIndra2Data, UseQRSData,UseResults, 0,1)
    1520 //              else
    1521 //                      CurrentFolders=IR3L_GenStringOfFolders(LStartFolder,UseIndra2Data, UseQRSData,UseResults, 1,1)
    1522 //              endif
    1523 //              //apply grep list.
    1524 //              if(strlen(DataMatchString)>0)
    1525 //                      CurrentFolders = GrepList(CurrentFolders, DataMatchString, InvertGrepSearch)
    1526 //              endif
    1527 //      else
    1528 //              CurrentFolders=IR3L_GenStringOfFolders(LStartFolder,UseIndra2Data, UseQRSData,UseResults, 0,1)
    1529 //              //apply grep list.
    1530 //              if(strlen(DataMatchString)>0)
    1531 //                      CurrentFolders = GrepList(CurrentFolders, DataMatchString, InvertGrepSearch)
    1532 //              endif
    1533 //      endif
    1534 //
    1535 //     
    1536 //
    1537 //      Wave/T ListOfAvailableData=root:Packages:Irena:MultiSamplePlot:ListOfAvailableData
    1538 //      Wave SelectionOfAvailableData=root:Packages:Irena:MultiSamplePlot:SelectionOfAvailableData
    1539 //      variable i, j, match
    1540 //      string TempStr, FolderCont
    1541 //
    1542 //             
    1543 //      Redimension/N=(ItemsInList(CurrentFolders , ";")) ListOfAvailableData, SelectionOfAvailableData
    1544 //      j=0
    1545 //      For(i=0;i<ItemsInList(CurrentFolders , ";");i+=1)
    1546 //              TempStr = ReplaceString(LStartFolder, StringFromList(i, CurrentFolders , ";"),"")
    1547 //              if(strlen(TempStr)>0)
    1548 //                      ListOfAvailableData[j] = tempStr
    1549 //                      j+=1
    1550 //              endif
    1551 //      endfor
    1552 //      if(j<ItemsInList(CurrentFolders , ";"))
    1553 //              DeletePoints j, numpnts(ListOfAvailableData)-j, ListOfAvailableData, SelectionOfAvailableData
    1554 //      endif
    1555 //      SelectionOfAvailableData = 0
    1556 //      IR3L_SortListOfAvailableFldrs()
    1557 //      setDataFolder OldDF
    1558 //end
    1559 //
    1560 
    1561 ////**************************************************************************************
    1562 ////**************************************************************************************
    1563 //Function/T IR3L_GenStringOfFolders(StartFolder,UseIndra2Structure, UseQRSStructure, UseResults, SlitSmearedData, AllowQRDataOnly)
    1564 //      string StartFolder
    1565 //      variable UseIndra2Structure, UseQRSStructure, UseResults, SlitSmearedData, AllowQRDataOnly
    1566 //              //SlitSmearedData =0 for DSM data,
    1567 //              //                          =1 for SMR data
    1568 //              //                    and =2 for both
    1569 //              // AllowQRDataOnly=1 if Q and R data are allowed only (no error wave). For QRS data ONLY!
    1570 //     
    1571 //      string ListOfQFolders
    1572 //      string TempStr, tempStr2
    1573 //      variable i
    1574 //      //      if UseIndra2Structure = 1 we are using Indra2 data, else return all folders
    1575 //      string result
    1576 //      if (UseIndra2Structure)
    1577 //              if(SlitSmearedData==1)
    1578 //                      result=IN2G_FindFolderWithWaveTypes(StartFolder, 10, "*SMR*", 1)
    1579 //              elseif(SlitSmearedData==2)
    1580 //                      tempStr=IN2G_FindFolderWithWaveTypes(StartFolder, 10, "*SMR*", 1)
    1581 //                      result=IN2G_FindFolderWithWaveTypes(StartFolder, 10, "*DSM*", 1)+";"
    1582 //                      for(i=0;i<ItemsInList(tempStr);i+=1)
    1583 //                      //print stringmatch(result, "*"+StringFromList(i, tempStr,";")+"*")
    1584 //                              if(stringmatch(result, "*"+StringFromList(i, tempStr,";")+"*")==0)
    1585 //                                      result+=StringFromList(i, tempStr,";")+";"
    1586 //                              endif
    1587 //                      endfor
    1588 //              else
    1589 //                      result=IN2G_FindFolderWithWaveTypes(StartFolder, 10, "*DSM*", 1)
    1590 //              endif
    1591 //      elseif (UseQRSStructure)
    1592 ////            ListOfQFolders=IN2G_FindFolderWithWaveTypes(StartFolder, 10, "q*", 1)
    1593 ////            result=IR1_ReturnListQRSFolders(ListOfQFolders,AllowQRDataOnly)
    1594 //                      make/N=0/FREE/T ResultingWave
    1595 //                      IR2P_FindFolderWithWaveTypesWV(StartFolder, 10, "(?i)^r|i$", 1, ResultingWave)
    1596 //                      //IR2P_FindFolderWithWaveTypesWV("root:", 10, "*i*", 1, ResultingWave)
    1597 //                      result=IR3C_CheckForRightQRSTripletWvs(ResultingWave,AllowQRDataOnly)
    1598 //      elseif (UseResults)
    1599 //              SVAR SelectedResultsTool=root:Packages:Irena:MultiSamplePlot:SelectedResultsTool
    1600 //              SVAR SelectedResultsType=root:Packages:Irena:MultiSamplePlot:SelectedResultsType
    1601 //              SVAR ResultsGenerationToUse=root:Packages:Irena:MultiSamplePlot:ResultsGenerationToUse
    1602 //              if(stringmatch(ResultsGenerationToUse,"Latest"))
    1603 //                      result=IN2G_FindFolderWithWvTpsList(StartFolder, 10,SelectedResultsType+"*", 1)
    1604 //              else
    1605 //                      result=IN2G_FindFolderWithWvTpsList(StartFolder, 10,SelectedResultsType+ResultsGenerationToUse, 1)
    1606 //              endif
    1607 //      else
    1608 //              result=IN2G_FindFolderWithWaveTypes(StartFolder, 10, "*", 1)
    1609 //      endif
    1610 //      if(stringmatch(";",result[0]))
    1611 //              result = result [1, inf]
    1612 //      endif
    1613 //      return result
    1614 //end
    1615 
    1616 ////*****************************************************************************************************************
    1617 ////*****************************************************************************************************************
    1618 //**************************************************************************************
    1619 //**************************************************************************************
    1620 //**************************************************************************************
    1621 //**************************************************************************************
    1622 //**************************************************************************************
    1623 //**************************************************************************************
    1624 //Function IR3L_SortListOfAvailableFldrs()
    1625 //     
    1626 //      SVAR FolderSortString=root:Packages:Irena:MultiSamplePlot:FolderSortString
    1627 //      Wave/T ListOfAvailableData=root:Packages:Irena:MultiSamplePlot:ListOfAvailableData
    1628 //      Wave SelectionOfAvailableData=root:Packages:Irena:MultiSamplePlot:SelectionOfAvailableData
    1629 //      if(numpnts(ListOfAvailableData)<2)
    1630 //              return 0
    1631 //      endif
    1632 //      Duplicate/Free SelectionOfAvailableData, TempWv
    1633 //      variable i, InfoLoc, j=0
    1634 //      variable DIDNotFindInfo
    1635 //      DIDNotFindInfo =0
    1636 //      string tempstr
    1637 //      SelectionOfAvailableData=0
    1638 //      if(stringMatch(FolderSortString,"---"))
    1639 //              //nothing to do
    1640 //      elseif(stringMatch(FolderSortString,"Alphabetical"))
    1641 //              Sort /A ListOfAvailableData, ListOfAvailableData
    1642 //      elseif(stringMatch(FolderSortString,"Reverse Alphabetical"))
    1643 //              Sort /A /R ListOfAvailableData, ListOfAvailableData
    1644 //      elseif(stringMatch(FolderSortString,"_xyz"))
    1645 //              For(i=0;i<numpnts(TempWv);i+=1)
    1646 //                      TempWv[i] = str2num(StringFromList(ItemsInList(ListOfAvailableData[i]  , "_")-1, ListOfAvailableData[i]  , "_"))
    1647 //              endfor
    1648 //              Sort TempWv, ListOfAvailableData
    1649 //      elseif(stringMatch(FolderSortString,"Sxyz_"))
    1650 //              For(i=0;i<numpnts(TempWv);i+=1)
    1651 //                      TempWv[i] = str2num(ReplaceString("S", StringFromList(0, ListOfAvailableData[i], "_"), ""))
    1652 //              endfor
    1653 //              Sort TempWv, ListOfAvailableData
    1654 //      elseif(stringMatch(FolderSortString,"Reverse Sxyz_"))
    1655 //              For(i=0;i<numpnts(TempWv);i+=1)
    1656 //                      TempWv[i] = str2num(ReplaceString("S", StringFromList(0, ListOfAvailableData[i], "_"), ""))
    1657 //              endfor
    1658 //              Sort/R TempWv, ListOfAvailableData
    1659 //      elseif(stringMatch(FolderSortString,"_xyzmin"))
    1660 //              Do
    1661 //                      For(i=0;i<ItemsInList(ListOfAvailableData[j] , "_");i+=1)
    1662 //                              if(StringMatch(ReplaceString(":", StringFromList(i, ListOfAvailableData[j], "_"),""), "*min" ))
    1663 //                                      InfoLoc = i
    1664 //                                      break
    1665 //                              endif
    1666 //                      endfor
    1667 //                      j+=1
    1668 //                      if(j>(numpnts(ListOfAvailableData)-1))
    1669 //                              DIDNotFindInfo=1
    1670 //                              break
    1671 //                      endif
    1672 //              while (InfoLoc<1)
    1673 //              if(DIDNotFindInfo)
    1674 //                      DoALert /T="Information not found" 0, "Cannot find location of _xyzmin information, sorting alphabetically"
    1675 //                      Sort /A ListOfAvailableData, ListOfAvailableData
    1676 //              else
    1677 //                      For(i=0;i<numpnts(TempWv);i+=1)
    1678 //                              if(StringMatch(StringFromList(InfoLoc, ListOfAvailableData[i], "_"), "*min*" ))
    1679 //                                      TempWv[i] = str2num(ReplaceString("min", StringFromList(InfoLoc, ListOfAvailableData[i], "_"), ""))
    1680 //                              else    //data not found
    1681 //                                      TempWv[i] = inf
    1682 //                              endif
    1683 //                      endfor
    1684 //                      Sort TempWv, ListOfAvailableData
    1685 //              endif
    1686 //      elseif(stringMatch(FolderSortString,"_xyzpct"))
    1687 //              Do
    1688 //                      For(i=0;i<ItemsInList(ListOfAvailableData[j] , "_");i+=1)
    1689 //                              if(StringMatch(ReplaceString(":", StringFromList(i, ListOfAvailableData[j], "_"),""), "*pct" ))
    1690 //                                      InfoLoc = i
    1691 //                                      break
    1692 //                              endif
    1693 //                      endfor
    1694 //                      j+=1
    1695 //                      if(j>(numpnts(ListOfAvailableData)-1))
    1696 //                              DIDNotFindInfo=1
    1697 //                              break
    1698 //                      endif
    1699 //              while (InfoLoc<1)
    1700 //              if(DIDNotFindInfo)
    1701 //                      DoAlert/T="Information not found" 0, "Cannot find location of _xyzpct information, sorting alphabetically"
    1702 //                      Sort /A ListOfAvailableData, ListOfAvailableData
    1703 //              else
    1704 //                      For(i=0;i<numpnts(TempWv);i+=1)
    1705 //                              if(StringMatch(StringFromList(InfoLoc, ListOfAvailableData[i], "_"), "*pct*" ))
    1706 //                                      TempWv[i] = str2num(ReplaceString("pct", StringFromList(InfoLoc, ListOfAvailableData[i], "_"), ""))
    1707 //                              else    //data not found
    1708 //                                      TempWv[i] = inf
    1709 //                              endif
    1710 //                      endfor
    1711 //                      Sort TempWv, ListOfAvailableData
    1712 //              endif
    1713 //      elseif(stringMatch(FolderSortString,"_xyzC"))
    1714 //              Do
    1715 //                      For(i=0;i<ItemsInList(ListOfAvailableData[j] , "_");i+=1)
    1716 //                              if(StringMatch(ReplaceString(":", StringFromList(i, ListOfAvailableData[j], "_"),""), "*C" ))
    1717 //                                      InfoLoc = i
    1718 //                                      break
    1719 //                              endif
    1720 //                      endfor
    1721 //                      j+=1
    1722 //                      if(j>(numpnts(ListOfAvailableData)-1))
    1723 //                              DIDNotFindInfo=1
    1724 //                              break
    1725 //                      endif
    1726 //              while (InfoLoc<1)
    1727 //              if(DIDNotFindInfo)
    1728 //                      DoAlert /T="Information not found" 0, "Cannot find location of _xyzC information, sorting alphabetically"
    1729 //                      Sort /A ListOfAvailableData, ListOfAvailableData
    1730 //              else
    1731 //                      For(i=0;i<numpnts(TempWv);i+=1)
    1732 //                              if(StringMatch(StringFromList(InfoLoc, ListOfAvailableData[i], "_"), "*C*" ))
    1733 //                                      TempWv[i] = str2num(ReplaceString("C", StringFromList(InfoLoc, ListOfAvailableData[i], "_"), ""))
    1734 //                              else    //data not found
    1735 //                                      TempWv[i] = inf
    1736 //                              endif
    1737 //                      endfor
    1738 //                      Sort TempWv, ListOfAvailableData
    1739 //              endif
    1740 //      elseif(stringMatch(FolderSortString,"Reverse _xyz"))
    1741 //              For(i=0;i<numpnts(TempWv);i+=1)
    1742 //                      TempWv[i] = str2num(StringFromList(ItemsInList(ListOfAvailableData[i]  , "_")-1, ListOfAvailableData[i]  , "_"))
    1743 //              endfor
    1744 //              Sort /R  TempWv, ListOfAvailableData
    1745 //      elseif(stringMatch(FolderSortString,"_xyz.ext"))
    1746 //              For(i=0;i<numpnts(TempWv);i+=1)
    1747 //                      tempstr = StringFromList(ItemsInList(ListOfAvailableData[i]  , ".")-2, ListOfAvailableData[i]  , ".")
    1748 //                      TempWv[i] = str2num(StringFromList(ItemsInList(tempstr , "_")-1, tempstr , "_"))
    1749 //              endfor
    1750 //              Sort TempWv, ListOfAvailableData
    1751 //      elseif(stringMatch(FolderSortString,"Reverse _xyz.ext"))
    1752 //              For(i=0;i<numpnts(TempWv);i+=1)
    1753 //                      tempstr = StringFromList(ItemsInList(ListOfAvailableData[i]  , ".")-2, ListOfAvailableData[i]  , ".")
    1754 //                      TempWv[i] = str2num(StringFromList(ItemsInList(tempstr , "_")-1, tempstr , "_"))
    1755 //              endfor
    1756 //              Sort /R  TempWv, ListOfAvailableData
    1757 //      elseif(stringMatch(FolderSortString,"_xyz_000"))
    1758 //              For(i=0;i<numpnts(TempWv);i+=1)
    1759 //                      TempWv[i] = str2num(StringFromList(ItemsInList(ListOfAvailableData[i]  , "_")-2, ListOfAvailableData[i]  , "_"))
    1760 //              endfor
    1761 //              Sort TempWv, ListOfAvailableData
    1762 //      elseif(stringMatch(FolderSortString,"Reverse _xyz_000"))
    1763 //              For(i=0;i<numpnts(TempWv);i+=1)
    1764 //                      TempWv[i] = str2num(StringFromList(ItemsInList(ListOfAvailableData[i]  , "_")-2, ListOfAvailableData[i]  , "_"))
    1765 //              endfor
    1766 //              Sort /R  TempWv, ListOfAvailableData
    1767 //      endif
    1768 //
    1769 //end
    1770 ////**************************************************************************************
     1398//**********************************************************************************************************
     1399//**********************************************************************************************************
     1400//**********************************************************************************************************
     1401
  • trunk/User Procedures/Irena/IRB1_bioSAXS.ipf

    r891 r892  
    197197
    198198end
     199//**********************************************************************************************************
     200//**********************************************************************************************************
     201//**********************************************************************************************************
    199202//************************************************************************************************************
    200203//************************************************************************************************************
     
    233236        return 0
    234237End
     238//**********************************************************************************************************
     239//**********************************************************************************************************
     240//**********************************************************************************************************
    235241//************************************************************************************************************
    236242//************************************************************************************************************
     
    262268        return 0
    263269End
     270//**********************************************************************************************************
     271//**********************************************************************************************************
     272//**********************************************************************************************************
    264273//************************************************************************************************************
    265274//************************************************************************************************************
    266275//                              Part of customized BioSAXS Import ASCII
    267276//************************************************************************************************************
    268 Function IRB1_ImportDataFnct()
     277static Function IRB1_ImportDataFnct()
    269278        IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
    270279
    271280        string TopPanel=WinName(0, 64)
    272         string OldDf = getDataFolder(1)
     281        DfRef OldDf=GetDataFolderDFR()
    273282       
    274283        Wave/T WaveOfFiles    = root:Packages:Irena:ImportBioSAXSData:WaveOfFiles
     
    338347//                              Part of customized BioSAXS Import ASCII
    339348//************************************************************************************************************
    340 Function IRB1_InitializeImportData()
    341        
    342         IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
    343         string OldDf = GetDataFolder(1)
     349static Function IRB1_InitializeImportData()
     350       
     351        IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
     352        DfRef OldDf=GetDataFolderDFR()
    344353       
    345354        NewDataFolder/O/S root:Packages
     
    390399        endif
    391400end
    392 //************************************************************************************************************
    393 //************************************************************************************************************
    394 
    395 Function IRB1_PreviewDataFnct()
    396         IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
    397         string OldDf = getDataFolder(1)
     401//**********************************************************************************************************
     402//**********************************************************************************************************
     403//**********************************************************************************************************
     404
     405static Function IRB1_PreviewDataFnct()
     406        IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
     407        DfRef OldDf=GetDataFolderDFR()
    398408       
    399409        Wave/T WaveOfFiles    = root:Packages:Irena:ImportBioSAXSData:WaveOfFiles
     
    448458//************************************************************************************************************
    449459//************************************************************************************************************
    450 Function IRB1_DataManPanelFnct()
     460static Function IRB1_DataManPanelFnct()
     461        IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
    451462        PauseUpdate; Silent 1           // building window...
    452463        NewPanel /K=1 /W=(2.25,43.25,1195,800) as "BioSAXS data manipulation"
     
    565576        IRB1_DataManTabProc(TempTCA)
    566577end
     578//**********************************************************************************************************
    567579//**********************************************************************************************************
    568580//**********************************************************************************************************
     
    633645//**********************************************************************************************************
    634646//**********************************************************************************************************
     647//**********************************************************************************************************
    635648
    636649Function IRB1_DataManButtonProc(ba) : ButtonControl
     
    678691//**********************************************************************************************************
    679692//**********************************************************************************************************
    680 
     693//**********************************************************************************************************
    681694
    682695Function IRB1_DataManSetVarProc(sva) : SetVariableControl
     
    716729        return 0
    717730End
    718 
    719 
    720 //**********************************************************************************************************
    721 //**********************************************************************************************************
    722 
    723 Function IRB1_DataManRemoveAllDataSets()
    724 
    725         string OldDf=GetDataFolder(1)
     731//**********************************************************************************************************
     732//**********************************************************************************************************
     733//**********************************************************************************************************
     734
     735static Function IRB1_DataManRemoveAllDataSets()
     736
     737        IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
     738        DfRef OldDf=GetDataFolderDFR()
    726739        setDataFolder root:Packages:Irena:BioSAXSDataMan
    727740        variable i, numTraces
     
    738751//**********************************************************************************************************
    739752//**********************************************************************************************************
    740 Function IRB1_DataManAverageDataSetsts()
    741 
    742         string OldDf=GetDataFolder(1)
     753//**********************************************************************************************************
     754
     755static Function IRB1_DataManAverageDataSetsts()
     756
     757        IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
     758        DfRef OldDf=GetDataFolderDFR()
    743759        setDataFolder root:Packages:Irena:BioSAXSDataMan
    744760        variable i, numTraces
     
    817833        setDataFOlder oldDf
    818834end
    819 
    820 //**********************************************************************************************************
    821 //**********************************************************************************************************
    822 Function IRB1_DataManSelectAllData()
     835//**********************************************************************************************************
     836//**********************************************************************************************************
     837//**********************************************************************************************************
     838
     839static Function IRB1_DataManSelectAllData()
     840        IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
    823841        Wave SelectionOfAvailableData = root:Packages:Irena:BioSAXSDataMan:SelectionOfAvailableData     
    824842        SelectionOfAvailableData = 1
     
    826844//**********************************************************************************************************
    827845//**********************************************************************************************************
    828 Function IRB1_DataManAppendSelectedDataSets()
    829 
     846//**********************************************************************************************************
     847
     848static Function IRB1_DataManAppendSelectedDataSets()
     849
     850        IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
    830851        variable i
    831852        string FoldernameStr
     
    850871//**********************************************************************************************************
    851872//**************************************************************************************
    852 Function IRB1_DataManAppendOneDataSet(FolderNameStr)
     873static Function IRB1_DataManAppendOneDataSet(FolderNameStr)
    853874        string FolderNameStr
    854875       
    855         string oldDf=GetDataFolder(1)
     876        IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
     877        DfRef OldDf=GetDataFolderDFR()
    856878        SetDataFolder root:Packages:Irena:BioSAXSDataMan                                        //go into the folder
    857879        //IR3D_SetSavedNotSavedMessage(0)
     
    962984//**********************************************************************************************************
    963985
    964 Function IRB1_DataManInitBioSAXS()     
    965 
    966 
    967         string oldDf=GetDataFolder(1)
     986static Function IRB1_DataManInitBioSAXS()       
     987
     988        IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
     989        DfRef OldDf=GetDataFolderDFR()
    968990        string ListOfVariables
    969991        string ListOfStrings
     
    10471069//**************************************************************************************
    10481070
    1049 Function/T IRB1_ListBufferScans()
    1050 
    1051                 String AllDataFolders
    1052                 AllDataFolders=IR3C_MultiGenStringOfFolders("Irena:BioSAXSDataMan", "root:",0, 1,0, 0,1)
    1053                 //seelct only AVeraged data.
    1054                 AllDataFolders = GrepList(AllDataFolders, "ave", 0)
    1055                
    1056                 return AllDataFolders
    1057 end
    1058 
    1059 ///******************************************************************************************
    1060 ///******************************************************************************************
     1071static Function/T IRB1_ListBufferScans()
     1072
     1073        IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
     1074        String AllDataFolders
     1075        AllDataFolders=IR3C_MultiGenStringOfFolders("Irena:BioSAXSDataMan", "root:",0, 1,0, 0,1)
     1076        //seelct only AVeraged data.
     1077        AllDataFolders = GrepList(AllDataFolders, "ave", 0)
     1078       
     1079        return AllDataFolders
     1080end
     1081//**********************************************************************************************************
     1082//**********************************************************************************************************
     1083//**********************************************************************************************************
     1084
    10611085Function IRB1_SetVarProc(sva) : SetVariableControl
    10621086        STRUCT WMSetVariableAction &sva
     
    10801104        return 0
    10811105End
    1082 ///******************************************************************************************
    1083 ///******************************************************************************************
    1084 
     1106//**********************************************************************************************************
     1107//**********************************************************************************************************
     1108//**********************************************************************************************************
    10851109
    10861110Function IRB1_PopMenuProc(pa) : PopupMenuControl
     
    11081132///******************************************************************************************
    11091133
    1110 Function IR1B_DataManCopyAndScaleBuffer()
    1111 
     1134static Function IR1B_DataManCopyAndScaleBuffer()
     1135
     1136        IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
    11121137        DfRef OldDf=GetDataFolderDFR()
    11131138        SetDataFolder root:Packages:Irena:BioSAXSDataMan:
     
    11541179///******************************************************************************************
    11551180///******************************************************************************************
    1156 Function IRB1_DataManSubtractBufferMany()
    1157 
     1181static Function IRB1_DataManSubtractBufferMany()
     1182
     1183        IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
    11581184        DfRef OldDf=GetDataFolderDFR()
    11591185        SetDataFolder root:Packages:Irena:BioSAXSDataMan:
     
    11741200        SetDataFolder OldDf
    11751201end
    1176 ///******************************************************************************************
    1177 ///******************************************************************************************
    1178 ///******************************************************************************************
    1179 ///******************************************************************************************
    1180 ///******************************************************************************************
    1181 ///******************************************************************************************
    1182 Function IRB1_DataManScaleMany()
    1183 
     1202//**********************************************************************************************************
     1203//**********************************************************************************************************
     1204//**********************************************************************************************************
     1205
     1206static Function IRB1_DataManScaleMany()
     1207
     1208        IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
    11841209        DfRef OldDf=GetDataFolderDFR()
    11851210        SetDataFolder root:Packages:Irena:BioSAXSDataMan:
     
    12051230
    12061231
    1207 Function IRB1_DataManSubtractBufferOne()
    1208 
     1232static Function IRB1_DataManSubtractBufferOne()
     1233
     1234        IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
    12091235        DfRef OldDf=GetDataFolderDFR()
    12101236        SetDataFolder root:Packages:Irena:BioSAXSDataMan:
     
    13171343        setDataFOlder oldDf
    13181344end
    1319 
    1320 //**********************************************************************************************************
    1321 //**********************************************************************************************************
    1322 
    1323 Function IRB1_DataManScaleDataOne()
    1324 
     1345//**********************************************************************************************************
     1346//**********************************************************************************************************
     1347//**********************************************************************************************************
     1348
     1349static Function IRB1_DataManScaleDataOne()
     1350
     1351        IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
    13251352        DfRef OldDf=GetDataFolderDFR()
    13261353        SetDataFolder root:Packages:Irena:BioSAXSDataMan:
     
    14101437//**********************************************************************************************************
    14111438//**********************************************************************************************************
     1439//**********************************************************************************************************
     1440
Note: See TracChangeset for help on using the changeset viewer.