Changeset 955


Ignore:
Timestamp:
Jun 3, 2020 3:54:22 PM (2 years ago)
Author:
ilavsky
Message:

Fixes to bioSAXS

Location:
trunk/User Procedures/Irena
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/User Procedures/Irena/IR1_Main.ipf

    r952 r955  
    325325        WindowProcNames+="UnifiedEvaluationPanel=IR2U_MainCheckVersion;FractalAggregatePanel=IR3A_MainCheckVersion;TwoPhaseSystems=IR3T_MainCheckVersion;"
    326326        WindowProcNames+="POVPDBPanel=IR3P_MainCheckVersion;AnisotropicSystemsPanel=IR3N_MainCheckVersion;IR3L_MultiSamplePlotPanel=IR3L_MainCheckVersion;"
    327         WindowProcNames+="IR1I_ImportBioSAXSASCIIData=IR1B_ImportASCIIMainCheckVersion;IRB1_DataManipulationPanel=IRB1_DataManMainCheckVersion;"
     327        WindowProcNames+="IRB1_ImportBioSAXSASCIIData=IRB1_ImpASCIIMainCheckVer;IRB1_DataManipulationPanel=IRB1_DataManMainCheckVersion;"
    328328        WindowProcNames+="IRB1_ATSASInterfacePanel=IR1B_PDDFMainCheckVersion;IR3J_SimpleFitsPanel=IR1B_SimpleFitsMainCheckVersion;IR3B_MetadataBrowserPanel=IR3B_MainCheckVersion;"
    329329 
    330330        IR2C_CheckWIndowsProcVersions(WindowProcNames)
    331         IR2C_CheckIrenaUpdate(0)
     331        IR2C_CheckIrenaUpdate(0) 
    332332        IN2G_CheckPlatformGUIFonts()
    333333        IN2G_ResetSizesForALlPanels(WindowProcNames)
  • trunk/User Procedures/Irena/IRB1_bioSAXS.ipf

    r942 r955  
    1010//* in the file LICENSE that is included with this distribution.
    1111//*************************************************************************/
    12 constant IRB1_ImpBioSAXSASCIIVer = 0.1                  //IRB1_ImportBioSAXSASCIIData tool version number.
     12constant IRB1_ImpBioSAXSASCIIVer = 0.2                  //IRB1_ImportBioSAXSASCIIData tool version number.
    1313constant IRB1_DataManipulation = 0.1                                                    //IRB1_DataManipulation tool version number.
    1414constant IRB1_SetVariableStepScaling = 0.01                                     //this is fraction of the value to which the step in SetVariable is set. 
     
    1616//functions for bioSAXS community
    1717//
    18 //version summary
     18//version summary 
    1919//0.1 early beta version
    2020
     
    4343        IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
    4444        IN2G_CheckScreenSize("height",720)
    45         DoWindow IR1I_ImportBioSAXSASCIIData
     45        DoWindow IRB1_ImportBioSAXSASCIIData
    4646        if(V_Flag)
    47                 DoWindow/F IR1I_ImportBioSAXSASCIIData
     47                DoWindow/F IRB1_ImportBioSAXSASCIIData
    4848        else
    4949                //intit first
     
    5757//************************************************************************************************************
    5858Function IRB1_ImpASCIIMainCheckVer()   
    59         DoWindow IR1I_ImportBioSAXSASCIIData
     59        DoWindow IRB1_ImportBioSAXSASCIIData
    6060        if(V_Flag)
    61                 if(!IR1_CheckPanelVersionNumber("IR1I_ImportBioSAXSASCIIData", IRB1_ImpBioSAXSASCIIVer))
     61                if(!IR1_CheckPanelVersionNumber("IRB1_ImportBioSAXSASCIIData", IRB1_ImpBioSAXSASCIIVer))
    6262                        DoAlert /T="The Import ASCII panel was created by incorrect version of Irena " 1, "Import ASCII tool needa to be restarted to work properly. Restart now?"
    6363                        if(V_flag==1)
    64                                 KillWIndow/Z IR1I_ImportBioSAXSASCIIData
     64                                KillWIndow/Z IRB1_ImportBioSAXSASCIIData
    6565                                IRB1_ImportASCII()
    6666                        else            //at least reinitialize the variables so we avoid major crashes...
     
    220220
    221221        CheckBox QvectorInnm,pos={240,250},size={16,14},proc=IRB1_CheckProc,title="Convert Q from [1/nm]?",variable= root:Packages:Irena:ImportBioSAXSData:QvectorInnm,mode=0, help={"Irena uses Angstroms, if data Q vector is in 1/nm, check here."}
     222       
     223        CheckBox KeepExtension,pos={240,280},size={16,14},noproc,title="Keep extension with name?",variable= root:Packages:Irena:ImportBioSAXSData:KeepExtension,mode=0, help={"Include extension in data name, for example if avg ot sub."}
    222224
    223225
     
    324326        NVAR WAXSData= root:Packages:Irena:ImportBioSAXSData:WAXSData
    325327        NVAR GroupSamplesTogether       =       root:Packages:Irena:ImportBioSAXSData:GroupSamplesTogether
     328        NVAR KeepExtension = root:Packages:Irena:ImportBioSAXSData:KeepExtension
    326329        KillWindow/Z TestImportGraph
    327330        PathInfo ImportDataPath
     
    348351                        setDataFolder BaseFolder
    349352                        selectedfile = WaveOfFiles[i]
    350                         SelectedFileName = RemoveEnding(RemoveListItem(ItemsInList(selectedfile,".")-1, selectedfile,"."),".")
     353                        if(KeepExtension)
     354                                SelectedFileName = ReplaceString(".", selectedfile, "_") //this will simply repalce "." with "_" to prevent issues for Igor pro
     355                        else
     356                                SelectedFileName = RemoveEnding(RemoveListItem(ItemsInList(selectedfile,".")-1, selectedfile,"."),".")
     357                        endif
    351358                        //now make assumption about sample name, we can group samples together.
    352359                        if(GroupSamplesTogether)
    353360                                SelectedSampleName = RemoveEnding(RemoveListItem(ItemsInList(selectedfile,"_")-1, selectedfile,"_"),"_")
    354361                                SelectedSampleName = CleanupName(SelectedSampleName,1)
    355                                 SelectedFileName = CleanupName(SelectedFileName, 1)
    356362                                //create and move into the SampleFolder
    357363                                if(strlen(SelectedSampleName)>1)                //cases, when name cannot be deduced in above level.
     
    359365                                endif
    360366                        endif
     367                        SelectedFileName = CleanupName(SelectedFileName, 1)
    361368                        //now folder for the specific imported ASCII file
    362369                        NewDataFolder/O/S $((SelectedFileName))
     
    417424        ListOfVariables = "UseFileNameAsFolder;UseIndra2Names;UseQRSNames;DataContainErrors;UseQISNames;"
    418425        ListOfVariables += "SAXSData;WAXSdata;GroupSamplesTogether;QvectorInnm;"       
    419 //      ListOfVariables += "CreateSQRTErrors;Col1Int;Col1Qvec;Col1Err;Col1QErr;FoundNWaves;"   
     426        ListOfVariables += "KeepExtension;"     
    420427//      ListOfVariables += "QvectInA;QvectInNM;QvectInDegrees;CreateSQRTErrors;CreatePercentErrors;PercentErrorsToUse;"
    421428//      ListOfVariables += "ScaleImportedData;ScaleImportedDataBy;ImportSMRdata;SkipLines;SkipNumberOfLines;"   
     
    561568       
    562569        //tab 2 controls
    563         TitleBox AverageInstructions3 title="\Zr1201. Pick Buffer folder (ave) : ",size={330,15},pos={270,175},frame=0,fColor=(0,0,65535),labelBack=0
    564         PopupMenu SelectBufferData,pos={262,200},size={180,20},fStyle=2,proc=IRB1_PopMenuProc,title=" "
     570        TitleBox AverageInstructions3 title="\Zr1201. Pick Buffer folder (ave) : ",size={330,15},pos={270,170},frame=0,fColor=(0,0,65535),labelBack=0
     571        SetVariable BufferMatchString,pos={270,195},size={200,15}, noproc,title="Buffer Match (RegEx)", proc=IRB1_SetVarProc
     572        Setvariable BufferMatchString, variable=root:Packages:Irena:BioSAXSDataMan:BufferMatchString
     573        PopupMenu SelectBufferData,pos={262,220},size={180,20},fStyle=2,proc=IRB1_PopMenuProc,title=" "
    565574        SVAR SelectedBufferFolder = root:Packages:Irena:BioSAXSDataMan:SelectedBufferFolder
    566575        PopupMenu SelectBufferData,mode=1,popvalue=SelectedBufferFolder,value= IRB1_ListBufferScans()
    567         TitleBox AverageInstructions7 title="\Zr1202. Add data (double click) ",size={330,15},pos={270,225},frame=0,fColor=(0,0,65535),labelBack=0
    568         TitleBox AverageInstructions8 title="\Zr1203. Tweak scaling ",size={330,15},pos={270,250},frame=0,fColor=(0,0,65535),labelBack=0
    569 
    570         SetVariable BufferScalingFraction,pos={270,275},size={220,15}, proc=IRB1_SetVarProc,title="Scale buffer =", noedit=0, frame=1, limits={0,10,0.002}
     576        TitleBox AverageInstructions7 title="\Zr1202. Add data (double click) ",size={330,15},pos={270,245},frame=0,fColor=(0,0,65535),labelBack=0
     577        TitleBox AverageInstructions8 title="\Zr1203. Tweak scaling ",size={330,15},pos={270,265},frame=0,fColor=(0,0,65535),labelBack=0
     578
     579        SetVariable BufferScalingFraction,pos={270,290},size={220,15}, proc=IRB1_SetVarProc,title="Scale buffer =", noedit=0, frame=1, limits={0,10,0.002}
    571580        Setvariable BufferScalingFraction, variable=root:Packages:Irena:BioSAXSDataMan:BufferScalingFraction, bodyWidth=100
    572581
    573         Button SubtractBuffer,pos={280,300},size={190,20}, proc=IRB1_DataManButtonProc,title="4. Subtract Buffer & Save", help={"Subtract Buffer from data and save with _sub in name"}
    574         TitleBox AverageInstructions9 title="\Zr120Or, select many and process all ",size={330,15},pos={270,350},frame=0,fColor=(0,0,65535),labelBack=0
    575         Button SubtractBufferMany,pos={280,375},size={190,20}, proc=IRB1_DataManButtonProc,title="Sub. Buffer On Selected", help={"Subtract Buffer from all selected data and save with _sub in name"}
    576 
    577         TitleBox AverageInstructions4 title="\Zr120Input Data Name : ",size={245,15},pos={270,410},frame=0,fColor=(0,0,65535),labelBack=0
    578         SetVariable UserSourceDataFolderName,pos={280,430},size={245,15}, noproc,variable=root:Packages:Irena:BioSAXSDataMan:UserSourceDataFolderName
     582        Button SubtractBuffer,pos={280,320},size={190,20}, proc=IRB1_DataManButtonProc,title="4. Subtract Buffer & Save", help={"Subtract Buffer from data and save with _sub in name"}
     583        TitleBox AverageInstructions9 title="\Zr130Or, select many and process all ",size={330,15},pos={270,365},frame=0,fColor=(0,0,65535),labelBack=0
     584        Button SubtractBufferMany,pos={280,395},size={190,20}, proc=IRB1_DataManButtonProc,title="Sub. Buffer On Selected", help={"Subtract Buffer from all selected data and save with _sub in name"}
     585
     586        TitleBox AverageInstructions4 title="\Zr120Input Data Name : ",size={245,15},pos={270,430},frame=0,fColor=(0,0,65535),labelBack=0
     587        SetVariable UserSourceDataFolderName,pos={280,450},size={245,15}, noproc,variable=root:Packages:Irena:BioSAXSDataMan:UserSourceDataFolderName
    579588        SetVariable UserSourceDataFolderName, title=" ", limits={0,0,0}, noedit=1, frame=0
    580         TitleBox AverageInstructions5 title="\Zr120Buffer Data Name : ",size={245,15},pos={270,460},frame=0,fColor=(0,0,65535),labelBack=0
    581         SetVariable UserBufferDataFolderName,pos={280,480},size={245,15}, noproc,variable=root:Packages:Irena:BioSAXSDataMan:UserBufferDataFolderName
     589        TitleBox AverageInstructions5 title="\Zr120Buffer Data Name : ",size={245,15},pos={270,480},frame=0,fColor=(0,0,65535),labelBack=0
     590        SetVariable UserBufferDataFolderName,pos={280,500},size={245,15}, noproc,variable=root:Packages:Irena:BioSAXSDataMan:UserBufferDataFolderName
    582591        SetVariable UserBufferDataFolderName, title=" ", limits={0,0,0}, noedit=1, frame=0
    583         TitleBox AverageInstructions6 title="\Zr120Output Data Name : ",size={245,15},pos={270,510},frame=0,fColor=(0,0,65535),labelBack=0
    584         SetVariable SubtractedOutputFldrName,pos={280,530},size={245,15}, noproc,variable=root:Packages:Irena:BioSAXSDataMan:SubtractedOutputFldrName
     592        TitleBox AverageInstructions6 title="\Zr120Output Data Name : ",size={245,15},pos={270,530},frame=0,fColor=(0,0,65535),labelBack=0
     593        SetVariable SubtractedOutputFldrName,pos={280,550},size={245,15}, noproc,variable=root:Packages:Irena:BioSAXSDataMan:SubtractedOutputFldrName
    585594        SetVariable SubtractedOutputFldrName, title=" ", limits={0,0,0}, noedit=1, frame=0
    586595
     
    659668                                PopupMenu SelectBufferData,win=IRB1_DataManipulationPanel, disable=(tab!=1)
    660669                                SetVariable BufferScalingFraction,win=IRB1_DataManipulationPanel, disable=(tab!=1)
     670                                SetVariable BufferMatchString,win=IRB1_DataManipulationPanel, disable=(tab!=1)
    661671                                Button SubtractBuffer,win=IRB1_DataManipulationPanel, disable=(tab!=1)
    662672                                Button SubtractBufferMany,win=IRB1_DataManipulationPanel, disable=(tab!=1)
     
    969979        AverageOutputFolderString = RemoveListItem(ItemsInList(tempStr,"_")-1, tempStr, "_") +"ave"
    970980        IR3C_SelectWaveNamesData("Irena:BioSAXSDataMan", FolderNameStr)                 //this routine will preset names in strings as needed,
    971 //      DataFolderName = DataStartFolder+FolderNameStr
    972 //      QWavename = stringFromList(0,IR2P_ListOfWaves("Xaxis","", "IRB1_DataManipulationPanel"))
    973 //      IntensityWaveName = stringFromList(0,IR2P_ListOfWaves("Yaxis","*", "IRB1_DataManipulationPanel"))
    974 //      ErrorWaveName = stringFromList(0,IR2P_ListOfWaves("Error","*", "IRB1_DataManipulationPanel"))
    975 //      if(UseIndra2Data)
    976 //              dQWavename = ReplaceString("Qvec", QWavename, "dQ")
    977 //      elseif(UseQRSdata)
    978 //              dQWavename = "w"+QWavename[1,31]
    979 //      else
    980 //              dQWavename = ""
    981 //      endif
    982981        Wave/Z SourceIntWv=$(DataFolderName+IntensityWaveName)
    983982        Wave/Z SourceQWv=$(DataFolderName+QWavename)
     
    990989                //preset for user output name for merged data
    991990                UserSourceDataFolderName = StringFromList(ItemsInList(FolderNameStr, ":")-1, FolderNameStr, ":")
    992                 SubtractedOutputFldrName = ReplaceString("_ave", UserSourceDataFolderName, "_sub")
     991                if(StringMatch(UserSourceDataFolderName, "*_ave"))
     992                        SubtractedOutputFldrName = ReplaceString("_ave", UserSourceDataFolderName, "_sub")
     993                elseif(StringMatch(UserSourceDataFolderName, "*_avg"))
     994                        SubtractedOutputFldrName = ReplaceString("_avg", UserSourceDataFolderName, "_sub")
     995                else
     996                        SubtractedOutputFldrName = RemoveEnding(UserSourceDataFolderName, ":") +"_sub" 
     997                endif
    993998                //remove, if needed, all data from graph
    994999                IN2G_RemoveDataFromGraph(topGraphStr = "IRB1_DataManipulationPanel#LogLogDataDisplay")
     
    10501055        //here define the lists of variables and strings needed, separate names by ;...
    10511056        ListOfStrings="DataFolderName;IntensityWaveName;QWavename;ErrorWaveName;dQWavename;DataUnits;"
    1052         ListOfStrings+="DataStartFolder;DataMatchString;FolderSortString;FolderSortStringAll;"
     1057        ListOfStrings+="DataStartFolder;DataMatchString;BufferMatchString;FolderSortString;FolderSortStringAll;"
    10531058        ListOfStrings+="UserMessageString;SavedDataMessage;UserSourceDataFolderName;UserBufferDataFolderName;"
    10541059        ListOfStrings+="AverageOutputFolderString;SelectedBufferFolder;SubtractedOutputFldrName;"
     
    10881093                endif
    10891094        endfor         
     1095        SVAR BufferMatchString
     1096        if(strlen(BufferMatchString)<1)
     1097                BufferMatchString="(?i)Buf"
     1098        endif
    10901099        SVAR SelectedBufferFolder
    10911100        if(strlen(SelectedBufferFolder)<2)
     
    11231132        String AllDataFolders
    11241133        AllDataFolders=IR3C_MultiGenStringOfFolders("Irena:BioSAXSDataMan", "root:",0, 1,0, 0,1)
    1125         //seelct only AVeraged data.
    1126         AllDataFolders = GrepList(AllDataFolders, "ave", 0)
    1127        
     1134        SVAR BufferMatchString=root:Packages:Irena:BioSAXSDataMan:BufferMatchString
     1135        //select only Averaged data.
     1136        if(strlen(BufferMatchString)>0)
     1137                AllDataFolders = GrepList(AllDataFolders, BufferMatchString, 0)
     1138        endif
    11281139        return AllDataFolders
    11291140end
     
    13491360
    13501361        String OutFldrNm, OutXWvNm, OutYWvNm,OutEWvNm
    1351         OutFldrNm = ReplaceString("_ave", SourceFolderName, "_sub")
     1362        if(StringMatch(SourceFolderName, "*_ave:"))
     1363                OutFldrNm = ReplaceString("_ave", SourceFolderName, "_sub")
     1364        elseif(StringMatch(SourceFolderName, "*_avg:"))
     1365                OutFldrNm = ReplaceString("_avg", SourceFolderName, "_sub")
     1366        else
     1367                OutFldrNm = RemoveEnding(SourceFolderName, ":") +"_sub"
     1368        endif
    13521369        string FirstFolderShortName=StringFromList(ItemsInList(OutFldrNm, ":")-1, OutFldrNm, ":")
    13531370        string OutputWaveNameMain = RemoveListItem(ItemsInList(FirstFolderShortName,"_")-1, FirstFolderShortName, "_") +"sub"
Note: See TracChangeset for help on using the changeset viewer.