Ignore:
Timestamp:
Nov 16, 2015 4:18:33 PM (7 years ago)
Author:
srkline
Message:

more additions and corrections to the V_get and V_write functions

creating a folder (not root) for the raw data files to be loaded

File:
1 edited

Legend:

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

    r969 r970  
    16671667end 
    16681668 
    1669 Function V_writeCrystalnx_distance(fname,val) 
    1670         String fname 
    1671         Variable val 
    1672          
    1673 //      String path = "entry:instrument:beam:monochromator:crystal:nx_distance"  
     1669Function V_writeCrystalDistance(fname,val) 
     1670        String fname 
     1671        Variable val 
     1672         
     1673//      String path = "entry:instrument:beam:monochromator:crystal:distance"     
    16741674         
    16751675        Make/O/D/N=1 wTmpWrite 
    16761676//      Make/O/R/N=1 wTmpWrite 
    16771677        String groupName = "/entry/instrument/beam/monochromator/crystal"        
    1678         String varName = "nx_distance" 
     1678        String varName = "distance" 
    16791679        wTmpWrite[0] = val 
    16801680 
     
    18931893 
    18941894// instrument/beam/monochromator/velocity_selector (data folder) 
    1895 Function V_writeVSnx_distance(fname,val) 
    1896         String fname 
    1897         Variable val 
    1898          
    1899 //      String path = "entry:instrument:beam:monochromator:velocity_selector:nx_distance"        
     1895Function V_writeVSDistance(fname,val) 
     1896        String fname 
     1897        Variable val 
     1898         
     1899//      String path = "entry:instrument:beam:monochromator:velocity_selector:distance"   
    19001900         
    19011901        Make/O/D/N=1 wTmpWrite 
    19021902//      Make/O/R/N=1 wTmpWrite 
    19031903        String groupName = "/entry/instrument/beam/monochromator/velocity_selector"      
    1904         String varName = "nx_distance" 
     1904        String varName = "distance" 
    19051905        wTmpWrite[0] = val 
    19061906 
     
    25052505End 
    25062506 
    2507 Function V_writeBeamMonLownx_distance(fname,val) 
    2508         String fname 
    2509         Variable val 
    2510  
    2511 //      String path = "entry:instrument:beam_monitor_low:nx_distance" 
     2507Function V_writeBeamMonLowDistance(fname,val) 
     2508        String fname 
     2509        Variable val 
     2510 
     2511//      String path = "entry:instrument:beam_monitor_low:distance" 
    25122512         
    25132513        Make/O/D/N=1 wTmpWrite 
    25142514//      Make/O/R/N=1 wTmpWrite 
    25152515        String groupName = "/entry/instrument/beam_monitor_low"  
    2516         String varName = "nx_distance" 
     2516        String varName = "distance" 
    25172517        wTmpWrite[0] = val 
    25182518 
     
    26312631End 
    26322632 
    2633 Function V_writeBeamMonNormnx_distance(fname,val) 
    2634         String fname 
    2635         Variable val 
    2636  
    2637 //      String path = "entry:instrument:beam_monitor_norm:nx_distance" 
     2633Function V_writeBeamMonNormDistance(fname,val) 
     2634        String fname 
     2635        Variable val 
     2636 
     2637//      String path = "entry:instrument:beam_monitor_norm:distance" 
    26382638         
    26392639        Make/O/D/N=1 wTmpWrite 
    26402640//      Make/O/R/N=1 wTmpWrite 
    26412641        String groupName = "/entry/instrument/beam_monitor_norm"         
    2642         String varName = "nx_distance" 
     2642        String varName = "distance" 
    26432643        wTmpWrite[0] = val 
    26442644 
     
    27572757End 
    27582758 
    2759 Function V_writeBeamStop_x0(fname,val) 
     2759Function V_writeBeamStop_x_pos(fname,val) 
    27602760        String fname 
    27612761        Variable val 
     
    27662766//      Make/O/R/N=1 wTmpWrite 
    27672767        String groupName = "/entry/instrument/beam_stop"         
    2768         String varName = "x0" 
    2769         wTmpWrite[0] = val 
    2770  
    2771         variable err 
    2772         err = V_WriteWaveToHDF(fname, groupName, varName, wTmpWrite) 
    2773         if(err) 
    2774                 Print "HDF write err = ",err 
    2775         endif 
    2776         // now be sure to kill the data folder to force a re-read of the data next time this file is read in 
    2777         err = V_KillNamedDataFolder(fname) 
    2778         if(err) 
    2779                 Print "DataFolder kill err = ",err 
    2780         endif 
    2781         return(err) 
    2782 End 
    2783  
    2784 Function V_writeBeamStop_y0(fname,val) 
     2768        String varName = "x_pos" 
     2769        wTmpWrite[0] = val 
     2770 
     2771        variable err 
     2772        err = V_WriteWaveToHDF(fname, groupName, varName, wTmpWrite) 
     2773        if(err) 
     2774                Print "HDF write err = ",err 
     2775        endif 
     2776        // now be sure to kill the data folder to force a re-read of the data next time this file is read in 
     2777        err = V_KillNamedDataFolder(fname) 
     2778        if(err) 
     2779                Print "DataFolder kill err = ",err 
     2780        endif 
     2781        return(err) 
     2782End 
     2783 
     2784Function V_writeBeamStop_y_pos(fname,val) 
    27852785        String fname 
    27862786        Variable val 
     
    27912791//      Make/O/R/N=1 wTmpWrite 
    27922792        String groupName = "/entry/instrument/beam_stop"         
    2793         String varName = "y0" 
     2793        String varName = "y_pos" 
    27942794        wTmpWrite[0] = val 
    27952795 
     
    29452945// only defined for the "B" detector, and may not be necessary? 
    29462946// TODO -- write to return an ARRAY 
    2947 Function V_writeDet_CALX(fname,detStr,inW) 
     2947Function V_writeDet_cal_x(fname,detStr,inW) 
    29482948        String fname,detStr 
    29492949        Wave inW 
     
    29582958        // -- May also need to check the dimension(s) before writing (don't trust the input) 
    29592959                String groupName = "/entry/instrument/detector_"+detStr  
    2960                 String varName = "CALX" 
     2960                String varName = "cal_x" 
    29612961 
    29622962                variable err 
     
    29782978// only defined for the "B" detector, and may not be necessary? 
    29792979// TODO -- write to return an ARRAY 
    2980 Function V_writeDet_CALY(fname,detStr,inW) 
     2980Function V_writeDet_cal_y(fname,detStr,inW) 
    29812981        String fname,detStr 
    29822982        Wave inW 
     
    29912991        // -- May also need to check the dimension(s) before writing (don't trust the input) 
    29922992                String groupName = "/entry/instrument/detector_"+detStr  
    2993                 String varName = "CALY" 
     2993                String varName = "cal_y" 
    29942994 
    29952995                variable err 
     
    30123012// so the FHWM will be different in each direction. May need to return 
    30133013// "dummy" value for "B" detector if pixels there are square 
    3014 Function V_writeDet_PixelFWHM_X(fname,detStr,val) 
     3014Function V_writeDet_pixel_fwhm_x(fname,detStr,val) 
    30153015        String fname,detStr 
    30163016        Variable val 
    30173017 
    3018 //      String path = "entry:instrument:detector_"+detStr+":PixelFWHM_X" 
     3018//      String path = "entry:instrument:detector_"+detStr+":pixel_fwhm_x" 
    30193019         
    30203020        Make/O/D/N=1 wTmpWrite 
    30213021//      Make/O/R/N=1 wTmpWrite 
    30223022        String groupName = "/entry/instrument/detector_"+detStr  
    3023         String varName = "PixelFWHM_X" 
     3023        String varName = "pixel_fwhm_x" 
    30243024        wTmpWrite[0] = val 
    30253025 
     
    30413041// so the FHWM will be different in each direction. May need to return 
    30423042// "dummy" value for "B" detector if pixels there are square 
    3043 Function V_writeDet_PixelFWHM_Y(fname,detStr,val) 
     3043Function V_writeDet_pixel_fwhm_y(fname,detStr,val) 
    30443044        String fname,detStr 
    30453045        Variable val 
    30463046 
    3047 //      String path = "entry:instrument:detector_"+detStr+":PixelFWHM_Y" 
     3047//      String path = "entry:instrument:detector_"+detStr+":pixel_fwhm_y" 
    30483048         
    30493049        Make/O/D/N=1 wTmpWrite 
    30503050//      Make/O/R/N=1 wTmpWrite 
    30513051        String groupName = "/entry/instrument/detector_"+detStr  
    3052         String varName = "PixelFWHM_Y" 
    3053         wTmpWrite[0] = val 
    3054  
    3055         variable err 
    3056         err = V_WriteWaveToHDF(fname, groupName, varName, wTmpWrite) 
    3057         if(err) 
    3058                 Print "HDF write err = ",err 
    3059         endif 
    3060         // now be sure to kill the data folder to force a re-read of the data next time this file is read in 
    3061         err = V_KillNamedDataFolder(fname) 
    3062         if(err) 
    3063                 Print "DataFolder kill err = ",err 
    3064         endif 
    3065         return(err) 
    3066 End 
    3067  
    3068  
    3069 Function V_writeDet_PixelNumX(fname,detStr,val) 
     3052        String varName = "pixel_fwhm_y" 
     3053        wTmpWrite[0] = val 
     3054 
     3055        variable err 
     3056        err = V_WriteWaveToHDF(fname, groupName, varName, wTmpWrite) 
     3057        if(err) 
     3058                Print "HDF write err = ",err 
     3059        endif 
     3060        // now be sure to kill the data folder to force a re-read of the data next time this file is read in 
     3061        err = V_KillNamedDataFolder(fname) 
     3062        if(err) 
     3063                Print "DataFolder kill err = ",err 
     3064        endif 
     3065        return(err) 
     3066End 
     3067 
     3068 
     3069Function V_writeDet_pixel_num_x(fname,detStr,val) 
    30703070        String fname,detStr 
    30713071        Variable val 
    30723072 
    3073 //      String path = "entry:instrument:detector_"+detStr+":PixelNumX" 
     3073//      String path = "entry:instrument:detector_"+detStr+":pixel_nnum_x" 
    30743074         
    30753075        Make/O/D/N=1 wTmpWrite 
    30763076//      Make/O/R/N=1 wTmpWrite 
    30773077        String groupName = "/entry/instrument/detector_"+detStr  
    3078         String varName = "PixelNumX" 
    3079         wTmpWrite[0] = val 
    3080  
    3081         variable err 
    3082         err = V_WriteWaveToHDF(fname, groupName, varName, wTmpWrite) 
    3083         if(err) 
    3084                 Print "HDF write err = ",err 
    3085         endif 
    3086         // now be sure to kill the data folder to force a re-read of the data next time this file is read in 
    3087         err = V_KillNamedDataFolder(fname) 
    3088         if(err) 
    3089                 Print "DataFolder kill err = ",err 
    3090         endif 
    3091         return(err) 
    3092 End 
    3093  
    3094 Function V_writeDet_PixelNumY(fname,detStr,val) 
     3078        String varName = "pixel_num_x" 
     3079        wTmpWrite[0] = val 
     3080 
     3081        variable err 
     3082        err = V_WriteWaveToHDF(fname, groupName, varName, wTmpWrite) 
     3083        if(err) 
     3084                Print "HDF write err = ",err 
     3085        endif 
     3086        // now be sure to kill the data folder to force a re-read of the data next time this file is read in 
     3087        err = V_KillNamedDataFolder(fname) 
     3088        if(err) 
     3089                Print "DataFolder kill err = ",err 
     3090        endif 
     3091        return(err) 
     3092End 
     3093 
     3094Function V_writeDet_pixel_num_y(fname,detStr,val) 
    30953095        String fname,detStr 
    30963096        Variable val 
    30973097 
    3098 //      String path = "entry:instrument:detector_"+detStr+":PixelNumY" 
     3098//      String path = "entry:instrument:detector_"+detStr+":pixel_num_y" 
    30993099         
    31003100        Make/O/D/N=1 wTmpWrite 
    31013101//      Make/O/R/N=1 wTmpWrite 
    31023102        String groupName = "/entry/instrument/detector_"+detStr  
    3103         String varName = "PixelNumY" 
     3103        String varName = "pixel_num_y" 
    31043104        wTmpWrite[0] = val 
    31053105 
     
    41474147        endif 
    41484148        return(err) 
    4149 End              
     4149End      
     4150 
     4151 
     4152///////  sample_aperture_2 (data folder) 
     4153 
     4154Function V_writeSampleAp2_Description(fname,str) 
     4155        String fname,str 
     4156 
     4157//      String path = "entry:instrument:sample_aperture_2:description" 
     4158 
     4159        Make/O/T/N=1 tmpTW 
     4160        String groupName = "/entry/instrument/sample_aperture_2" 
     4161        String varName = "description" 
     4162        tmpTW[0] = str // 
     4163 
     4164        variable err 
     4165        err = V_WriteTextWaveToHDF(fname, groupName, varName, tmpTW) 
     4166        if(err) 
     4167                Print "HDF write err = ",err 
     4168        endif 
     4169         
     4170        // now be sure to kill the data folder to force a re-read of the data next time this file is read in 
     4171        err = V_KillNamedDataFolder(fname) 
     4172        if(err) 
     4173                Print "DataFolder kill err = ",err 
     4174        endif 
     4175                 
     4176        return(err) 
     4177End 
     4178 
     4179Function V_writeSampleAp2_distance(fname,val) 
     4180        String fname 
     4181        Variable val 
     4182 
     4183//      String path = "entry:instrument:sample_aperture_2:distance" 
     4184         
     4185        Make/O/D/N=1 wTmpWrite 
     4186//      Make/O/R/N=1 wTmpWrite 
     4187        String groupName = "/entry/instrument/sample_aperture_2" 
     4188        String varName = "distance" 
     4189        wTmpWrite[0] = val 
     4190 
     4191        variable err 
     4192        err = V_WriteWaveToHDF(fname, groupName, varName, wTmpWrite) 
     4193        if(err) 
     4194                Print "HDF write err = ",err 
     4195        endif 
     4196        // now be sure to kill the data folder to force a re-read of the data next time this file is read in 
     4197        err = V_KillNamedDataFolder(fname) 
     4198        if(err) 
     4199                Print "DataFolder kill err = ",err 
     4200        endif 
     4201        return(err) 
     4202End 
     4203//      shape (data folder) 
     4204 
     4205Function V_writeSampleAp2_shape(fname,str) 
     4206        String fname,str 
     4207 
     4208//      String path = "entry:instrument:sample_aperture_2:shape:shape" 
     4209 
     4210        Make/O/T/N=1 tmpTW 
     4211        String groupName = "/entry/instrument/sample_aperture_2/shape" 
     4212        String varName = "shape" 
     4213        tmpTW[0] = str // 
     4214 
     4215        variable err 
     4216        err = V_WriteTextWaveToHDF(fname, groupName, varName, tmpTW) 
     4217        if(err) 
     4218                Print "HDF write err = ",err 
     4219        endif 
     4220         
     4221        // now be sure to kill the data folder to force a re-read of the data next time this file is read in 
     4222        err = V_KillNamedDataFolder(fname) 
     4223        if(err) 
     4224                Print "DataFolder kill err = ",err 
     4225        endif 
     4226                 
     4227        return(err) 
     4228End 
     4229 
     4230// TODO -- this needs to return a WAVE, since the shape may be circle, or rectangle 
     4231// and will need to return more than a single dimension 
     4232// TODO -- be careful of the UNITS 
     4233Function V_writeSampleAp2_size(fname,inW) 
     4234        String fname 
     4235        Wave inW 
     4236 
     4237//      String path = "entry:instrument:sample_aperture_2:shape:size" 
     4238 
     4239        Duplicate/O inW wTmpWrite        
     4240// then use redimension as needed to cast the wave to write to the specified type 
     4241// see WaveType for the proper codes  
     4242//      Redimension/T=() wTmpWrite 
     4243// -- May also need to check the dimension(s) before writing (don't trust the input) 
     4244        String groupName = "/entry/instrument/sample_aperture_2/shape"   
     4245        String varName = "size" 
     4246 
     4247        variable err 
     4248        err = V_WriteWaveToHDF(fname, groupName, varName, wTmpWrite) 
     4249        if(err) 
     4250                Print "HDF write err = ",err 
     4251        endif 
     4252        // now be sure to kill the data folder to force a re-read of the data next time this file is read in 
     4253        err = V_KillNamedDataFolder(fname) 
     4254        if(err) 
     4255                Print "DataFolder kill err = ",err 
     4256        endif 
     4257        return(err) 
     4258End      
     4259 
    41504260                 
    41514261//////  sample_table (data folder) 
     
    48404950        Wave inW 
    48414951         
    4842 //      String path = "entry:sample:"+logstr+":value_log:nx_time" 
     4952//      String path = "entry:sample:"+logstr+":value_log:time" 
    48434953 
    48444954        Duplicate/O inW wTmpWrite        
     
    48484958// -- May also need to check the dimension(s) before writing (don't trust the input) 
    48494959        String groupName = "/entry/sample/"+logStr+"/value_log"  
    4850         String varName = "nx_time" 
     4960        String varName = "time" 
    48514961 
    48524962        variable err 
Note: See TracChangeset for help on using the changeset viewer.