Changeset 1220


Ignore:
Timestamp:
Jul 18, 2022 8:51:25 PM (2 months ago)
Author:
ilavsky
Message:

Import data handle weird ASCII encodings (force UTF-8) and minor fixes

Location:
trunk/User Procedures
Files:
3 edited

Legend:

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

    r1180 r1220  
    13751375                variable start = max(0,center - (center -PeakCenterFitStartPoint) *3 )
    13761376                variable end1 = min(center + (PeakCenterFitEndPoint-center) *3, numpnts(Ar_encoder) )
     1377                end1 = (end1>=0) ? end1 : 0
    13771378                SetScale/I x Ar_encoder[start], Ar_encoder[end1],"", PeakFitWave
    13781379        endif
     
    15991600                        counter-=1
    16001601                endif
    1601                 if(numtype(waveIn[counter])==0)
     1602                if(counter<(numpnts(waveIn)-1) && numtype(waveIn[counter])==0)
    16021603                        LevelPoint = counter
    16031604                        if(waveIn[counter]>LevelSearched && counter>0 && Counter<numpnts(WaveIn)) //fix when cannot reach 50% or less value...
     
    16091610                        endif
    16101611                endif   
    1611         while (Done<1
     1612        while (Done<1 && counter>0 && counter<numpnts(waveIn)-1)       
    16121613        return LevelPoint       
    16131614end
  • trunk/User Procedures/Irena/IR1_Fractals.ipf

    r1180 r1220  
    11#pragma TextEncoding = "UTF-8"
    22#pragma rtGlobals = 3   // Use strict wave reference mode and runtime bounds checking
    3 #pragma version=2.11
     3#pragma version=2.12
    44Constant IRVversionNumber=2.11
    55
     
    1111//*************************************************************************/
    1212
     13//2.12 Fix case when user sets Qc in Surface fractal outside their data range, which caused artifacts.
    1314//2.11 add option to use Unified Spere form factor instead of Spheroid
    1415//2.10 comibed with IR1_FractalsFiting.ipf, IR1_FractalsInit.ipf, and IR1_FractalsCntrlPanel.ipf
     
    18511852        tempFractFitIntensity = pi * Contrast* 1e20 * Ksi^4 *1e-32* Surface * exp(gammln(5-DS))
    18521853        tempFractFitIntensity *= sin((3-DS)* atan(Qvec*Ksi))/((1+(Qvec*Ksi)^2)^((5-DS)/2) * Qvec*Ksi)
    1853         if(Qc>0)
     1854        if(Qc>0 && Qc<Qvec[numpnts(Qvec)-2])    //7-14-2022 need to make sure Qc is smaller than max Q available...
    18541855                        //h(Q) = C(xc - x)f(Q) + C(x - xc)g(Q).
    18551856                        //The transition from one behavior to another is determined by C.  
  • trunk/User Procedures/Irena/IR1_ImportData.ipf

    r1211 r1220  
    11#pragma rtGlobals = 3   // Use strict wave reference mode and runtime bounds checking
    2 #pragma version=2.41
     2#pragma version=2.42
    33
    44#if(IgorVersion()<9)    //no need to include, Igor 9 has this by default. 
     
    77
    88
    9 Constant IR1IversionNumber = 2.37
     9Constant IR1IversionNumber = 2.42
    1010Constant IR1IversionNumber2 = 2.36
    1111Constant IR1IversionNumberNexus = 2.36
     
    1919//*************************************************************************/
    2020
     21//2.42 added Force UTF-8 = /ENCG={1,4} to LoadWave commands to be able to import ASCII from 12IDB
    2122//2.41 fix for HDF5 changes in IP9
    2223//2.40 minor fixes for importing Slit smeared data.
     
    198199
    199200
    200         Button SelectAll,pos={5,396},size={100,20}, proc=IR1I_ButtonProc,title="Select All"
     201        Button SelectAll,pos={5,396},size={80,17}, proc=IR1I_ButtonProc,title="Select All"
    201202        Button SelectAll,help={"Select all waves in the list"}
    202203
    203         Button DeSelectAll,pos={120,396},size={100,20}, proc=IR1I_ButtonProc,title="Deselect All"
     204        Button DeSelectAll,pos={100,396},size={80,17}, proc=IR1I_ButtonProc,title="Deselect All"
    204205        Button DeSelectAll,help={"Deselect all waves in the list"}
    205206
     
    255256        SetVariable FoundNWaves,limits={0,Inf,0},value= root:Packages:ImportData:FoundNWaves
    256257
    257         CheckBox QvectorInA,pos={240,340},size={16,14},proc=IR1I_CheckProc,title="Qvec units [A^-1]",variable= root:Packages:ImportData:QvectInA, help={"What units is Q in? Select if in Angstroems ^-1"}
    258         CheckBox QvectorInNM,pos={240,355},size={16,14},proc=IR1I_CheckProc,title="Qvec units [nm^-1]",variable= root:Packages:ImportData:QvectInNM, help={"What units is Q in? Select if in nanometers ^-1. WIll be converted to inverse Angstroems"}
    259         CheckBox CreateSQRTErrors,pos={240,370},size={16,14},proc=IR1I_CheckProc,title="Create SQRT Errors?",variable= root:Packages:ImportData:CreateSQRTErrors, help={"If input data do not contain errors, create errors as sqrt of intensity?"}
    260         CheckBox CreatePercentErrors,pos={240,385},size={16,14},proc=IR1I_CheckProc,title="Create n% Errors?",variable= root:Packages:ImportData:CreatePercentErrors, help={"If input data do not contain errors, create errors as n% of intensity?, select how many %"}
    261         SetVariable PercentErrorsToUse, pos={240,403}, size={100,20},title="Error %?:", proc=IR1I_setvarProc, disable=!(root:Packages:ImportData:CreatePercentErrors)
     258        CheckBox QvectorInA,pos={210,340},size={16,14},proc=IR1I_CheckProc,title="Qvec units [A^-1]",variable= root:Packages:ImportData:QvectInA, help={"What units is Q in? Select if in Angstroems ^-1"}
     259        CheckBox QvectorInNM,pos={210,355},size={16,14},proc=IR1I_CheckProc,title="Qvec units [nm^-1]",variable= root:Packages:ImportData:QvectInNM, help={"What units is Q in? Select if in nanometers ^-1. WIll be converted to inverse Angstroems"}
     260        CheckBox CreateSQRTErrors,pos={210,370},size={16,14},proc=IR1I_CheckProc,title="Create SQRT Errors?",variable= root:Packages:ImportData:CreateSQRTErrors, help={"If input data do not contain errors, create errors as sqrt of intensity?"}
     261        CheckBox CreatePercentErrors,pos={210,385},size={16,14},proc=IR1I_CheckProc,title="Create n% Errors?",variable= root:Packages:ImportData:CreatePercentErrors, help={"If input data do not contain errors, create errors as n% of intensity?, select how many %"}
     262        SetVariable PercentErrorsToUse, pos={210,403}, size={100,20},title="Error %?:", proc=IR1I_setvarProc, disable=!(root:Packages:ImportData:CreatePercentErrors)
    262263        SetVariable PercentErrorsToUse value= root:packages:ImportData:PercentErrorsToUse,help={"Input how many percent error you want to create."}
     264
     265        CheckBox ForceUTF8,pos={340,340},size={16,14},proc=IR1I_CheckProc,title="UTF-8?",variable= root:Packages:ImportData:ForceUTF8, help={"Select if you have encoding problems"}
    263266
    264267
     
    10511054        NVAR SkipNumberOfLines=root:Packages:ImportData:SkipNumberOfLines
    10521055        NVAR SkipLines=root:Packages:ImportData:SkipLines       
     1056        NVAR ForceUTF8=root:Packages:ImportData:ForceUTF8       
     1057       
    10531058                IR1I_KillAutoWaves()
    10541059                //Variable err
    10551060        if (SkipLines)
    1056                 LoadWave/Q/A/D/G/L={0, SkipNumberOfLines, 0, 0, 0}/P=ImportDataPath  selectedfile
     1061                if(ForceUTF8)
     1062                        LoadWave/Q/A/D/G/L={0, SkipNumberOfLines, 0, 0, 0}/P=ImportDataPath/ENCG={1,4}  selectedfile
     1063                else
     1064                        LoadWave/Q/A/D/G/L={0, SkipNumberOfLines, 0, 0, 0}/P=ImportDataPath  selectedfile
     1065                endif
    10571066        else
    1058                 LoadWave/Q/A/D/G/P=ImportDataPath  selectedfile
     1067                if(ForceUTF8)
     1068                        LoadWave/Q/A/D/G/P=ImportDataPath/ENCG={1,4}  selectedfile
     1069                else
     1070                        LoadWave/Q/A/D/G/P=ImportDataPath  selectedfile
     1071                endif
    10591072                //; err = GetRTError(0)
    10601073                //if (err != 0)
     
    13241337        killWaves/Z wave0, wave1, wave2, wave3, wave4, wave5, wave6,wave7,wave8,wave9
    13251338       
     1339        NVAR ForceUTF8=root:Packages:ImportData:ForceUTF8       
    13261340        if (SkipLines)
    1327                 LoadWave/Q/A/D/G/L={0, SkipNumberOfLines, 0, 0, 0}/P=ImportDataPath  selectedfile
    1328                 FoundNWaves = V_Flag
     1341                if(ForceUTF8)
     1342                        LoadWave/Q/A/D/G/L={0, SkipNumberOfLines, 0, 0, 0}/P=ImportDataPath/ENCG={1,4}  selectedfile
     1343                        FoundNWaves = V_Flag
     1344                else
     1345                        LoadWave/Q/A/D/G/L={0, SkipNumberOfLines, 0, 0, 0}/P=ImportDataPath  selectedfile
     1346                        FoundNWaves = V_Flag
     1347                endif
    13291348        else
    1330                 LoadWave/Q/A/D/G/P=ImportDataPath  selectedfile
    1331                 FoundNWaves = V_Flag
     1349                if(ForceUTF8)
     1350                        LoadWave/Q/A/D/G/P=ImportDataPath/ENCG={1,4}  selectedfile
     1351                        FoundNWaves = V_Flag
     1352                else
     1353                        LoadWave/Q/A/D/G/P=ImportDataPath  selectedfile
     1354                        FoundNWaves = V_Flag
     1355                endif
    13321356        endif
    13331357        wave wave0
     
    13731397        //LoadWave/Q/A/G/P=ImportDataPath  selectedfile
    13741398        KillWIndow/Z FilePreview
    1375         OpenNotebook /K=1 /N=FilePreview /P=ImportDataPath /R /V=1 selectedfile
     1399        NVAR ForceUTF8=root:Packages:ImportData:ForceUTF8
     1400        if(ForceUTF8)
     1401                OpenNotebook /K=1 /N=FilePreview/ENCG={1,4} /P=ImportDataPath /R /V=1 selectedfile
     1402        else
     1403                OpenNotebook /K=1 /N=FilePreview /P=ImportDataPath /R /V=1 selectedfile
     1404        endif
    13761405        MoveWindow /W=FilePreview 450, 5, 1000, 400     
    13771406        AutoPositionWindow/M=0 /R=$(TopPanel) FilePreview
     
    22382267        ListOfStrings = "DataPathName;DataExtension;IntName;QvecName;ErrorName;NewDataFolderName;NewIntensityWaveName;DataTypeToImport;"
    22392268        ListOfStrings+="NewQWaveName;NewErrorWaveName;NewQErrorWavename;NameMatchString;TooManyPointsWarning;RemoveStringFromName;"
    2240         ListOfVariables = "UseFileNameAsFolder;UseIndra2Names;UseQRSNames;DataContainErrors;UseQISNames;"
     2269        ListOfVariables = "UseFileNameAsFolder;UseIndra2Names;UseQRSNames;DataContainErrors;UseQISNames;ForceUTF8;"
    22412270        ListOfVariables += "SlitSmearData;SlitLength;UsesasEntryNameAsFolder;UseTitleNameAsFolder;"     
    22422271        ListOfVariables += "CreateSQRTErrors;Col1Int;Col1Qvec;Col1Err;Col1QErr;FoundNWaves;"   
Note: See TracChangeset for help on using the changeset viewer.