Ignore:
Timestamp:
Apr 22, 2016 5:02:30 PM (7 years ago)
Author:
srkline
Message:

lots of changes to plotting of q-values, generating fake data with non-linear corrections, masking of data, etc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/VC_UtilityProcedures.ipf

    r983 r993  
    406406                case "MT": 
    407407                case "MB": 
    408                         NVAR sdd_offset = gMiddle_SDDOffset     //T/B are 30 cm farther back 
     408                        NVAR sdd_offset = gMiddle_SDDOffset     //T/B are 300 mm farther back 
    409409                        break    
    410410                                                 
     
    432432// -- all of this needs to be done. There's nothing here... 
    433433// 
     434 
     435 
     436 
     437 
     438//////// function to take VCALC information and  
     439// fill in the simulated information as needed to make a "fake" data file 
     440// 
     441// TODO: 
     442// -- identify all of the necessary bits to change 
     443// -- maybe want a panel to make it easier to decide what inputs to change in the file 
     444// -- decide if it's better to write wholesale, or as individual waves 
     445// 
     446Macro Copy_VCALC_to_VSANSFile() 
     447         
     448        String fileName = V_DoSaveFileDialog("pick the file to write to") 
     449        print fileName 
     450//       
     451        if(strlen(fileName) > 0) 
     452                writeVCALC_to_file(fileName) 
     453        endif 
     454End 
     455 
     456// 
     457// TODO -- fill this in as needed to get fake data that's different 
     458// 
     459Function writeVCALC_to_file(fileName) 
     460        String fileName 
     461 
     462 
     463// the detectors, all 9 + the correct SDD (that accounts for the offset of T/B panels 
     464// the data itself (as INT32) 
     465// the front SDD (correct units) 
     466// the middle SDD (correct units) 
     467// the back SDD (correct units) 
     468        Variable ii,val 
     469        String detStr 
     470        for(ii=0;ii<ItemsInList(ksDetectorListAll);ii+=1) 
     471                detStr = StringFromList(ii, ksDetectorListAll, ";") 
     472                Duplicate/O $("root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_"+detStr+":det_"+detStr) tmpData 
     473                Redimension/I tmpData 
     474                tmpData = (tmpData ==   2147483647) ? 0 : tmpData               //the NaN "mask" in the sim data (T/B only)shows up as an ugly integer 
     475                V_writeDetectorData(fileName,detStr,tmpData) 
     476                 
     477                val = VCALC_getTopBottomSDDOffset(detStr)/10 + VCALC_getSDD(detStr)*100         // make sure value is in cm 
     478                print val 
     479                V_writeDet_distance(fileName,detStr,val) 
     480                 
     481                // x and y pixel sizes for each detector should be correct in the "base" file - but if not... 
     482                //Function VCALC_getPixSizeX(type)              // returns the pixel X size, in [cm] 
     483                //Function VCALC_getPixSizeY(type) 
     484                V_writeDet_x_pixel_size(fileName,detStr,VCALC_getPixSizeX(detStr)*10)           // data file is expecting mm 
     485                V_writeDet_y_pixel_size(fileName,detStr,VCALC_getPixSizeY(detStr)*10) 
     486         
     487                // write out the xCtr and yCtr (pixels) that was used in the q-calculation, done in VC_CalculateQFrontPanels() 
     488                V_writeDet_beam_center_x(fileName,detStr,V_getDet_beam_center_x("VCALC",detStr)) 
     489                V_writeDet_beam_center_y(fileName,detStr,V_getDet_beam_center_y("VCALC",detStr)) 
     490                 
     491                 
     492         
     493                // the calibration data for each detector (except B) is already correct in the "base" file 
     494                //V_writeDetTube_spatialCalib(fname,detStr,inW) 
     495                // and for "B" 
     496                //V_writeDet_cal_x(fname,detStr,inW) 
     497                //V_writeDet_cal_y(fname,detStr,inW) 
     498                 
     499                                 
     500                // the dead time for each detector is already correct in the "base" file 
     501                // V_writeDetector_deadtime(fname,detStr,inW) 
     502                // TODO: need a new, separate function to write the single deadtime value in/out of "B" 
     503 
     504        endfor 
     505         
     506         
     507//? other detector geometry - lateral separation? 
     508 
     509// the wavelength 
     510//      Variable lam = V_getWavelength("VCALC")         //doesn't work, the corresponding folder in VCALC has not been defined 
     511        V_writeWavelength(fileName,VCALC_getWavelength()) 
     512 
     513// description of the sample 
     514 
     515// sample information 
     516// name, title, etc 
     517         
     518// fake the information about the count setup, so I have different numbers to read 
     519// count time = fake time of 100 s 
     520        V_writeCount_time(fileName,100) 
     521 
     522// monitor count (= imon) 
     523// returns the number of neutrons on the sample 
     524//Function VCALC_getImon() 
     525 
     526// ?? anything else that I'd like to see on the catalog - I could change them here to see different values 
     527// different collimation types? 
     528// 
     529 
     530        return(0) 
     531end 
     532 
Note: See TracChangeset for help on using the changeset viewer.