Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
Number of smaller fixes over Christmas data analysis session
  • Loading branch information
jilavsky committed Jan 13, 2023
1 parent fd63fb1 commit a0aedb3
Show file tree
Hide file tree
Showing 10 changed files with 264 additions and 135 deletions.
295 changes: 192 additions & 103 deletions User Procedures/Indra 2/IN3_BlueSkyReader.ipf

Large diffs are not rendered by default.

52 changes: 32 additions & 20 deletions User Procedures/Irena/IR2_PanelCntrlProcs.ipf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma TextEncoding = "UTF-8"
#pragma rtGlobals=3 // Use modern global access method.
#pragma version = 1.65
#pragma version = 1.66


//*************************************************************************\
Expand All @@ -9,6 +9,7 @@
//* in the file LICENSE that is included with this distribution.
//*************************************************************************/

//1.66 add to USAXS combination of Detector=Xdata, this is for Tiled imported tune scans. Also fixed IR3C_GenStringOfFolders2
//1.65 added SimpleFits Power Law
//1.64 added SimpleFits 1DCorrelation results: Corr1DZ_N for X and Y are: Corr1DK_N or Corr1DGammaA_N or Corr1DGammaI_N
//1.63 modified IR2C_ReturnKnownToolResults to enable downselection of results types. This makes AllowedResultsTypes parameter finally useful. From code pass "" if no downselection is needed.
Expand Down Expand Up @@ -3493,14 +3494,15 @@ Function IR3C_SelectWaveNamesData(CntrlLocationG, SelectedDataFolderName)
end
//**************************************************************************************
//**************************************************************************************
Function/S IR2C_MultiSTartFolderSelection()
Function/S IR2C_MultiSTartFolderSelection() //this si specifically for only ONE MultiPlot tool...
string PopStringPath
SVAR ControlProcsLocations=root:Packages:IrenaControlProcs:ControlProcsLocations
string PanelName = WinName(0,64)
string CntrlLocation="root:Packages:"+StringByKey(PanelName, ControlProcsLocations,":",";")
NVAR UseIndra2=$(CntrlLocation+":UseIndra2Data")
NVAR UseQRSdata=$(CntrlLocation+":UseQRSdata")
string OtherFolders=IR3C_GenStringOfFolders2(UseIndra2,UseQRSdata,2,1)
SVAR DataSubType = $(CntrlLocation+":DataSubType")
string OtherFolders=IR3C_GenStringOfFolders2(UseIndra2,UseQRSdata,2,1, DataSubType = DataSubType)
OtherFolders=RemoveFromList("root:", OtherFolders , ";")
PopStringPath = "root:;"+OtherFolders
return PopStringPath
Expand Down Expand Up @@ -3705,15 +3707,15 @@ Function IR3C_InitMultiControls(PathToPackagesFolder, PanelName, DoubleClickFunc
DataSubTypeUSAXSList="DSM_Int;"
endif
else
DataSubTypeUSAXSList="DSM_Int;SMR_Int;R_Int;Blank_R_Int;USAXS_PD;Monitor;"
DataSubTypeUSAXSList="DSM_Int;SMR_Int;R_Int;Blank_R_Int;USAXS_PD;Monitor;Detector;"
endif
SVAR DataSubTypeResultsList
DataSubTypeResultsList="Size"
SVAR DataSubType
DataSubType="DSM_Int"
SVAR QvecLookupUSAXS
QvecLookupUSAXS="R_Int=R_Qvec;Blank_R_Int=Blank_R_Qvec;SMR_Int=SMR_Qvec;DSM_Int=DSM_Qvec;USAXS_PD=Ar_encoder;Monitor=Ar_encoder;"
QvecLookupUSAXS="R_Int=R_Qvec;Blank_R_Int=Blank_R_Qvec;SMR_Int=SMR_Qvec;DSM_Int=DSM_Qvec;USAXS_PD=Ar_encoder;Monitor=Ar_encoder;Detector=Xdata;"
SVAR ErrorLookupUSAXS
ErrorLookupUSAXS="R_Int=R_Error;Blank_R_Int=Blank_R_error;SMR_Int=SMR_Error;DSM_Int=DSM_error;"
SVAR dQLookupUSAXS
Expand Down Expand Up @@ -4422,31 +4424,41 @@ end
//**********************************************************************************************************
Function/T IR3C_GenStringOfFolders2(UseIndra2Structure, UseQRSStructure, SlitSmearedData, AllowQRDataOnly)
Function/T IR3C_GenStringOfFolders2(UseIndra2Structure, UseQRSStructure, SlitSmearedData, AllowQRDataOnly, [DataSubType])
variable UseIndra2Structure, UseQRSStructure, SlitSmearedData, AllowQRDataOnly
String DataSubType
//SlitSmearedData =0 for DSM data,
// =1 for SMR data
// and =2 for both
// DataSubType = this is subtype of USAXS data, Detector needs special handling...
// AllowQRDataOnly=1 if Q and R data are allowed only (no error wave). For QRS data ONLY!
string DataSubTypeLocal = "SMR_Int"
if(!paramIsDefault(DataSubType))
DataSubTypeLocal = DataSubType
endif
string ListOfQFolders
// if UseIndra2Structure = 1 we are using Indra2 data, else return all folders
string result
variable i
if (UseIndra2Structure)
if(SlitSmearedData==1)
result=IN2G_FindFolderWithWaveTypes("root:USAXS:", 10, "*SMR*", 1)
elseif(SlitSmearedData==2)
string tempStr=IN2G_FindFolderWithWaveTypes("root:USAXS:", 10, "*SMR*", 1)
result=IN2G_FindFolderWithWaveTypes("root:USAXS:", 10, "*DSM*", 1)+";"
for(i=0;i<ItemsInList(tempStr);i+=1)
//print stringmatch(result, "*"+StringFromList(i, tempStr,";")+"*")
if(stringmatch(result, "*"+StringFromList(i, tempStr,";")+"*")==0)
result+=StringFromList(i, tempStr,";")+";"
endif
endfor
else
result=IN2G_FindFolderWithWaveTypes("root:USAXS:", 10, "*DSM*", 1)
//These are standard USAXS types,
if(StringMatch("SMR_Int,DSM_Int,R_Int,Blank_R_Int,Monitor,USAXS_PD", "*"+DataSubTypeLocal+"*"))
if(SlitSmearedData==1)
result=IN2G_FindFolderWithWaveTypes("root:USAXS:", 10, "*SMR*", 1)
elseif(SlitSmearedData==2)
string tempStr=IN2G_FindFolderWithWaveTypes("root:USAXS:", 10, "*SMR*", 1)
result=IN2G_FindFolderWithWaveTypes("root:USAXS:", 10, "*DSM*", 1)+";"
for(i=0;i<ItemsInList(tempStr);i+=1)
//print stringmatch(result, "*"+StringFromList(i, tempStr,";")+"*")
if(stringmatch(result, "*"+StringFromList(i, tempStr,";")+"*")==0)
result+=StringFromList(i, tempStr,";")+";"
endif
endfor
else
result=IN2G_FindFolderWithWaveTypes("root:USAXS:", 10, "*DSM*", 1)
endif
else //this is for non-standard (Tiled) data types.
result=IN2G_FindFolderWithWaveTypes("root:", 10, DataSubTypeLocal, 1)
endif
elseif (UseQRSStructure)
make/N=0/FREE/T ResultingWave
Expand Down
4 changes: 3 additions & 1 deletion User Procedures/Irena/IR3_3DTwoPhaseSolid.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,9 @@ Function IR3T_Calc1DSASData()
variable MinMeaningfulQmin = 2*pi/BoxSideSize
//TheoreticalIntensityDACF
variable MaxMeaningfulPnt = BinarySearch(AutoCorQWv, MaxMeaningfulQmax)
AutoCorIntensity[MaxMeaningfulPnt, numpnts(AutoCorIntensity)-1] = nan
if(MaxMeaningfulPnt>0)
AutoCorIntensity[MaxMeaningfulPnt, numpnts(AutoCorIntensity)-1] = nan
endif
AutoCorIntensity[0, MinMeaningfulQmin] = nan
IN2G_RemoveNaNsFrom2Waves(AutoCorIntensity,AutoCorQWv)

Expand Down
4 changes: 4 additions & 0 deletions User Procedures/Irena/IR3_MergingData.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,10 @@ Function IR3D_DataMergeListBoxProc(lba) : ListBoxControl
else
isData1or2=2
endif
//avoid error when user clicks outside active area...
if(row<0)
return 0
endif
FoldernameStr=listWave[row][col]
IR3D_CopyAndAppendData(isData1or2, FoldernameStr)
if(col==1&&!ProcessTest) //this is second column of data
Expand Down
3 changes: 2 additions & 1 deletion User Procedures/Irena/IR3_SimpleFits.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -2245,6 +2245,7 @@ static Function IR3J_SaveResultsToNotebook()
NVAR Guinier_I0 = root:Packages:Irena:SimpleFits:Guinier_I0
NVAR Guinier_Rg =root:Packages:Irena:SimpleFits:Guinier_Rg
NVAR Porod_Constant =root:Packages:Irena:SimpleFits:Porod_Constant
NVAR ScatteringContrast = root:Packages:Irena:SimpleFits:ScatteringContrast
NVAR Porod_SpecificSurface =root:Packages:Irena:SimpleFits:Porod_SpecificSurface
NVAR ScatteringContrast =root:Packages:Irena:SimpleFits:ScatteringContrast
NVAR Sphere_Radius =root:Packages:Irena:SimpleFits:Sphere_Radius
Expand Down Expand Up @@ -2302,7 +2303,7 @@ static Function IR3J_SaveResultsToNotebook()
elseif(stringmatch(SimpleModel,"Porod"))
IR1_AppendAnyText("\tPorod Constant [1/cm 1/A^4] = "+num2str(Porod_Constant),0)
IR1_AppendAnyText("\tSpecific Surface [cm2/cm3] = "+num2str(Porod_SpecificSurface),0)
IR1_AppendAnyText("\tContrast [10^20 cm^-4] = "+num2str(Porod_Constant),0)
IR1_AppendAnyText("\tContrast [10^20 cm^-4] = "+num2str(ScatteringContrast),0)
IR1_AppendAnyText("\tBackground = "+num2str(DataBackground),0)
IR1_AppendAnyText("Achieved Normalized chi-square = "+num2str(AchievedChiSquare),0)
elseif(stringmatch(SimpleModel,"Power Law"))
Expand Down
2 changes: 1 addition & 1 deletion User Procedures/Irena_CalcSavedCompounds/C.dat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
NumberOfAtoms=1;Density=2.2;ScattContrXrays=18.531;NeutronsScatlengthDens=7.3335;UseWeightPercent=0;WeightPercentBalanceElem=0;El1_type=C;El1_content=1;El1_Isotope=natural;
NumberOfAtoms=1;Density=2.26;ScattContrXrays=19.158;NeutronsScatlengthDens=7.5335;UseWeightPercent=0;WeightPercentBalanceElem=0;El1_type=C;El1_content=1;El1_Isotope=natural;
Binary file added User Procedures/Nika/.DS_Store
Binary file not shown.
15 changes: 13 additions & 2 deletions User Procedures/Nika/NI1_BeamCenterUtils.ipf
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#pragma TextEncoding = "UTF-8"
#pragma rtGlobals=3 // Use modern global access method.
//#pragma rtGlobals=1 // Use modern global access method.
#pragma version=2.30
#pragma version=2.31

Constant NI1BCversionNumber = 2.25
//*************************************************************************\
//* Copyright (c) 2005 - 2022, Argonne National Laboratory
//* This file is distributed subject to a Software License Agreement found
//* in the file LICENSE that is included with this distribution.
//*************************************************************************/

//2.31 Fix Beam Center and Geometry correction which failed fitting when using Geometry correction.
//2.30 Remove for MatrixOP /NTHR=0 since it is applicable to 3D matrices only
//2.29 Fixed to accept tiff as tif extension.
//2.28 fix autoscaling panel components.
Expand Down Expand Up @@ -2424,6 +2425,16 @@ Function NI1BC_GetEvaluationPaths(CalibrantLine,numberOfSectors)
endif
Wave W_ImageLineProfile
if(BMUseGeometryCorr)
//need to check W_ImageLineProfile has same number of points as GeomCorrWv, seem s like routinely it has more...
variable LineProfNPS, WcoefNPS
LineProfNPS= numpnts(W_ImageLineProfile)
WcoefNPS = numpnts(GeomCorrWv)
if(LineProfNPS!=WcoefNPS)
Redimension/N=(LineProfNPS) GeomCorrWv
if(LineProfNPS > WcoefNPS)
GeomCorrWv[LineProfNPS-1]=GeomCorrWv[LineProfNPS-2]
endif
endif
W_ImageLineProfile=W_ImageLineProfile*GeomCorrWv
endif
wavestats/Q W_ImageLineProfile
Expand Down
10 changes: 6 additions & 4 deletions User Procedures/Nika/NI1_Main.ipf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma TextEncoding = "UTF-8"
#pragma rtGlobals=3 // Use modern global access method.
#pragma version=1.84
#pragma version=1.85
#pragma IgorVersion=8.04

//DO NOT renumber Main files every time, these are main release numbers...
Expand All @@ -15,6 +15,7 @@ constant NikaLengthOfPathForPanelDisplay=100
//* in the file LICENSE that is included with this distribution.
//*************************************************************************/

//1.85 Fix NI1_SetAllPathsInNIka which failed to setup properly very long paths.
//1.84 Ocotber2021 version
// Fixes for some loaders where users found failures.
//1.83 require Igor 8.03 now. Not testing Igor 7 anymore.
Expand Down Expand Up @@ -173,18 +174,19 @@ end

Function NI1_SetAllPathsInNIka()
DoWindow NI1A_Convert2Dto1DPanel
if(!V_Flag) //does nto exists, quit
if(!V_Flag) //does not exists, quit
NI1A_Convert2Dto1DMainPanel()
else
DoWIndow/F NI1A_Convert2Dto1DPanel
endif
PathInfo/S Convert2Dto1DEmptyDarkPath
NewPath/C/O/M="Select path to your data" Convert2Dto1DDataPath
PathInfo Convert2Dto1DDataPath
string pathInforStrL = S_path[strlen(S_path)-NikaLengthOfPathForPanelDisplay,strlen(S_path)-1]
string pathInforStrL = S_path //[strlen(S_path)-NikaLengthOfPathForPanelDisplay,strlen(S_path)-1]
string pathInforStrS = S_path[strlen(S_path)-NikaLengthOfPathForPanelDisplay,strlen(S_path)-1]
NewPath/O/Q Convert2Dto1DEmptyDarkPath, pathInforStrL
SVAR MainPathInfoStr=root:Packages:Convert2Dto1D:MainPathInfoStr
MainPathInfoStr = pathInforStrL
MainPathInfoStr = pathInforStrS
SVAR/Z BCPathInfoStr=root:Packages:Convert2Dto1D:BCPathInfoStr
if(!SVAR_Exists(BCPathInfoStr))
NI1BC_InitCreateBmCntrFile()
Expand Down
14 changes: 11 additions & 3 deletions User Procedures/Nika/NI1_MainPanel.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ Constant NI1AversionNumber = 2.73
//*************************************************************************/

//2.73 add ability to flip/rotate image after load to let users tweak image orientation.
// modify NewMovie /CF=1 /F=(Movie_FrameRate)/I/Z to /CF=1 to reduce compression artifacts.
// modify NewMovie /CF=1 /F=(Movie_FrameRate)/I/Z to /CF=CFfactor to reduce compression artifacts.
// Try to calculate CF factor, see NI1A_MovieOpenFile() for explanation.
//2.72 add Use Transparent Beamstop transmission calculation
//2.71 add Eiger types
//2.70 fixed Max number of points selection which did not account for Qmin and Qmax and was therefore producing too many points
Expand Down Expand Up @@ -2428,11 +2429,18 @@ Function NI1A_MovieOpenFile()
NVAR Movie_FrameRate=root:Packages:Convert2Dto1D:Movie_FrameRate
NVAR Movie_AppendAutomatically=root:Packages:Convert2Dto1D:Movie_AppendAutomatically
NVAR Movie_FileOpened=root:Packages:Convert2Dto1D:Movie_FileOpened
//figure out if we need different CF factor, see below.
variable CFFactor=1
Wave/Z testImg=root:Packages:Convert2Dto1D:CCDImageToConvert
if(WaveExists(testImg)) // we have image...
CFFactor= ceil(DimSize(testImg, 0)*DimSize(testImg, 1))
endif

NewMovie /CF=1 /F=(Movie_FrameRate)/I/Z //8-29-2022 added CF=1 (default is 200) to reduce compression artifacts. Ugh...
//warning from Wvemetrics :
NewMovie /CF=(CFFactor) /F=(Movie_FrameRate)/I/Z //8-29-2022 added CF=1 (default is 200) to reduce compression artifacts. Ugh...
//warning from Wavemetrics :
//On Windows (I haven't looked at the mac code), the compression factor you provide is used in this calculation:
//UINT32 bitRate= (VIDEO_WIDTH * VIDEO_HEIGHT * 24.0 * VIDEO_FPS_IN) / compressionFactor; // this could overflow 32 bits if factor is small and size is large
// compressionFactor = ceil(VIDEO_WIDTH * VIDEO_HEIGHT/5e6 )
//VIDEO_FPS_IN is 30 unless you use the /F flag.
//If you use /CF=1, you need to make sure that the width x height is < ~5.96 million, this is slightly above 2400x2400 pixels images.

Expand Down

0 comments on commit a0aedb3

Please sign in to comment.