Changeset 914


Ignore:
Timestamp:
Apr 6, 2020 9:18:55 PM (2 years ago)
Author:
ilavsky
Message:

Metadata Browser is now quite functional and relatively stable.

Location:
trunk/User Procedures
Files:
4 edited

Legend:

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

    r913 r914  
    3838                //added         IN2G_RemoveDataFromGraph(topGraphStr = "IRB1_ATSASInterfacePanel#DataDisplay")
    3939                //fix IN2G_ResetSizesForAllPanels so it does not busticate panels which cannot be scaled (Bio tools) and do not have scaling information
     40                //              improved all panel scaling support, so it now scales embedded graphs. 
    4041                //add IN2G_DuplGraphInPanelSubwndw(String gname)                which recreates graph from panel as separate graph. Return this: DupWindwFromPanel
    4142                //added IN2G_ForceDeleteFolder(fullPathToFolder)        - this is dangerous function which deletes a folder with no questions asked on user computer. Provided by AC from WM.
     43                //added IN2G_ConvertTimeStringToSecs(instring) converts various string type times into real time in seconds
    4244//2.21 added bunch of formating tools for graphs:
    4345                //IN2G_OffsetTopGrphTraces(LogXAxis, XOffset ,LogYAxis, YOffset)
     
    124126
    125127//This is list of procedures with short description.
    126 
    127 
     128//IN2G_DuplGraphInPanelSubwndw(String gname)            which recreates graph from panel as separate graph. Return this: DupWindwFromPanel
     129//
     130//IN2G_ForceDeleteFolder(fullPathToFolder)      - this is dangerous function which deletes a folder with no questions asked on user computer. Provided by AC from WM.
     131//
     132//IN2G_ConvertTimeStringToSecs(instring)                -- return time in seconds from those formats below. Can be extended if needed.
     133//                                                      ISO format, without time zone String instring   // format     2013-10-02T01:22:35  (the seconds are optional)
     134//                                                      YYYY-MM-DD hh:mm,     //"2019-06-20 13:44:26.555304"
     135//                                                      Fri Jun 21 00:28:59 2019
     136//
    128137//IN2G_RemoveDataFromGraph(topGraphStr = "IRB1_ATSASInterfacePanel#DataDisplay")               
    129138//                                      removes all data from a graph, cleans it up. Needed for graphs in inserts of panesl
     
    593602//************************************************************************************************
    594603
     604threadsafe Function IN2G_ConvertTimeStringToSecs(instring)
     605    String instring
     606    //what strings?
     607    Variable year, month, day,hour,minute,second
     608    string WeekdayStr, MonthStr
     609         Variable N, UTC
     610        //      ISO format, without time zone String instring   // format     2013-10-02T01:22:35  (the seconds are optional)
     611        sscanf instring,"%4d-%2d-%2dT%2d:%2d:%2d", year,month,day,hour,minute,second
     612        N=V_flag
     613        if (N>5)
     614                UTC = date2secs(year, month, day )
     615                UTC += N>=4 ? hour*3600 : 0
     616                UTC += N>=5 ? minute*60 : 0
     617                UTC += N>=6 ? second : 0
     618                return UTC
     619        endif
     620        //YYYY-MM-DD hh:mm,     //"2019-06-20 13:44:26.555304"
     621    sscanf instring, "%4d%*[-]%2d%*[-]%2d%*[ ] %2d%*[:] %2d%*[:]%9f", year, month, day,hour,minute,second
     622    N=V_flag
     623    if(N>5)
     624                UTC = date2secs(year, month, day )
     625                UTC += N>=4 ? hour*3600 : 0
     626                UTC += N>=5 ? minute*60 : 0
     627                UTC += N>=6 ? second : 0
     628                return UTC
     629        endif
     630        //Fri Jun 21 00:28:59 2019
     631    sscanf instring, "%3s%*[ ]%3s%*[ ]%2d%*[ ] %2d%*[:] %2d%*[:]%2d%*[ ]%4d", WeekdayStr, MonthStr, day, hour, minute, second, year
     632    N=V_flag
     633    if(N>5)
     634        strswitch(MonthStr)     
     635                case "Jan":     // execute if case matches expression
     636                        month=1
     637                        break           // exit from switch
     638                case "Feb":     // execute if case matches expression
     639                        month=2
     640                        break           // exit from switch
     641                case "Mar":     // execute if case matches expression
     642                        month=3
     643                        break           // exit from switch
     644                case "Apr":     // execute if case matches expression
     645                        month=4
     646                        break           // exit from switch
     647                case "May":     // execute if case matches expression
     648                        month=5
     649                        break           // exit from switch
     650                case "Jun":     // execute if case matches expression
     651                        month=6
     652                        break           // exit from switch
     653                case "Jul":     // execute if case matches expression
     654                        month=7
     655                        break           // exit from switch
     656                case "Aug":     // execute if case matches expression
     657                        month=8
     658                        break           // exit from switch
     659                case "Sep":     // execute if case matches expression
     660                        month=9
     661                        break           // exit from switch
     662                case "Oct":     // execute if case matches expression
     663                        month=10
     664                        break           // exit from switch
     665                case "Nov":     // execute if case matches expression
     666                        month=11
     667                        break           // exit from switch
     668                case "Dec":     // execute if case matches expression
     669                        month=12
     670                        break           // exit from switch
     671        endswitch
     672                UTC = date2secs(year, month, day )
     673                UTC += N>=4 ? hour*3600 : 0
     674                UTC += N>=5 ? minute*60 : 0
     675                UTC += N>=6 ? second : 0
     676                return UTC
     677        endif
     678        //default, return NaN so we can treat this as non-time string.
     679        return NaN
     680end
     681//************************************************************************************************
     682//************************************************************************************************
     683       
     684       
    595685threadsafe Function IN2G_FindNumericalIndexForSorting(StrnameIn)
    596686        string StrnameIn
  • trunk/User Procedures/Irena/IR1_Main.ipf

    r912 r914  
    32383238        ListOfWindows += "ModelingII_Results;LSQF_IQ4vsQGraph;IR2L_ResSmearingPanel;IR1P_MoreToolsPanel;IR1R_SizeDistImportFitPanel;"
    32393239        ListOfWindows += "TwoPhaseSystemData;TwoPhaseSolidGizmo;TwoPhaseSystems;FractalAggregatePanel;MassFractalAggregateView;TwoPhaseSolid2DImage;"
    3240         ListOfWindows += "IR3D_DataMergePanel;"
     3240        ListOfWindows += "IR3D_DataMergePanel;IRB1_PDDFInterfacePanel;IR3J_SimpleFitsPanel;IRB1_DataManipulationPanel;IR3J_LinDataDisplay;"
     3241        ListOfWindows += "IR3L_MultiSamplePlotPanel;IR3J_LogLogDataDisplay;IR3L_MultiSamplePlotPanel;IRB1_ImportBioSAXSASCIIData;"
    32413242       
    32423243       
  • trunk/User Procedures/Irena/IR2_DataMiner.ipf

    r913 r914  
    203203        ListBox NoteItemsSelection,proc=IR3B_MultiListBoxProc
    204204       
    205         TitleBox Instructions11 title="\Zr100Double click to add item to list",size={330,15},pos={280,680},frame=0,fColor=(0,0,65535),labelBack=0
    206         TitleBox Instructions21 title="\Zr100Use Regex to display less",size={330,15},pos={280,695},frame=0,fColor=(0,0,65535),labelBack=0
    207         //TitleBox Instructions31 title="\Zr100Regex for not contain: ^((?!string).)*$",size={330,15},pos={280,710},frame=0,fColor=(0,0,65535),labelBack=0
    208         //TitleBox Instructions41 title="\Zr100Regex for contain:  string, two: str2.*str1",size={330,15},pos={280,725},frame=0,fColor=(0,0,65535),labelBack=0
    209         //TitleBox Instructions51 title="\Zr100Regex for case independent:  (?i)string",size={330,15},pos={280,740},frame=0,fColor=(0,0,65535),labelBack=0
    210         TitleBox Instructions61 title="\Zr100https://www.rexegg.com/regex-quickstart.html",size={330,15},pos={280,755},frame=0,fColor=(0,0,65535),labelBack=0
     205        TitleBox Instructions11 title="\Zr100Use Regex to display less",size={330,15},pos={280,680},frame=0,fColor=(0,0,65535),labelBack=0
     206        TitleBox Instructions21 title="\Zr100https://www.rexegg.com/regex-quickstart.html",size={330,15},pos={280,695},frame=0,fColor=(0,0,65535),labelBack=0
     207        TitleBox Instructions31 title="\Zr100Double click to add item to list on right",size={330,15},pos={280,710},frame=0,fColor=(0,0,65535),labelBack=0
     208        TitleBox Instructions41 title="\Zr100Select range of Data and use following to graph:",size={330,15},pos={280,725},frame=0,fColor=(0,0,65535),labelBack=0
     209        TitleBox Instructions51 title="\Zr100ctrl/cmd+Double click to graph selection",size={330,15},pos={280,740},frame=0,fColor=(0,0,65535),labelBack=0
     210        //TitleBox Instructions61 title="\Zr100",size={330,15},pos={280,755},frame=0,fColor=(0,0,65535),labelBack=0
    211211
    212212        //selected data
     
    219219        ListBox SeletectedItems,proc=IR3B_MultiListBoxProc
    220220        TitleBox Instructions12 title="\Zr100Double click to remove item from list",size={330,15},pos={550,440},frame=0,fColor=(0,0,65535),labelBack=0
    221 
    222         TitleBox Instructions13 title="\Zr100Select where and extract data",size={330,15},pos={550,460},frame=0,fColor=(0,0,65535),labelBack=0
    223 
    224 
    225         SetVariable SaveToFoldername,pos={525,490},size={260,20}, noproc,title="\Zr120Save to:"
     221        Button DeleleAllSelected,pos={540,460},size={220,15}, proc=IR3B_ButtonProc,title="Remove all selected", help={"Remove all selected above."}
     222
     223        TitleBox Instructions13 title="\Zr100Select where and extract data : ",size={330,15},pos={530,500},frame=0,fColor=(0,0,65535),labelBack=0
     224
     225
     226        SetVariable SaveToFoldername,pos={525,530},size={260,20}, noproc,title="\Zr120Save to:"
    226227        Setvariable SaveToFoldername,fStyle=2, variable=root:Packages:Irena:MetadataBrowser:SaveToFoldername, help={"Where to store saved metadata"}
    227228
    228         Button ExtractDataInWave,pos={540,530},size={220,20}, proc=IR3B_ButtonProc,title="Process Selected folders", help={"Extract above listed metadata as waves and save"}
    229                 //      Button ExportGraphJPG,pos={450,680},size={140,20}, proc=IR3L_ButtonProc,title="Export as jpg", help={"Export as jpg file"}
    230                 //      Button ExportGraphTIF,pos={450,705},size={140,20}, proc=IR3L_ButtonProc,title="Export as tiff", help={"Export as tiff file"}
    231                 //      Button SaveGraphAsFile,pos={450,730},size={140,20}, proc=IR3L_ButtonProc,title="Export as pxp", help={"Save Graph As Igor experiment"}
     229        Button ExtractDataInWave,pos={540,570},size={220,20}, proc=IR3B_ButtonProc,title="Process Selected folders", help={"Extract above listed metadata as waves and save"}
     230        Button DisplayDataInTable,pos={540,595},size={220,20}, proc=IR3B_ButtonProc,title="Display results in Table", help={"Create table with extracted data"}
     231        Button DisplayDataInBrowser,pos={540,620},size={220,20}, proc=IR3B_ButtonProc,title="Display results in Data Browser", help={"Open Igor Data Browser and show folder with extracted data"}
     232
     233        PopupMenu PlotXWave,pos={530,645},size={120,20},proc=IR3B_PopMenuProc, title="X : ",help={"Select Wave to use as x wave to plot"}
     234        PopupMenu PlotXWave,value="---;"+IR3B_ListResultsWaves(),mode=1
     235        PopupMenu PlotYWave,pos={530,668},size={120,20},proc=IR3B_PopMenuProc, title="Y : ",help={"Select Wave to use as y wave to plot"}
     236        PopupMenu PlotYWave,value="---;"+IR3B_ListResultsWaves(),mode=1
     237
     238        Button PlotDataForUser,pos={680,645},size={100,45}, proc=IR3B_ButtonProc,title="Plot \rSelected", help={"Open Igor Data Browser and show folder with extracted data"}
     239
     240        TitleBox Instructions45 title="\Zr100Remove stored results from Save to folder :",size={330,15},pos={545,735},frame=0,fColor=(0,0,65535),labelBack=0
     241        Button DeleleDataFromFolder,pos={580,755},size={150,15}, proc=IR3B_ButtonProc,title="Delete old results", fColor=(43690,43690,43690),labelBack=0, help={"Delete data in the folder previously extracted."}
     242
    232243end
    233244//**********************************************************************************************************
    234245//**********************************************************************************************************
     246Function/T IR3B_ListResultsWaves()
     247        SVAR df=root:Packages:Irena:MetadataBrowser:SaveToFoldername
     248        return IN2G_CreateListOfItemsInFolder(df,2)
     249end
     250//**********************************************************************************************************
    235251//**********************************************************************************************************
    236252
     
    238254        STRUCT WMButtonAction &ba
    239255
     256        IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
    240257        variable i
    241258        string FoldernameStr
     
    245262                        if(cmpstr(ba.ctrlname,"ExtractDataInWave")==0)
    246263                                IR3B_ExtractMetadataFromList()
     264                                IR3B_DisplayMetadataResults()
    247265                        endif
    248                         break
     266                        if(cmpstr(ba.ctrlname,"DeleleAllSelected")==0)
     267                                Wave/T ListWave=root:Packages:Irena:MetadataBrowser:SeletectedItems
     268                                Wave selWave=root:Packages:Irena:MetadataBrowser:SelectionOfSelectedItems
     269                                Redimension/N=1 ListWave, selWave
     270                        endif
     271
     272                        if(cmpstr(ba.ctrlname,"PlotDataForUser")==0)
     273                                IR3B_PlotSelectedResults()
     274                        endif
     275                        if(cmpstr(ba.ctrlname,"DeleleDataFromFolder")==0)
     276                                IR3B_DeleteMetadataResults()
     277                        endif
     278                        if(cmpstr(ba.ctrlname,"DisplayDataInTable")==0)
     279                                IR3B_DisplayMetadataResults()
     280                        endif
     281                        if(cmpstr(ba.ctrlname,"DisplayDataInBrowser")==0)
     282                                SVAR FldrWithData=root:Packages:Irena:MetadataBrowser:SaveToFoldername
     283                                CreateBrowser
     284                                ModifyBrowser  setDataFolder=FldrWithData, showWaves=1                                                 
     285                        endif
    249286                        if(cmpstr(ba.ctrlname,"GetHelp")==0)
    250287                                //Open www manual with the right page
    251288                                IN2G_OpenWebManual("Irena/DataManipulation.html")
    252289                        endif
     290                        break
    253291                case -1: // control being killed
    254292                        break
     
    263301        STRUCT WMPopupAction &pa
    264302
     303        IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
    265304        String ctrlName=Pa.ctrlName
    266305        Variable popNum=Pa.popNum
     
    286325        STRUCT WMSetVariableAction &sva
    287326
     327        IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
    288328        variable tempP
    289329        switch( sva.eventCode )
     
    328368                        break
    329369                case 3: // double click
    330                         if(stringmatch(lba.ctrlName,"NoteItemsSelection"))
    331                                 IR3B_AddToSelectedItems(listWave[row],1)
     370                        if(lba.eventMod==3 || lba.eventMod==9)  // double click + shift or ctrl/cmd
     371                                IR3B_DisplayTestMetadataValues(listWave[row])
    332372                        endif
    333                         if(stringmatch(lba.ctrlName,"SeletectedItems"))
    334                                 IR3B_AddToSelectedItems(listWave[row],0)
     373                       
     374                        if(lba.eventMod==1)     //normal double click
     375                                if(stringmatch(lba.ctrlName,"NoteItemsSelection"))
     376                                        IR3B_AddToSelectedItems(listWave[row],1)
     377                                endif
     378                                if(stringmatch(lba.ctrlName,"SeletectedItems"))
     379                                        IR3B_AddToSelectedItems(listWave[row],0)
     380                                endif
    335381                        endif
    336382                        break
     
    350396//**************************************************************************************
    351397//**************************************************************************************
    352 Function IR3B_AddToSelectedItems(ItemToAddorRemove,Add)
     398
     399static Function IR3B_DisplayMetadataResults()
     400
     401        IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
     402        DfRef OldDf=GetDataFolderDFR()
     403        SVAR FldrWithData=root:Packages:Irena:MetadataBrowser:SaveToFoldername
     404        SetDataFolder $(FldrWithData)                                   //go into the folder
     405        string ListOfWaves=IN2G_ConvertDataDirToList(DataFolderDir(2))
     406        KillWIndow/Z MetadataBrowserResTable
     407        variable i, NumWaves
     408        string TmpNameStr
     409        if(strlen(ListOfWaves)>2)
     410                Edit/W=(423,162,902,874)/K=1/N=MetadataBrowserResTable  as "Table of extracted Metadata"
     411                NumWaves = ItemsInList(ListOfWaves)
     412                for(i=0;i<NumWaves;i+=1)
     413                        TmpNameStr = stringFromList(i,ListOfWaves)
     414                        AppendToTable /W=MetadataBrowserResTable $(TmpNameStr)
     415                        ModifyTable title($TmpNameStr)=TmpNameStr
     416                endfor
     417                ModifyTable/W=MetadataBrowserResTable alignment=2, autosize={0, 0, -1, 0, 0 }
     418                //now we need to make it wide enough, if possible...
     419                variable TotalWidth=100
     420                For(i=0;i<NumWaves;i+=1)
     421                        TotalWidth+=NumberByKey("WIDTH", TableInfo("MetadataBrowserResTable", i))
     422                endfor
     423                TotalWidth = min(TotalWidth,900)
     424                MoveWindow /W=MetadataBrowserResTable 250,162, 250+TotalWidth, 874             
     425        endif
     426        setDataFolder OldDF
     427end
     428
     429//**************************************************************************************
     430//**************************************************************************************
     431
     432
     433static Function IR3B_DeleteMetadataResults()
     434
     435        IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
     436        DfRef OldDf=GetDataFolderDFR()
     437        DoAlert/T="Are you sure???" 1, "Extracted metadata waves will be deleted, are you REALLY sure you want to do this?"
     438        if(V_Flag)
     439                SVAR FldrWithData=root:Packages:Irena:MetadataBrowser:SaveToFoldername
     440                SetDataFolder $(FldrWithData)                                   //go into the folder
     441                KillWIndow/Z MetadataBrowserResTable
     442                KillWaves /A/Z
     443                string ListOfWaves=IN2G_ConvertDataDirToList(DataFolderDir(2))
     444                variable i
     445                if(strlen(ListOfWaves)>2)       //could nto be deleted... Hm, at least redimension to N=0
     446                        for(i=0;i<ItemsInList(ListOfWaves);i+=1)
     447                                Wave tmpWv= $(stringFromList(i,ListOfWaves))
     448                                redimension/N=0 tmpWv
     449                        endfor
     450                endif
     451                //clean up popups...
     452                PopupMenu PlotXWave win=IR3B_MetadataBrowserPanel, mode=1
     453                PopupMenu PlotYWave win=IR3B_MetadataBrowserPanel, mode=1
     454
     455        endif
     456        setDataFolder OldDF
     457end
     458//**************************************************************************************
     459//**************************************************************************************
     460static Function IR3B_PlotSelectedResults()
     461
     462        IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
     463        DfRef OldDf=GetDataFolderDFR()
     464        //get needed values...
     465        ControlInfo/W=IR3B_MetadataBrowserPanel PlotXWave
     466        string XwaveNm=S_Value
     467        ControlInfo/W=IR3B_MetadataBrowserPanel PlotYWave
     468        string YwaveNm=S_Value
     469        SVAR FldrWithData=root:Packages:Irena:MetadataBrowser:SaveToFoldername
     470        string FldrWithDataStr=RemoveEnding(FldrWithData, ":")+":"
     471        Wave/Z Xwave = $(FldrWithDataStr+XwaveNm)
     472        Wave/Z Ywave = $(FldrWithDataStr+YwaveNm)
     473        string NewGraphName="MetadataBrowserResultsPlot"
     474        NewGraphName = UniqueName(NewGraphName, 6, 0)
     475        if(WaveExists(Xwave)&&WaveExists(Ywave))
     476                Display/K=1/N=$(NewGraphName)/W=(423,162,1293,747) Ywave vs Xwave
     477                ModifyGraph mirror=1, mode=4, marker=19
     478                Label left YwaveNm
     479                Label bottom XwaveNm
     480        endif
     481        setDataFolder OldDF     
     482end
     483//**************************************************************************************
     484//**************************************************************************************
     485static Function IR3B_AddToSelectedItems(ItemToAddorRemove,Add)
    353486        string ItemToAddorRemove
    354487        variable Add                    //Add=1 to add, 0 to remove
    355488
     489        IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
    356490        string KeyName=StringFromList(0, ItemToAddorRemove, "=")
    357491        Wave/T listWave=root:Packages:Irena:MetadataBrowser:SeletectedItems
     
    400534//**********************************************************************************************************
    401535//**********************************************************************************************************
     536static Function         IR3B_DisplayTestMetadataValues(ParameterSelected)
     537        string ParameterSelected
     538               
     539        IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
     540        DfRef OldDf=GetDataFolderDFR()
     541        SetDataFolder root:Packages:Irena:MetadataBrowser                                       //go into the folder
     542        string KeyName=StringFromList(0, ParameterSelected, "=")
     543       
     544        Wave/T ListOfAvailableData=root:Packages:Irena:MetadataBrowser:ListOfAvailableData
     545        Wave SelectionOfAvailableData=root:Packages:Irena:MetadataBrowser:SelectionOfAvailableData
     546        variable i, imax=numpnts(ListOfAvailableData)
     547        make/Free/T/N=(1+sum(SelectionOfAvailableData)/8) TempStrValues
     548        variable j=0, TimeInSeconds
     549        For(i=0;i<imax;i+=1)
     550                if(SelectionOfAvailableData[i])
     551                        print "Extracting data from "+ListOfAvailableData[i]
     552                        TempStrValues[j] = IR3B_FindSpecificMetadata(ListOfAvailableData[i], KeyName)   
     553                        j+=1
     554                endif   
     555        endfor
     556        //now we need to decide, if these are numbers...
     557        KillWindow/Z MetadataBrowserTempGraph
     558        KillWindow/Z MetadataBrowsertempTable
     559        if(GrepString(TempStrValues[0], "^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$"))            //this si number
     560                Make/O/N=(numpnts(TempStrValues)) $(CleanupName(KeyName, 0, 25)+"TmpWv")
     561                Wave ResultsWv=$(CleanupName(KeyName, 0, 25)+"TmpWv")
     562                ResultsWv = str2num(TempStrValues[p])
     563                Display/W=(423,162,1293,747)/K=1/N=MetadataBrowserTempGraph ResultsWv as "Temporary display of selected parameter"
     564                ModifyGraph mirror=1, mode=4, marker=19
     565                Label left KeyName
     566                Label bottom "Sample Order"
     567        else
     568                TimeInSeconds = IN2G_ConvertTimeStringToSecs(TempStrValues[0])
     569                if(numtype(TimeInSeconds)==0)           //looks like time!
     570                        Make/O/N=(numpnts(TempStrValues)) $(CleanupName(KeyName, 0, 22)+"TmpTimeWv")
     571                        Wave ResultsTimeWv=$(CleanupName(KeyName, 0, 22)+"TmpTimeWv")
     572                        ResultsTimeWv = IN2G_ConvertTimeStringToSecs(TempStrValues[p])
     573                        Display/W=(423,162,1293,747)/K=1/N=MetadataBrowserTempGraph ResultsTimeWv as "Temporary display of selected parameter"
     574                        ModifyGraph mirror=1, mode=4, marker=19
     575                        Label left KeyName
     576                        Label bottom "Sample Order"
     577                else            //ok, this is really string now...
     578                        Make/O/N=(numpnts(TempStrValues))/T $(CleanupName(KeyName, 0, 22)+"TmpStrWv")
     579                        Wave/T ResultsStrWv=$(CleanupName(KeyName, 0, 25)+"TmpStrWv")
     580                        ResultsStrWv = TempStrValues[p]
     581                        Edit/W=(423,162,902,874)/K=1/N=MetadataBrowsertempTable ResultsStrWv as "Temporary Display of selected parameter"
     582                        ModifyTable format(Point)=1,width($nameofwave(ResultsStrWv))=208
     583                        ModifyTable title($nameofwave(ResultsStrWv))=KeyName
     584                        ModifyTable/W=MetadataBrowsertempTable alignment=2, autosize={0, 0, -1, 0, 0 }
     585                endif
     586        endif
     587        setDataFolder OldDF
     588end
    402589//**********************************************************************************************************
    403590//**********************************************************************************************************
    404 
    405 
    406 Function IR3B_ExtractMetadataFromList()
     591static Function/T IR3B_FindSpecificMetadata(FolderNameStr, KeyString)   
     592        string FolderNameStr, KeyString
     593
     594        IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
     595        SVAR DataFolderName=root:Packages:Irena:MetadataBrowser:DataFolderName
     596        SVAR IntensityWaveName=root:Packages:Irena:MetadataBrowser:IntensityWaveName
     597        string result=""
     598        if(strlen(FolderNameStr)>0)                                             //if strlen(FolderNameStr)=0, this is called from other other and all is set here...
     599                IR3C_SelectWaveNamesData("Irena:MetadataBrowser", FolderNameStr)                        //this routine will preset names in strings as needed
     600        endif
     601        Wave/Z SourceIntWv=$(DataFolderName+IntensityWaveName)
     602        if(!WaveExists(SourceIntWv))
     603                DoAlert /T="Incorrectly defined data type" 0, "Please, check definition of data type, it seems incorrectly defined yet"
     604                SetDataFolder oldDf
     605                abort
     606        endif
     607        string CurrentNote=note(SourceIntWv)
     608        result = StringByKey(KeyString, CurrentNote, "=", ";")
     609        return result
     610end
     611//**********************************************************************************************************
     612//**********************************************************************************************************
     613
     614
     615static Function IR3B_ExtractMetadataFromList()
    407616       
    408617        Wave/T ListOfAvailableData=root:Packages:Irena:MetadataBrowser:ListOfAvailableData
     
    411620        For(i=0;i<imax;i+=1)
    412621                if(SelectionOfAvailableData[i])
    413                         print "Extracting data from "+ListOfAvailableData[i]
     622                        //print "Extracting data from "+ListOfAvailableData[i]
    414623                        IR3B_ExtractMetadataFromOneFolder(ListOfAvailableData[i])
    415624                endif   
     
    417626        print "Extracted data from "+num2str(sum(SelectionOfAvailableData))+"   folder with data"
    418627end
    419 
    420 Function IR3B_ExtractMetadataFromOneFolder(FolderNameStr)
     628//**********************************************************************************************************
     629//**********************************************************************************************************
     630static Function IR3B_ExtractMetadataFromOneFolder(FolderNameStr)
    421631        string FolderNameStr
    422632
     
    428638        SVAR DataFolderName=root:Packages:Irena:MetadataBrowser:DataFolderName
    429639        SVAR IntensityWaveName=root:Packages:Irena:MetadataBrowser:IntensityWaveName
    430 //      if(DataFolderExists(SaveToFoldername))
    431 //              Abort "This data folder exists, change the name. Improve me to allow overwrite here"
    432 //      else
    433640        NewDataFOlder/O/S $(SaveToFoldername)
    434 //      endif
    435 
    436        
    437641        //to decide if this value is number of string...
    438642        //print GrepString("Sample1", "^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$")
    439643        // prints 1 for number, 0 for string.
    440        
    441644        if(strlen(FolderNameStr)>0)             //if strlen(FolderNameStr)=0, this is called from other otherols and all is set here...
    442645                IR3C_SelectWaveNamesData("Irena:MetadataBrowser", FolderNameStr)                        //this routine will preset names in strings as needed
     
    453656        Wave/T listofItemsWave=root:Packages:Irena:MetadataBrowser:SeletectedItems     
    454657        variable i, imax=numpnts(listofItemsWave)
     658        variable TimeInSeconds
    455659        string KeyString, ValueString, CleanKeyName
    456660        Wave/Z/T FolderNameWv
     
    500704                //done with special name based waves...
    501705                else            ///all others.
    502                         if(GrepString(ValueString, "^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$"))         //thsi si number
     706                        if(GrepString(ValueString, "^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$"))         //this si number
    503707                                CleanKeyName = CleanupName(KeyString, 0, 31)
    504708                                Wave/Z TmpWv=$(CleanKeyName)
     
    509713                                Redimension/N=(NumberOfExtractedItems+1) TmpWv
    510714                                TmpWv[NumberOfExtractedItems] = str2num(ValueString)
    511                         else    //string, may be add handling of dates later.
    512                                 CleanKeyName = CleanupName(KeyString, 0, 31)
    513                                 Wave/Z/T TmpStrWv=$(CleanKeyName)
    514                                 if(!WaveExists(TmpStrWv))
    515                                         Make/O/N=(NumberOfExtractedItems+1)/T $(CleanKeyName)
     715                        else                                            //string, check if not date...
     716                                TimeInSeconds = IN2G_ConvertTimeStringToSecs(ValueString)
     717                                if(numtype(TimeInSeconds)==0)           //looks like time!
     718                                        CleanKeyName = CleanupName(KeyString, 0, 24)+"Time"
     719                                        Wave/Z TmpTimeWv=$(CleanKeyName)
     720                                        if(!WaveExists(TmpStrWv))
     721                                                Make/O/N=(NumberOfExtractedItems+1) $(CleanKeyName)
     722                                        endif
     723                                        Wave TmpTimeWv=$(CleanKeyName)
     724                                        Redimension/N=(NumberOfExtractedItems+1) TmpTimeWv
     725                                        TmpTimeWv[NumberOfExtractedItems] = TimeInSeconds
     726                                else            //ok, this is really string now...
     727                                        CleanKeyName = CleanupName(KeyString, 0, 31)
     728                                        Wave/Z/T TmpStrWv=$(CleanKeyName)
     729                                        if(!WaveExists(TmpStrWv))
     730                                                Make/O/N=(NumberOfExtractedItems+1)/T $(CleanKeyName)
     731                                        endif
     732                                        Wave/T TmpStrWv=$(CleanKeyName)
     733                                        Redimension/N=(NumberOfExtractedItems+1) TmpStrWv
     734                                        TmpStrWv[NumberOfExtractedItems] = ValueString
    516735                                endif
    517                                 Wave/T TmpStrWv=$(CleanKeyName)
    518                                 Redimension/N=(NumberOfExtractedItems+1) TmpStrWv
    519                                 TmpStrWv[NumberOfExtractedItems] = ValueString
    520736                        endif
    521737                endif
     
    531747
    532748
    533 Function IR3B_IdentifyNameComponent(NameStr, whichComp)
     749static Function IR3B_IdentifyNameComponent(NameStr, whichComp)
    534750                string NameStr, whichComp               //"_xyzC",  _xyzmin, _xyzpct, _xyz
    535751               
     
    626842//**********************************************************************************************************
    627843
    628 Function IR3B_InitMetadataBrowser()     
     844static Function IR3B_InitMetadataBrowser()     
    629845        IN2G_PrintDebugStatement(IrenaDebugLevel, 5,"")
    630846        DfRef OldDf=GetDataFolderDFR()
  • trunk/User Procedures/Irena/IR2_PanelCntrlProcs.ipf

    r912 r914  
    36043604        SVAR SelectedResultsType
    36053605        SVAR ResultsGenerationToUse
    3606         if(strlen(SelectedResultsTool)<1)
     3606        if(strlen(SelectedResultsTool)<1 || strlen(SelectedResultsType)<1)
    36073607                SelectedResultsTool="Unified Fit"
    36083608                SelectedResultsType="UnifiedFitIntensity"
    36093609        endif
    3610         if(strlen(SelectedResultsTool)<1)
    3611                 SelectedResultsTool=IR2C_ReturnKnownToolResults(SelectedResultsTool)
    3612         endif
     3610//      if(strlen(SelectedResultsTool)<1)
     3611//              SelectedResultsTool=IR2C_ReturnKnownToolResults(SelectedResultsTool)
     3612//      endif
    36133613        if(strlen(ResultsGenerationToUse)<1)
    36143614                ResultsGenerationToUse="Latest"
Note: See TracChangeset for help on using the changeset viewer.