Advanced Photon Source at Argonne National Laboratory   APS USAXS instrument
USAXS instrument at the Advanced Photon Source,
X-ray science division, beamline 15ID (ChemMatCARS)

Advanced Photon Source

A U.S. Department of Energy, Office of Science,
Office of Basic Energy Sciences national synchrotron x-ray research facility

Argonne Home > Advanced Photon Source > USAXS >

Important links:

USAXS web page

Irena 2 (software for SAS modeling)

Nika 1 (software for SAS area detector  data reduction )

Irena 2 movies

Indra 2 (software for USAXS data reduction)

Some other useful code for Igor Pro I wrote:

Cromer-Lieberman code for IgorPro (ver. 4.0): AtomicFormFactors

Clementine, package for modeling decay kinetics

Other useful links…

Home page of Pete Jemian (more SAS)

APS SAS web page

Extending Irena/Nika/Indra capabilities

Some users need different/extended functionality from Irena, Nika or Indra packages, here is how to do it, including some code snippets. Generally instead of changing the distribution code (bad idea) directly, you can take advantage of "override" function command in Igor. To use: in Igor experiment WITH Irena (Nika, Indra) loaded, paste following functions in Procedure window (ctrl-M on Windows, cmd-M on Macs) and then push button (on the bottom of the window) "Compile".

To "fix" Nika/Irena/Indra back, delete override function (if used) and code will work as usually.

If you need help writing such function, contact me. Actually, contact me before you want to write it and can suggest which function to "override". Even if you want to write this yourself, I can help you avoid long development times...


Request was made to use Nika to only convert detector images to Tiff files, which then can be loaded into other programs or used as images. This is simple way to do it...

//*****Cut at this line and paste to Igor experiment
override Function NI1A_Convert2DTo1D()

string OldDf=GetDataFolder(1)
setDataFOlder root:Packages:Convert2Dto1D
WAVE/Z ww=root:Packages:Convert2Dto1D:CCDImageToConvert
Abort "Something is wrong here"
SVAR FileNameToLoad=root:Packages:Convert2Dto1D:FileNameToLoad
string SaveFileName=FileNameToLoad[0,25]+"_mod.tif"

Duplicate/O ww, wwtemp
Redimension/S wwtemp

ImageSave/P=Convert2Dto1DDataPath/F/T="TIFF"/O wwtemp SaveFileName
KilLWaves wwtemp
SetDataFolder OldDf

//******** end of override function. cut here.

Select files you want to convert to Tiff, hit button "Convert sel. files 1 at a time". Each selected file will be loaded into Nika and instead of reducing them to 1D data, Nika will simply save each fils as 16 bit Tiff to folder, where they come from. You can remove the "_mod" from the file name - and limitation to 25 characters only (important on Macs only) if you want to have exactly same name as the original file. Keep the ".tif" to have extension, of Windows will get confused.


I. Data selection tools for other user code.

A user needed to design his own tool to process his data. He however, wanted to use the Irena data selection tools, so he does not have to manually pick the data or write complex input for the data names. Here is simple panel, which allows to select data, it sets for you strings in specific place -
which can be used as input for his own functions...

//*********** Start of the code. Paste in Procedure window and compile. Make sure Irena is loaded *****

Function Irena_DataPickupPanel()

//This function creates panel in which user can "pick" data set using Irena controls
//Find strings with path to folder and names for 3 waves in the folder:
// root:Packages:IrenaTmpFldr
// Modify as necessary, enjoy. Jan

DoWindow DataPickupPanel
if(V_Flag) //exists, just pull it up and end...
DoWindow/F DataPickupPanel
return 1

String OldDf=GetDataFolder(1)
//create folder for the strings with data paths and names
setDataFolder root:
NewDataFolder/O/S root:Packages
newDataFolder/O/S root:Packages:IrenaTmpFldr
//create the panel and attach the controls
NewPanel /K=1 /W=(64,48,461,345) as "Data Pickup"
DoWindow/C DataPickupPanel
SetDrawLayer UserBack
SetDrawEnv fsize= 14,fstyle= 1,textrgb= (0,0,65535)
DrawText 84,22,"Select data using popups"
DrawText 21,182,"Strings with path and names are in strings:"
DrawText 21,220,"root:Packages:IrenaTmpFldr:IntensityWaveName"
DrawText 21,239,"root:Packages:IrenaTmpFldr:QWaveName"
DrawText 21,258,"root:Packages:IrenaTmpFldr:ErrorWaveName"
DrawText 21,201,"root:Packages:IrenaTmpFldr:DataFolderName"
//the next are the controls which will do all the work
string UserDataTypes=""
string UserNameString=""
string XUserLookup=""
string EUserLookup=""
IR2C_AddDataControls("IrenaTmpFldr","DataPickupPanel","DSM_Int;M_DSM_Int;SMR_Int;M_SMR_Int;","AllCurrentlyAllowedTypes",UserDataTypes,UserNameString,XUserLookup,EUserLookup, 0,1)
//done, easy enough?
//get back where we were before, so you do not have to change folders on your own...
setDataFolder OldDf


//*************** End of the code ******************

II. Modeling II - keeping relationship between parameters

A user wanted to be able to set conditions among the parameters (linking them together) in Modeling II. For example to keep ratio of some parameters. Here is simple function which will replace the function which pops up the kind of useless window when you push the button "Fit". It replaces that window with table with T_Constraints which can be modified by hand. For example, if K0 and K1 would be two parameters to be linked, so K1 ~ 10*K0, then you can change lines in the T_Constraints to read... K1<10.1*K0 and K1>9.9*K0. This will keep K1 around 10*K0 during fitting.

When you push the button fit, Irena will create a table with T_Constraints. You need to modify the relationships using the K0, K1, K2 names among the parameters. There is little detective process to figure out which parameter is called K0, K1, K2 etc. It changes as you select different fitted parameters. You need to follow the rules from the info "Constraint Expressions" in Igor manual.
There are serious limitations - you cannot change number of rows, so you need to use ONLY and ALL of the rows available to you. When finished with changing the fitting parameters constraints, simply kill this table and fitting will start. There is no option to cancel at this moment.

//******** Cut at this line and paste to Igor experiment
Override Function IR2L_CheckFittingParamsFnct()
//allow user to ovewrite T_Constrains as need

string oldDf=GetDataFolder(1)
setDataFolder root:Packages:IR2L_NLSQF
wave/T/Z T_Constraints
Abort "T_Constraints wave does not exists"

Edit/K=1 T_Constraints
DoWindow/C/T IR2L_CheckFittingParams,"Modify constraints here"
variable/g root:Packages:IR2L_NLSQF:UserCanceled=0
setDataFolder oldDf

//******** end of override function. cut here.







Privacy & Security Notice  |   Contact Us    
This page last modified: 2009-12-07 2:21 PM