Ignore:
Timestamp:
Mar 15, 2012 11:11:10 AM (11 years ago)
Author:
srkline
Message:

adding another utility procedure to the Real-Space Modeling. FFT_FillTests.ipf contains some examples of how to build different geometries and script the calculations, especially save/load of previously defined structures.

Location:
sans/Dev/trunk/NCNR_User_Procedures/Analysis/Alpha/Tinker
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • sans/Dev/trunk/NCNR_User_Procedures/Analysis/Alpha/Tinker/FFT_Panel.ipf

    r844 r846  
    1212//               rather than "1" 
    1313// 
     14// 
     15// -- incorporate utility function that reads the wave note from a binary file  
     16//                      Function/S LoadNoteFunc(PName,FName[,FileRef]) - use this as an "inspector?" 
    1417//////////// 
    1518 
     
    196199                endif                    
    197200                 
     201                Print "Loaded matrix parameters = ",str 
    198202                Execute "NumberOfPoints()" 
    199203                         
    200204        return(0) 
    201205end 
     206 
     207// utility function that reads the wave note from a binary file 
     208// 
     209Function/S LoadNoteFunc(PName,FName[,FileRef]) 
     210        String PName, FName 
     211        Variable FileRef 
     212         
     213        Variable noteStart, noteLength, version, dependLength 
     214        String noteStr, typeStr = ".ibw" 
     215        if (ParamIsDefault(FileRef)) 
     216                Open/R/P=$PName/T=typeStr fileRef, as FName     //open the file 
     217        endif 
     218        FSetPos fileRef, 0 
     219        FBinRead/F=2 fileRef, version 
     220         
     221         
     222        if (version == 5) 
     223         
     224                FSetPos fileRef, 4 
     225                Make/N=(3)/I/Free SizeWave 
     226                FBinRead FileRef,SizeWave 
     227                noteStart = SizeWave[0] 
     228                DependLength = SizeWave[1] 
     229                NoteLength = SizeWave[2] 
     230                noteStart += dependLength+64 
     231                 
     232        elseif (version == 2) 
     233         
     234                FBinRead/F=3 fileRef, noteStart 
     235//              FBinRead/F=4 fileRef, dependLength 
     236                FBinRead/F=3 fileRef, noteLength 
     237                noteStart += 16 
     238                 
     239        else 
     240         
     241                if (ParamIsDefault(FileRef)) 
     242                        Close(FileRef)          //close the file 
     243                endif 
     244                return "" 
     245         
     246        endif 
     247        if (!NoteLength) 
     248                if (ParamIsDefault(FileRef)) 
     249                        Close(FileRef)          //close the file 
     250                endif 
     251                return("") 
     252        endif 
     253        FSetPos fileRef, noteStart 
     254        NoteStr = PadString("",NoteLength,0) 
     255        FBinRead FileRef,NoteStr 
     256         
     257        if (ParamIsDefault(FileRef)) 
     258                Close(FileRef)          //close the file 
     259        endif 
     260        return noteStr 
     261         
     262End //LoadNoteFunc 
     263 
    202264 
    203265Function FFTHelpButton(ba) : ButtonControl 
Note: See TracChangeset for help on using the changeset viewer.