diff --git a/User Procedures/Indra 2/IN3_BlueSkyReader.ipf b/User Procedures/Indra 2/IN3_BlueSkyReader.ipf index baf2a76..1e3a24e 100644 --- a/User Procedures/Indra 2/IN3_BlueSkyReader.ipf +++ b/User Procedures/Indra 2/IN3_BlueSkyReader.ipf @@ -15,7 +15,9 @@ end //1.01 November 2022, Tiled 0.1.0a80 compatible, changed webGUI //1.00 original version, kind of works //server address. -strconstant ServerAddress="http://usaxscontrol:8000" +//strconstant ServerAddress="http://usaxscontrol:8000" +strconstant ServerAddress="http://usaxscontrol.xray.aps.anl.gov:8000" + //strconstant ServerAddress="http://wow.xray.aps.anl.gov:8010" //some notes. See end of this file for how to talk to the server instructions @@ -29,6 +31,10 @@ strconstant ServerAddress="http://usaxscontrol:8000" // retruns json where // need to add this : "&filter[time_range][condition][timezone]=US/Central" into the querries to it works... +//this is very useful list of examples how querries are built: +//https://github.com/BCDA-APS/bdp-tiled/blob/main/demo_client.ipynb +//there are querries which allow finding specific text (sample name?) + ///****************************************************************************************** ///****************************************************************************************** @@ -172,18 +178,20 @@ FUnction IR3BS_Init() teststr ="" endfor NVAR StartYear - StartYear =2022 + StartYear = str2num(StringFromList(0, Secs2Date(DateTime,-2),"-")) NVAR StartMoth - StartMoth = 2 + StartMoth = str2num(StringFromList(1, Secs2Date(DateTime,-2),"-")) NVAR StartDay - StartDay =20 + StartDay =str2num(StringFromList(2, Secs2Date(DateTime,-2),"-")) NVAR NumOfHours NumOfHours=24 NVAR NumberOfScansToImport if(NumberOfScansToImport<10) - NumberOfScansToImport=1000 - + NumberOfScansToImport=10000 endif + SVAR ListOfScanTypes + ListOfScanTypes = "tune_ar;tune_a2rp;tune_mr;tune_dx;tune_dy;all;" + // ListOfStrings="DataMatchString;FolderSortString;FolderSortStringAll;" // for(i=0;i0) - IN3BS_ImportDataAndPlot(i,1) + IN3BS_ImportDataAndPlot(i,1, PlotAll) endif endfor + if(PlotAll) + IN2G_ColorTopGrphRainbow() + IN2G_LegendTopGrphFldr(12, 20, 1, 0) + endif end //************************************************************************************************************ //************************************************************************************************************ //************************************************************************************************************ -Function IN3BS_ImportDataAndPlot(selRow, saveTheData) - variable selRow, saveTheData +Function IN3BS_ImportDataAndPlot(selRow, saveTheData, PlotAll) + variable selRow, saveTheData, PlotAll string oldDf oldDf = getDataFolder(1) @@ -355,7 +372,7 @@ Function IN3BS_ImportDataAndPlot(selRow, saveTheData) //http://usaxscontrol:8000/node/full/9idc_usaxs/16248ab5-1359-4242-8ec9-6fd66f8b5976/primary/data?format=json string TempAddress = ServerAddress+"/api/v1/node/full/"+CatalogUsed+"/" - TempAddress +=PrunedListOfAvailableData[selRow][2]+"/primary/data?format=json" + TempAddress +=PrunedListOfAvailableData[selRow][3]+"/primary/data?format=json" //print TempAddress URLRequest/Z url=TempAddress if(V_Flag!=0) @@ -382,6 +399,7 @@ Function IN3BS_ImportDataAndPlot(selRow, saveTheData) JSONXOP_Release jsonId //store data here and do something with them. string tempScanName, DateTimeStr + PauseUpdate if(saveTheData) //store the data //create location for the data... tempScanName=PrunedListOfAvailableData[selRow][0] @@ -390,19 +408,33 @@ Function IN3BS_ImportDataAndPlot(selRow, saveTheData) NewDataFolder/O/S $(CleanupName(tempScanName+"_"+DateTimeStr, 0)) Duplicate/O DetFree, Detector Duplicate/O XdatFree, Xdata + if(PlotAll) + DoWIndow BlueSkyGraph + if(V_Flag) + DoWIndow/F BlueSkyGraph + else + Display/K=1 as "Imported BlueSky data" + DoWindow/C BlueSkyGraph + endif + AppendtoGraph Detector vs Xdata + Label bottom XdataKey + Label left DetKey + endif setDataFolder oldDf - else //just display tyhem without saving + else //just display them without saving Duplicate/O DetFree,Detector Duplicate/O XdatFree,Xdata - Killwindow/Z BlueSkyGrpah + Killwindow/Z BlueSkyGraph //display, for now this is simplistic way Display/K=1 Detector vs Xdata as PrunedListOfAvailableData[selRow][1]+" "+PrunedListOfAvailableData[selRow][0] Label bottom XdataKey Label left DetKey - DoWindow/C BlueSkyGrpah - AutoPositionWindow/R=IR3BS_BlueSkyPlotPanel BlueSkyGrpah + DoWindow/C BlueSkyGraph + AutoPositionWindow/R=IR3BS_BlueSkyPlotPanel BlueSkyGraph endif + ResumeUpdate + setDataFolder oldDf end //************************************************************************************************************ @@ -447,7 +479,18 @@ Function IR3BS_ButtonProc(ba) : ButtonControl IR3BS_GetJSONScanData() endif if(stringmatch(ba.ctrlname,"importSelected")) - IR3BS_ImportSelected() + IR3BS_ImportSelected(0) + endif + if(stringmatch(ba.ctrlname,"importPlotSelected")) + IR3BS_ImportSelected(1) + endif + if(stringmatch(ba.ctrlname,"SelectAll")) + Wave selWave=root:Packages:Irena:BlueSkySamplePlot:SelectionOfAvailableData + selWave = 1 + endif + if(stringmatch(ba.ctrlname,"DeSelectAll")) + Wave selWave=root:Packages:Irena:BlueSkySamplePlot:SelectionOfAvailableData + selWave = 0 endif break @@ -486,114 +529,157 @@ FUnction IR3BS_GetJSONScanData() SVAR ListOfCatalogs=root:Packages:Irena:BlueSkySamplePlot:ListOfCatalogs SVAR CatalogUsed=root:Packages:Irena:BlueSkySamplePlot:CatalogUsed + SVAR ScanTypeToUse = root:Packages:Irena:BlueSkySamplePlot:ScanTypeToUse NVAR NumberOfScansToImport=root:Packages:Irena:BlueSkySamplePlot:NumberOfScansToImport - if(NumberOfScansToImport>300) - NumberOfScansToImport=300 //limitation of Tiled 0.1.a80 - endif + //if(NumberOfScansToImport>300) + // NumberOfScansToImport=300 //limitation of Tiled 0.1.a80 + //endif //SERVER/node/search/CATALOG?page[offset]=0&filter[time_range][condition][since]=FROM_START_TIME&filter[time_range][condition][until]=BEFORE_END_TIME&sort=time - variable startTimeSec= date2secs((StartYear), (StartMonth), (StartDay)) - 2082844800 //convert to Python time + variable startTimeSec= date2secs((StartYear), (StartMonth), (StartDay)) - 2082844800 - Date2secs(-1,-1,-1) //convert to Python time and fix to UTC time which BS is using. variable endTimeSec = startTimeSec + NumOfHours*60*60 string TempAddress = ServerAddress+"/api/v1/node/search/" string StartTimeStr, EndTimeStr sprintf StartTimeStr, "%.15g" ,startTimeSec sprintf EndTimeStr, "%.15g" ,endTimeSec - if(AllDates) - TempAddress +=CatalogUsed+"?page[offset]=00&page[limit]="+num2str(NumberOfScansToImport)+"&sort=time" - else - TempAddress +=CatalogUsed+"?page[offset]=00&page[limit]="+num2str(NumberOfScansToImport)+"&filter[time_range][condition][since]="+StartTimeStr+"&filter[time_range][condition][until]="+EndTimeStr - TempAddress +="&filter[time_range][condition][timezone]=US/Central&sort=time" - endif - //this fails on IP8: - //TempAddress +=StringFromList(0, ListOfCatalogs)+"?page[offset]=00&page[limit]=1000&filter[time_range][condition][since]="+num2str(startTimeSec, "%.15g")+"&filter[time_range][condition][until]="+num2str(endTimeSec, "%.15g")+"&sort=time" - // default pagse limit is 100 - page[offset]=0&page[limit]=1000 loads first 1000 scans. - print TempAddress - URLRequest/Z url=TempAddress - if(V_Flag!=0) - abort "Server not available" - endif - JSONXOP_Parse/Z(S_serverResponse) - if(V_Flag!=0) - abort "Cannot parse server response" - endif - variable jsonId = V_Value - //print jsonID - //JSONXOP_Dump refNumJson - //print S_Value -- prints the file in history and works. - - //this list how many items are in that address, this is how many data sets were returned in the json. - //print JSON_GetArraySize(jsonID, "/data") - - //this works for string keys in given location, not for single value - //JSONXOP_GetKeys jsonId, "/data/0", keyWave - //this reads value... Number: - //JSONXOP_GetValue/T jsonId, "/data/0/id" - //print S_value + variable chunkToDownload = 250 + variable OffsetStart=0 + variable NumStepsNeeded = ceil(NumberOfScansToImport/chunkToDownload) + variable TempNumberOfScansToImport + variable i, done=0 + variable numDataSets, i2, j, Oldrecords=0 + string tempPlanName, tempMetadata + KillWaves/Z IDwave, PlanNameWave, TimeWave + make/O/N=(0)/T IDwave, PlanNameWave, MetadataStr + make/O/N=(0)/D TimeWave //must be double precision! - //print JSON_GetType(jsonID, "/data/0/id") - // 0 Object - // 1 Array - // 2 Numeric - // 3 String - // 4 Boolean - // 5 Null + //need to split into smaller chunks (100) to downlad in pages. + For(i2=0;i20) ListOfAvailableData[][0] = PlanNameWave[p] ListOfAvailableData[][1] = Secs2Date(TimeWave[p],-2)+" "+Secs2Time(TimeWave[p],3) - ListOfAvailableData[][2] = IDwave[p] + ListOfAvailableData[][2] = MetadataStr[p] + ListOfAvailableData[][3] = IDwave[p] endif //create list of scans available on server - SVAR ListOfScanTypes=root:Packages:Irena:BlueSkySamplePlot:ListOfScanTypes - SVAR ScanTypeToUse=root:Packages:Irena:BlueSkySamplePlot:ScanTypeToUse - ListOfScanTypes = "" - ScanTypeToUse = "" - For(i=0;i0) - ScanTypeToUse = StringFromList(0, ListOfScanTypes) - endif +// SVAR ListOfScanTypes=root:Packages:Irena:BlueSkySamplePlot:ListOfScanTypes +// SVAR ScanTypeToUse=root:Packages:Irena:BlueSkySamplePlot:ScanTypeToUse +// string OldScanTypeToUse = ScanTypeToUse +// ListOfScanTypes = "" +// ScanTypeToUse = "" +// For(i=0;i0) +// ScanTypeToUse = StringFromList(0, ListOfScanTypes) +// endif +// if(strlen(OldScanTypeToUse)>1) +// if(StringMatch(ListOfScanTypes, "*"+OldScanTypeToUse+"*" )) +// ScanTypeToUse=OldScanTypeToUse +// endif +// endif IR3BS_UdateListBoxScans() @@ -608,13 +694,16 @@ Function IR3BS_UdateListBoxScans() //populate listbox wave/T ListOfAvailableData = root:Packages:Irena:BlueSkySamplePlot:ListOfAvailableData Wave/T PrunedListOfAvailableData =root:Packages:Irena:BlueSkySamplePlot:PrunedListOfAvailableData - redimension/N=(0,3) PrunedListOfAvailableData + redimension/N=(0,4) PrunedListOfAvailableData Wave SelectionOfAvailableData = root:Packages:Irena:BlueSkySamplePlot:SelectionOfAvailableData //create list of scans available on server SVAR ListOfScanTypes=root:Packages:Irena:BlueSkySamplePlot:ListOfScanTypes SVAR ScanTypeToUse=root:Packages:Irena:BlueSkySamplePlot:ScanTypeToUse - - Grep /A /E=(ScanTypeToUse)/GCOL=0 ListOfAvailableData as PrunedListOfAvailableData + if(!stringmatch(ScanTypeToUse,"all")) + Grep /A /E=(ScanTypeToUse)/GCOL=0 ListOfAvailableData as PrunedListOfAvailableData + else + Duplicate/O/T ListOfAvailableData, PrunedListOfAvailableData + endif redimension/N=(DimSize(PrunedListOfAvailableData,0)) SelectionOfAvailableData SelectionOfAvailableData = 0 diff --git a/User Procedures/Irena/IR2_PanelCntrlProcs.ipf b/User Procedures/Irena/IR2_PanelCntrlProcs.ipf index 585cef5..eb68d05 100644 --- a/User Procedures/Irena/IR2_PanelCntrlProcs.ipf +++ b/User Procedures/Irena/IR2_PanelCntrlProcs.ipf @@ -1,6 +1,6 @@ #pragma TextEncoding = "UTF-8" #pragma rtGlobals=3 // Use modern global access method. -#pragma version = 1.65 +#pragma version = 1.66 //*************************************************************************\ @@ -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. @@ -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 @@ -3705,7 +3707,7 @@ 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" @@ -3713,7 +3715,7 @@ Function IR3C_InitMultiControls(PathToPackagesFolder, PanelName, DoubleClickFunc 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 @@ -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;i0) + AutoCorIntensity[MaxMeaningfulPnt, numpnts(AutoCorIntensity)-1] = nan + endif AutoCorIntensity[0, MinMeaningfulQmin] = nan IN2G_RemoveNaNsFrom2Waves(AutoCorIntensity,AutoCorQWv) diff --git a/User Procedures/Irena/IR3_MergingData.ipf b/User Procedures/Irena/IR3_MergingData.ipf index 9d4f975..7dd68ca 100644 --- a/User Procedures/Irena/IR3_MergingData.ipf +++ b/User Procedures/Irena/IR3_MergingData.ipf @@ -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 diff --git a/User Procedures/Irena/IR3_SimpleFits.ipf b/User Procedures/Irena/IR3_SimpleFits.ipf index f6b668b..f2ae008 100644 --- a/User Procedures/Irena/IR3_SimpleFits.ipf +++ b/User Procedures/Irena/IR3_SimpleFits.ipf @@ -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 @@ -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")) diff --git a/User Procedures/Irena_CalcSavedCompounds/C.dat b/User Procedures/Irena_CalcSavedCompounds/C.dat index cdb0ae3..03e92f9 100644 --- a/User Procedures/Irena_CalcSavedCompounds/C.dat +++ b/User Procedures/Irena_CalcSavedCompounds/C.dat @@ -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; \ No newline at end of file +NumberOfAtoms=1;Density=2.26;ScattContrXrays=19.158;NeutronsScatlengthDens=7.5335;UseWeightPercent=0;WeightPercentBalanceElem=0;El1_type=C;El1_content=1;El1_Isotope=natural; \ No newline at end of file diff --git a/User Procedures/Nika/.DS_Store b/User Procedures/Nika/.DS_Store new file mode 100644 index 0000000..1b5c0cd Binary files /dev/null and b/User Procedures/Nika/.DS_Store differ diff --git a/User Procedures/Nika/NI1_BeamCenterUtils.ipf b/User Procedures/Nika/NI1_BeamCenterUtils.ipf index 63f5ba0..7c09c8a 100755 --- a/User Procedures/Nika/NI1_BeamCenterUtils.ipf +++ b/User Procedures/Nika/NI1_BeamCenterUtils.ipf @@ -1,7 +1,7 @@ #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 @@ -9,6 +9,7 @@ Constant NI1BCversionNumber = 2.25 //* 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. @@ -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 diff --git a/User Procedures/Nika/NI1_Main.ipf b/User Procedures/Nika/NI1_Main.ipf index 8b849ef..864fe50 100755 --- a/User Procedures/Nika/NI1_Main.ipf +++ b/User Procedures/Nika/NI1_Main.ipf @@ -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... @@ -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. @@ -173,7 +174,7 @@ 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 @@ -181,10 +182,11 @@ Function NI1_SetAllPathsInNIka() 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() diff --git a/User Procedures/Nika/NI1_MainPanel.ipf b/User Procedures/Nika/NI1_MainPanel.ipf index 1effec1..5405a4d 100755 --- a/User Procedures/Nika/NI1_MainPanel.ipf +++ b/User Procedures/Nika/NI1_MainPanel.ipf @@ -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 @@ -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.