Changeset 80


Ignore:
Timestamp:
Apr 10, 2007 12:40:42 PM (15 years ago)
Author:
srkline
Message:

Redefinition of SANS data reader functions (main entry points)
More commenting of NCNR_DataReadWrite.ipf

Location:
sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/AvgGraphics.ipf

    r76 r80  
    348348        DoWindow/F SANS_Data 
    349349        if(V_flag ==0) 
    350                 Abort "No SANS data. Use LoadSANSData to display a 2D data file" 
     350                Abort "No SANS data. Use'Display Raw Data' to display a 2D data file" 
    351351        Endif 
    352352        SetDrawLayer/K UserFront 
  • sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/MainPanel.ipf

    r76 r80  
    3030        String ctrlName 
    3131 
    32         LoadSANSData() 
     32        LoadRawSANSData("Select a Raw SANS data file") 
     33        UpdateDisplayInformation("RAW") 
    3334End 
    3435 
  • sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/NCNR_DataReadWrite.ipf

    r75 r80  
    2020 
    2121//simple, main entry procedure that will load a RAW sans data file (not a work file) 
    22 //into the RAW dataFolder 
    23 //(typically called from main panel button) 
    24 // 
    25 Proc LoadSANSData() 
    26         String msgStr = "Select a SANS data file" 
    27          
    28         Variable err 
    29         err = ReadBinarySANS(msgStr)            //will prompt for file 
    30         //ignore the error here  
    31 End 
    32  
    33  
    34 //function called by the main entry procedure 
    35 //sets global display variable, reads in the data, and displays it 
    36 //displays alert, and returns error if no file was selected 
    37 // 
    38 // calling routine must decide whether to abort the execution or not... 
    39 Function ReadBinarySANS(msgStr) 
     22//into the RAW dataFolder. It is up to the calling procedure to display the file 
     23// 
     24// called by MainPanel.ipf and ProtocolAsPanel.ipf 
     25// 
     26Function LoadRawSANSData(msgStr) 
    4027        String msgStr 
    4128 
     
    4633        PathInfo/S catPathName          //should set the next dialog to the proper path... 
    4734        //get the filename, then read it in 
    48         filename = PromptForPath(msgStr) 
     35        filename = PromptForPath(msgStr)                //in SANS_Utils.ipf 
    4936        //check for cancel from dialog 
    5037        if(strlen(filename)==0) 
     
    5744        ReadHeaderAndData(filename)     //this is the full Path+file 
    5845 
    59         //the calling macro must change the display type 
    60         String/G root:myGlobals:gDataDisplayType="RAW"          //displayed data type is raw 
    61          
    62         //data is displayed here 
    63         fRawWindowHook() 
     46///***** done by a call to UpdateDisplayInformation() 
     47//      //the calling macro must change the display type 
     48//      String/G root:myGlobals:gDataDisplayType="RAW"          //displayed data type is raw 
     49//       
     50//      //data is displayed here 
     51//      fRawWindowHook() 
    6452         
    6553        Return(0) 
    6654End 
     55 
    6756 
    6857//function that does the guts of reading the binary data file 
     
    7463//header information is put into three wave, integers,reals, and text 
    7564//logicals in the header are currently skipped, since they are no use in the  
    76 //data reduction process. the logicals, however are left untouched. 
     65//data reduction process. 
     66// 
     67// detector data is loaded into an array named "data" 
     68// 
     69// called by multiple ipfs (when the file name is known) 
    7770// 
    7871Function ReadHeaderAndData(fname) 
     
    344337         
    345338        //set the globals to the detector dimensions (pixels) 
    346         Variable/G root:myGlobals:gNPixelsX=128         //default for Ordela data (also set in Initialize.ipf) 
     339        Variable/G root:myGlobals:gNPixelsX=128         //default for Ordela data (also set in Initialize/NCNR_Utils.ipf) 
    347340        Variable/G root:myGlobals:gNPixelsY=128 
    348341//      if(cmpstr(textW[9],"ILL   ")==0)                //override if OLD Cerca data 
     
    368361//the input array (in) is larger than 16384 
    369362//(out) is 128x128 data (single precision) as defined in ReadHeaderAndData() 
     363// 
     364// local function to post-process compressed VAX binary data 
     365// 
    370366// 
    371367Function SkipAndDecompressVAX(in,out) 
     
    400396// little consequence. If you have individual pixel values on the detector that are that large, you need 
    401397// to re-think your experiment. 
     398// 
     399// local function to post-process compressed VAX binary data 
     400// 
     401// 
    402402Function Decompress(val) 
    403403        Variable val 
     
    424424//data is deposited in root:DIV data folder 
    425425// 
     426// local, currently unused 
     427// 
     428// 
    426429Proc ReadWork_DIV() 
    427430//      Silent 1 
     
    453456//this error seems to not be severe, but shoud be corrected (at great pain) 
    454457//************ 
     458// 
     459// called from ProtocolAsPanel.ipf 
     460// 
    455461// 
    456462Function ReadHeaderAndWork(type,fname) 
     
    811817//returns 1 if there was an error 
    812818// 
    813 // assumes a square detector 
     819// called by WorkFileUtils.ipf 
    814820// 
    815821Function ReadASCData(fname,destPath) 
     
    825831        Variable/G :gIsLogScale=0 
    826832        Make/O/T/N=(numHdrLines) hdrLines 
    827         Make/O/D/N=(num*num) data//,linear_data 
     833        Make/O/D/N=(pixelsX*pixelsY) data                       //,linear_data 
    828834         
    829835        //full filename and path is now passed in... 
     
    855861        Wave/Z temp0=temp0 
    856862        data=temp0 
    857         Redimension/N=(pixelsX,pixelsY) data//,linear_data 
     863        Redimension/N=(pixelsX,pixelsY) data            //,linear_data 
    858864         
    859865        //linear_data = data 
     
    868874 
    869875// fills the "default" fake header so that the SANS Reduction machinery does not have to be altered 
    870 // pay attention to what is/not to be trusted due to "fake" information 
     876// pay attention to what is/not to be trusted due to "fake" information. 
     877// uses what it can from the header lines from the ASC file (hdrLines wave) 
    871878// 
    872879// destFolder is of the form "myGlobals:WorkMath:AAA" 
     880// 
     881// 
     882// called by WorkFileUtils.ipf 
    873883// 
    874884Function FillFakeHeader_ASC(destFolder) 
     
    949959 
    950960 
    951  
    952  
    953  
    954  
    955 ////testing procedure that is not called anymore and is out-of-date 
    956 ////with the new data structures. update before re-implementing 
    957 //Proc ReadBinaryWork()         //this procedure is not called anymore 
    958 // 
    959 ////    Silent 1 
    960 //       
    961 //      //make sure the globals are reset properly 
    962 //      Variable/G root:myGlobals:gIsLogScale=0 //image is linearly scaled to begin with 
    963 //      String/G root:myGlobals:gDataDisplayType="RAW"          //displayed data type is raw 
    964 //       
    965 //      //each routine is responsible for checking the current (displayed) data folder 
    966 //      //selecting it, and returning to root when done 
    967 //       
    968 //      ReadHeaderAndWork() 
    969 // 
    970 //      SetDataFolder root:RAW 
    971 //      //data is displayed here 
    972 //      Display;AppendImage data 
    973 //       
    974 ////    Silent 0 
    975 //       
    976 //      //data folder was changed from root in this macro 
    977 //      SetDataFolder root: 
    978 //End 
    979  
    980  
    981 // 
    982  
    983  
    984  
    985961/////***************** 
    986962////unused testing procedure for writing a 4 byte floating point value in VAX format 
  • sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/ProtocolAsPanel.ipf

    r76 r80  
    14811481        do 
    14821482                if((cmpstr(samStr,"ask") == 0) || (cmpstr(samStr,"")==0) )              //zero if strings are equal 
    1483                         err = ReadBinarySANS(msgStr)            //will prompt for file 
     1483                        err = LoadRawSANSData(msgStr)           //will prompt for file 
    14841484                        if(err) 
    14851485                                PathInfo/S catPathName 
     
    14911491                                DoAlert 1,"Do you want to add another Sample file?" 
    14921492                                if(V_flag == 1)         //yes 
    1493                                         err = ReadBinarySANS(msgStr)            //will prompt for file 
     1493                                        err = LoadRawSANSData(msgStr)           //will prompt for file 
    14941494                                        if(err) 
    14951495                                                PathInfo/S catPathName 
     
    15281528        do 
    15291529                if(cmpstr(prot[0],"ask") == 0)          //zero if strings are equal 
    1530                         err = ReadBinarySANS(msgStr)            //will prompt for file 
     1530                        err = LoadRawSANSData(msgStr)           //will prompt for file 
    15311531                        if(err) 
    15321532                                PathInfo/S catPathName 
     
    15381538                                DoAlert 1,"Do you want to add another Background file?" 
    15391539                                if(V_flag == 1)         //yes 
    1540                                         err = ReadBinarySANS(msgStr)            //will prompt for file 
     1540                                        err = LoadRawSANSData(msgStr)           //will prompt for file 
    15411541                                        if(err) 
    15421542                                                PathInfo/S catPathName 
     
    15791579        do 
    15801580                if(cmpstr(prot[1],"ask") == 0) 
    1581                         err = ReadBinarySANS(msgStr)            //will prompt for file 
     1581                        err = LoadRawSANSData(msgStr)           //will prompt for file 
    15821582                        if(err) 
    15831583                                PathInfo/S catPathName 
     
    15891589                                DoAlert 1,"Do you want to add another Empty Cell file?" 
    15901590                                if(V_flag == 1)         //yes 
    1591                                         err = ReadBinarySANS(msgStr)            //will prompt for file 
     1591                                        err = LoadRawSANSData(msgStr)           //will prompt for file 
    15921592                                        if(err) 
    15931593                                                PathInfo/S catPathName 
     
    19741974                //ask for file and read it into RAW 
    19751975                //will cancel if no file is selected 
    1976                 err = ReadBinarySANS("select the empty beam file")              //reads and displays the RAW data 
     1976                err = LoadRawSANSData("select the empty beam file")             //reads and displays the RAW data 
    19771977                if(err) 
    19781978                        PathInfo/S catPathName 
Note: See TracChangeset for help on using the changeset viewer.