iFit: Changes and Bugs
    
    
    
      
      - Releases and Changes 
 
      - Bugs list:
        
          - File path names do not support
              spaces
 
          - Data set maximum size
 
          - CDF files written by Matlab can
              not be read by other software (hdfview, ncBrowse)
 
          - Convolution brings strange
              results (Models/fconv) 
 
          - Too many warnings displayed
 
          - Execution/compilation issue with
              text files importer (iLoad/iData/load, looktxt,
              CrysFML/cif2hkl)
 
          - Limitations in the standalone
              (binary) package
 
          - McStas and external programs can
              not be found from Matlab/iFit
 
          - iFit standalone can not be
              launched (libmwmclmcrrt.so) 
 
          - iFit crashes when typing special
              characters (accents, ...)
 
          - iFit fails with a message such
              as 'version `GFORTRAN_1.4' not found' or 'version
              `GCC_4.3.0' not found' 
 
          - Import of a text file fails
 
          - Model sqw_phonon fails with
              Dacapo/Jacapo and MPI
 
          - Matlab crashes when displaying 3D
              plots
 
          - Matlab rendering is poor
 
          - miFit/matlab crashes when
              starting/loading/saving
 
        
       
    
    
    Releases and
      Changes
    
    
    
      - 2.0.1: bug fix update: miFit: File/Open menu item and
        neutron_TAS/4D convolution. (Nov 27th 2018)
       
      - 2.0: updated iData and iFunc storage classes. The
        object usage is not modified, but sub-classes are now possible,
        allowing more specialized methods for specific use. See here if you experience load/save
        crashes. New iData/imroi
        interactive region-of-interest and mask selection. New iData.slice for 2D objects
        (only worked so far for 3D). Neutron
          scattering specific methods: iData_Sqw2D
        (for S(q,w) 2D data sets), iData_Sab
        (for S(alpha,beta) data sets),
          iFunc_Sqw4D (for S(qh,qk,ql,w) 4D models)), iFunc_McCode (for McStas/McXtrace
        models) classes. iData_Sqw2D can
        now be exported to INX, ISIS SPE and McStas Sqw files. Phonon/ASE models are
        now Python3 compatible. New SpinWave model from S.
        Petit. (Oct 23rd 2018)
       
      - 1.10: new mccode
          model maker, replacing the 'mcstas' function. New
          mccode_mcdisplay function which does not require external
          libraries. New fmin/fmax
          for iFunc. Added TextEdit as editor for iFit
            standalone. Build iFunc from
          input Table data file. Save iData as
          AVI movie/PPTX/XLS/KML. Phonons:
          added thermochemistry and Tutorial
          ; PhonoPy support. Fix Python/iFit.
          ResLibCal:
          allow export as HTML report and more coordinate frame choices,
          added FLEXX config. List
            of tickets for this release. (Aug 22nd 2017)
       
      - 1.9: added structure optimisation step before
          the phonon calculation in ab-initio DFT
            phonon dispersion Model. Added QE/ASE interface
          to Model Sqw. Faster phonon calculation using crystal
          symmetries. Improvements in S(q,w)
            treatment scripts. Data loaders
          for Mass Spectroscopy formats, ENDF
          and ACE nuclear data.
          Export iData/iFunc to HTML.
          Can now use SpinW
          objects as iFunc/Model. iData/iLoad can now import Horace Sqw
          files. New miFit user
          interface for data analysis [Load/Plot/Fit/Export], which
          allows 4D convolution/fit. ResLibCal
          has now a full Monte-Carlo resolution calculation using McStas templateTAS. (March 21st
          2017). List
            of Tickets for this release.
       
      - 1.8: read ILL
            Cyclops HBIN and IDL
          SAV files. Iterative deconvolution as deconv method.
          Major upgrade of ab-initio
            DFT phonon dispersion Model, which now supports EMT,
          GPAW, ABINIT, Elk, Dacapo, NWChem, QuantumEspresso and VASP
          when installed. S(q,w)
            treatment scripts to compare MD and measured dynamic
          structure factor, compute dynamic range, generalized density
          of states, total scattering cross sections, characteristic
          frequencies, powder average from 4D S(hkl,w). Full
          compatibility with Matlab releases >= R2014b (April 7th
            2016). Upgrade 1.8-3: Fix read_anytext
          to only use external 'looktxt': no more MeX (April 19th
            2016).
       
      - 1.7: OPUS
          FT-IR, LLB TAS, LabView LVM and TDMS file
          format import. Fixed curvature in ResLibCal/Rescal5/Popovici
          method. Added predefined TAS configurations in ResLibCal
          and cross-checked computation methods. Fix TAS angles in 3D
          view. Initial support for nD Gaussians and 4D TAS convolution.
          Added Gaussian smoothing.
          Compatibility with Matlab new graphic objects (R2014b). Better
          handling of arguments to standalone iFit.
          Added fill method to remove NaN's in
          iData objects. iFunc 4D
            S(q,w) models from either analytical or ab-initio
          methods (Oct 14th 2015).
       
      - 1.6: Fix to text loader (looktxt). Sanitized HDF
          and NetCDF, McStas import.
          Cross-checked and validated ResLibCal.
          iFunc models can now be used as objective function in optimization. Fixed iData/trapz style operators. fix R-factor estimate. (April 24 2014)
       
      - 1.5.1: fix for the importation of McStas/McXtrace files.
          Added technical
          documentation. Fix in binary iFunc operators (Guess). Fix for
          the R-factor determination. Fix in text importer (looktxt).
         
       
      - 1.5: Improved file
            importation system, JSON, and
          NetCDF/CDF/NeXus/HDF support, import/export of Mantid workspaces
          (HDF/NeXus), import of Igor
            pro wave files and Wavefront Obj
          3D. Installation through Debian
          repository. Much faster save to MAT files. New smooth, continuous wavelet transform,
          k-means, reshape and resize iData methods.
          Improvements in the iData processing speed and memory
          management. (Sept 29th 2013)
       
      - 1.4: PyFit Python
          interface. Fix in iData integration
          routines error bar propagation (trapz, sum, ...). Fix in
          iData/combine when monitors are default (1). Better detection
          of duplicated data sets from recursive iData/load.
          Fix in text import (supports
          NaN,Inf, faster by 15%). Fixed auto guess in gauss,lorz,... Models. Added proper Unit/integration
          test infrastructure. Fixed some methods for  iFunc objects with parameter names
          followed with comments. Support for McStas/mcdisplay as an
          Application.  (June 28th 2013)
         
      - 1.3.1: Support
          for loading CIF/CFL/ShelX structure, EZD/MRC/CCP4
          electron density formats.
          Load/save of YAML/JSON/XML files. New Rietveld model that
          uses a McStas neutron diffractometer model to convolve the
          structure factors and fit with diffractometer data. Added TAS
          neutron spectrometer resolution computation ResLibCal
          as an Application. iData commandhistory can be saved as a Matlab script. Added nlorz and ngauss Models. Fix of iData/combine with scalar
          Monitor values. Better memory handling in iData/load.
          iFunc support parameter constraints
          fix/min/max/assign as object.<par>=<value>.
          Fix in reading text files with changing columns number.
          Execution speed improvement in all object operators. Allow fitting of event data sets.
           
      - 1.3: Support
          for SIF, MarCCD, Roper
            SPE ADSC
          X-ray CCD. Export to X3D,
          fix for some text file import, support for the Parallel
            Computing Toolbox (when available), improved
          interpolation, added meshgrid,
          rotate, radial
          integration (cart2sph), better
          support for event files, save of iFunc models to m-files.
          Added simple models for small
            angle scattering form factors and structure factors.
          Improved McStas/McXtrace support.
          Embedded help system, array and graphics editor in standalone version. Save object history
          to script file (Nov. 29th
            2012).
         
      - 1.2: Support
          for reading PLY, STL, OFF geometry files (vertices/faces).
          Improved import of text/ascii files containing numerics.
          Standalone iFit distributable
          software. Speed-up by a factor x2.5. New iFunc
          model objects. Improved Optimizers and fitting. Reading of
          Chalk River CNBC
          data files, improved recursive reading of sub-directories and
          handling of iData arrays. New colormap plotting
          method. Improvements in the Optimizers/McStas plotting. Speed
          up by +12% (March 16th, 2012)
           
       
      - 1.1: new
          methods (save, diff, hyperbolic functions),
          fix of the Levenberg-Marquardt
            optimizer, improved Error propagation for unary
          operators, support for import of
          Analyze MRI (hdr/img) and Crystallographic Binary File (cbf)
          format, import post-process for HDF RITA2@PSI files, direct
          drag-drop data files using the open{ext} functions with Matlab
          >= 2010, added many fit models
          including 2D functions signal=f(x,y).
          Improved speed by e.g. +25% (Feb
            14th 2012). significant performance improvements
          (speedup by factor 2-10).
            (Oct 24th 2011). new fit criteria (others than
          least-square), link
          as external/distant resources, better INX import
          anchor in file names
          for selective import, plenty of new fit
            functions, a few bug fixes (e.g. McStas 2D labels). (Sept 22nd 2011). McStas data files with Parameter
          member. New waterfall
          plot stype for 3D data sets (Sept
            6th, 2011). Added correlation function method, plus a
          number of minor improvements (esp. in plot contextual menus),
          and bug fix for McStas 1D data set import (August 26th 2011)
         
      - 1.0: First
          official iFit release (August
            16th 2011)
       
    
    Bugs list:
    You may test the package integrity
      by issuing the command:
    
    >> ifittest
     which will test, in a few minutes,
      all the examples given in this documentation and report failures.
      The test may be aborted by closing the progress bar window.
      
      Please report bugs to 
ifit-users@mccode.org
      or to me 
[farhi (at) ill.fr].
      You are encouraged to register to the 
ifit-users
      list.
    
 
    File path names do
      not support spaces
    Under Windows systems, file names including spaces, such as in 'My Documents' may not be
      supported properly. In this case, move your files and directories
      to another location which does not contain spaces.
    
    Data set maximum
      size
    The iFit package may currently handle routinely data sets up to few
    Gb. Larger data sets can still be loaded, but are restricted by the
    disk access and the available memory. Some file formats are limited
    to 2 Gb size. We recommend to use SSD to load files with increased
    efficiency.
    CDF files written
      by Matlab can not be read by other software (hdfview, ncBrowse)
    The CDF
    format (which you can view with OpenDX and Autoplot) is incompatible with the
    NetCDF
    one (which you can e.g. view with ncview,
    hdfview,
    ncBrowse, Panoply). In
    such cases, we recommend to rather export in HDF5 format with:
    >> save(object, 'file.hdf5')
    Convolution brings
      strange results (Models/fconv)
    
    The fconv function (FFT convolution) provided in the Models sub-library requires the two signals
    sampling not to be too coarse. Axes values too sparse will lead to
    inaccurate results. One solution is to re-sample the signals with
    more points. For iData objects, this can
    be achieved with e.g. the interp(object,
      3) to triple the number of points along axes.
    Too many warnings
      displayed
    If the warnings being displayed produce too much output, you may
    reduce the level of verbosity with:
    >> warning off backtrace	% reduce the warning message length
>> warning off			% suppress all warnings (not recommended)
    Execution/compilation
      issue with text files importer (iLoad/iData/load, looktxt,
      CrysFML/cif2hkl)
    You should first try the automatic fix procedure:
    >> iLoad('force')	% checks and possibly re-compiles text and CBF importers
>> iLoad('compile')	% fully re-compiles text and CBF importers
    The recompilation tries to:
    
      - use the matlab mex command (requires a valid C
        compiler supported by Matlab) ;
       
      - use of any other C compiler such as gcc, ifc,
        pgcc, clang/llvm, tcc;
 
      - use any Fortran compiler such as gfortran, g95, pgfc, ifort.
 
    
    Most systems provide a default C compiler. 
    
      - Linux systems usually ship with gcc.
 
      - MacOSX systems require to install the Xcode development tools,
        or the HPC GCC suite. 
 
      - Windows 32 systems may use the LCC compiler shipped with
        Matlab. 
 
      - Windows 64 systems must have Microsoft Visual C++ installed
        (refer to the Install
        page for the procedure).
 
    
    You may need to select the compiler with the mex -setup
    command from Matlab, but as said above, any other compiler can be
    used.
    
    In some cases, the provided iFit/Loaders/private/looktxt commands
    may fail to execute (wrong architecture, missing library). 
    Under Windows 64bit systems, you may need the Visual C++ runtime
    libraries e.g. msvc[mpr]90.dll which are provided with the
    Visual C++ installation (see below), to put in the Windows system
    directory.
     
    
    It has been reported that MeX compilation may fail when spaces are
    part of the path name to the iFit location (esp. under Windows
    systems). Move iFit to an
    other location which does not include spaces in its name (e.g. avoid
    My Documents) for
    compilation.
    
    Manual compilation
    
    If all this fails, you can try a manual compilation as follows.
    
    A C compiler is required to make use of the generic text importer looktxt.
    Navigate to the iFit/Libraries/Loaders/private
    directory, and issue:
    
      # gcc -O2 -o looktxt looktxt.c -lm
    
    A Fortran compiler is required when using cif2hkl (CIF,CFL,PCR,ShelX files), especially for
    the Rietveld model function. Navigate to the iFit/Scripts/Models/scattering/powder_diffraction
    directory and issue:
    # gfortran -O2 -o cif2hkl cif2hkl.F90 -lm
    which creates a cif2hkl executable file, used by iFit.
    Remove the collateral *.mod files.
    
    Once done, check from iFit:
    >> iLoad('force')	% checks and possibly re-compiles text and CBF importers
    Refer to the related item in the Install page.
    Limitations in the
      standalone (binary) package
    When running the standalone version (binary), new Matlab functions
    can not
    be defined, except anonymous functions (inline). You may use iFunc
    models as a substitute. Also, the doc,
      web and edit
    commands are limited, and may not work properly, depending on the
    system.
    McStas and
      external programs can not be found from Matlab/iFit
    The location of executable programs available from the system are
    stored in the PATH environment variable. But on some systems (e.g.
    MacOSX), this variable is not fully initialised when used from
    Matlab/iFit.
    
    The following issue may show-up for any external program launched
    from Matlab/iFit, e.g. McStas,
    PHON,
    Quantum Espress, ASE. We detail the case
    of 'mcstas'.
    
    To diagnose this issue, open a Terminal, and test if e.g. 'mcstas'
    is properly installed (the example below if for MacOSX/Linux):
    
      % mcstas -v
mcstas-2.3-rc2 version 2.3-rc2 (Nov. 16, 2015)
Copyright (C) DTU Physics and Risoe National Laboratory, 1997-2015
Additions (C) Institut Laue Langevin, 2003-2015
All rights reserved
% which mcstas
/usr/bin/mcstas
    
    Then you need to add the path to 'mcstas' executables inside the
    PATH variable seen from Matlab. 
    Type, from Matlab/iFit prompt:
    
      >> setenv('PATH', [getenv('PATH') ':/usr/local/bin' ':/usr/bin' ':/usr/share/bin' ]);	% under MacOSX and Linux
>> setenv('PATH', [getenv('PATH') 'C:\mcstas\bin' ]);	% under Windows
    
    Once done, e.g. McStas and
    other programs will be immediately reachable from Matlab/iFit. 
    This procedure may have to be repeated whenever Matlab/iFit is
    (re)started.
    
    iFit standalone
      can not be launched (libmwmclmcrrt.so)
    
    When starting iFit standalone, you get a
      message such as:
    
    ./run_ifit: error while loading shared libraries: libmwmclmcrrt.so: cannot open shared object file: No such file or directory
    This message indicates that the Matlab Runtime Library has not
      been found. Instal the MCR as indicated in the Install page. You may have to edit the
      'ifit' command and set the location of the MCR. Alternatively, you
      can set the MCRROOT environment variable to point to it, e.g.
      under bash (Linux/Mac OSX):
    
    
      - export MCRROOT="/opt/MATLAB/MATLAB_Compiler_Runtime/v713"
 
    
    iFit crashes when
      typing special characters (accents, ...)
    The iFit standalone (compiled version)
      can be used from the prompt/command line, within a terminal.
      However, the Matlab readline library can not handle
      properly localised characters (e.g. with accents, for specific
      languages) [bug
        624817]. 
    
    You thus have to be cautious when typing, to avoid e.g. à, ä, ø,
      ñ and so on, or an immediate crash will occur, without saving your
      work, and save your work regularly. US keyboard characters are all
      fully supported.
    
    
    iFit fails with a
      message such as 'version `GFORTRAN_1.4' not found'
          or 'version `GCC_4.3.0' not found'
      
    Matlab comes with its own C and Fortran libraries (e.g. in
    MATLABROOT/sys/os/<arch>/). Some of these
    may not match those from the running system (seen on Linux systems).
    
    
    The following issue may show-up for any external program launched
    from Matlab/iFit, e.g. McStas,
    PHON,
    Quantum Espress, ASE, looktxt, cif2hkl.
    In this case, as e.g. McStas runs from a Matlab environment that
    overloads libraries on top of the normal libraries from the system -
    used by external programs - you may get a message such as (here libgfortran.so
    is faulty) :
    Can't load '/usr/local/lib/perl/5.12.4/auto/PGPLOT/PGPLOT.so' for module PGPLOT: 
/usr/local/MATLAB/R2012a/sys/os/glnxa64/libgfortran.so.3: version `GFORTRAN_1.4' not found 
(required by /usr/lib/libpgplot.so.5) at /usr/lib/perl/5.12/DynaLoader.pm line 192. 
at /usr/local/lib/mcstas/tools/perl/mcstas_config.perl line 123
    A similar message has also been reported for the libgcc_s.so library with error e.g. 'version `GCC_4.3.0' not found'.
    
    On an Apple Mac OS X system, the faulty library is e.g.
    /Applications/MATLAB_R2010a.app/sys/os/maci64/libgfortran.3.dylib
    
    In order to solve this, you need to either remove or update the
    faulty Matlab libraries with the one from the system. The following
    procedure is valid for Linux systems (where it was identified),
    assuming Matlab has been installed in e.g. MATLABROOT =
    /usr/local/MATLAB/R2012a - but it may also be in e.g.
    /opt/MATLAB/R2012a.
    
    The first attempt is to simply rename the faulty library
    shipped with Matlab, e.g. (you may also remove it):
    # sudo mv /usr/local/MATLAB/R2012a/sys/os/glnxa64/libgfortran.so.3 /usr/local/MATLAB/R2012a/sys/os/glnxa64/libgfortran.so.3.org
    or
    # sudo mv /usr/local/MATLAB/R2012a/sys/os/glnxa64/libgcc_s.so.1 /usr/local/MATLAB/R2012a/sys/os/glnxa64/libgcc_s.so.1.org
    
    Then restart Matlab/iFit to check if the issue is solved.
    
    If this is still not solved, we then look for locations of
    the faulty library in the system (requires package locate or mlocate to be installed -
    alternatively you can use ldconfig
      -v and look where libgfortran
    appears in the long list...)
    # locate libgfortran.so
/usr/lib/x86_64-linux-gnu/libgfortran.so.3 <- this is the library from the system, to put in the Matlab location
    Then we first make a copy of the initial Matlab library to update
    # sudo mv /usr/local/MATLAB/R2012a/sys/os/glnxa64/libgfortran.so.3 /usr/local/MATLAB/R2012a/sys/os/glnxa64/libgfortran.so.3.org
    Then we copy the library from the system into the Matlab location
    # sudo ln -s /usr/lib/x86_64-linux-gnu/libgfortran.so.3 /usr/local/MATLAB/R2012a/sys/os/glnxa64/
    Then, you need to restart Matlab/iFit to notice the issue has been
    fixed.
    Import of a text
      file fails
    You can try the automatic fix procedure:
    >> iLoad('force')	% checks and possibly re-compiles text and CBF importers
>> iLoad('compile')	% fully re-compiles text and CBF importers
    If this fails, then first check that the looktxt command is
    working (this will appear in the error message). If not, remove the
    invalid one (in iFit/Libraries/Loaders/private) and restart the
    importation. A new external command will be compiled from the source
    (requires a valid compiler, see above).
    
    If the executable looktxt is valid, but you can not import a
    reluctant text file, try
    the most tolerant text reader configurations:
    >> iData('filename','text format with fast import method')
>> iData('filename','Data (text format)')
    will import the raw content, without post formatting of the object
    in memory. You will probably need to assign manually some of the
    Signal and Axes (see iData object help).
    
    Text files containing NaN's inside
      matrices are not imported properly in iFit version <=
    1.6 (NaN is read as a text inside a matrix, and thus breaks the
    matrix into bits). One way is to replace all NaN's by 0 values. This
    also stands for Inf's and other text embedded inside
    numerical blocks.
    Model sqw_phonon
      fails with Dacapo/Jacapo and MPI
    You should check the executable 'dacapo_mpi.run' from the command
    line. If an error message indicates missing libraries 'libmpi_f90.so.0'
    and 'libmpi_f77.so.0', then first check that openmpi
    is installed and identify the actual library with e.g.:
    
      % locate libmpi_f77.so
      /usr/lib/libmpi_f90.so.1
    
    then create a soft link from the existing library to the missing
    one:
    
      % sudo ln -s /usr/lib/libmpi_f90.so.1 /usr/lib/libmpi_f77.so.0
    
     Warning: We do not recommend using
    Dacapo/Jacapo, as this software is not maintained anymore.
    Matlab crashes when
      displaying 3D plots
    Since Matlab R2014b, the underlying infrastructure for display of
    plots has been fully revamped. As a consequence, displays are much
    nicer, but also much slower to render. Also, depending on the
    graphics card/driver installed on the computer, Matlab may crash
    with messages such as:
    
      Nativewindow X11 IOError: Display 0x7f44e040e8b0 (:0.0): Bad address
      MATLAB: javainit.cpp:1411: void {anonymous}::mwJavaAbort(): Assertion `Fatal Java Exception.  See Java Crash Report for details.' failed.
    
    A way to get things fixed is to switch to the software OpenGL
    rendering. Start Matlab and type immediately:
    
    then exit Matlab and restart it.
    
    The immediate consequence is that all works (good), but also it gets
    even slower (!!!). Calculations are not affected.
    
    Alternate solution for Linux
    
    A very effective and simple solution under Linux/Debian is to
    install the 'matlab-support' package for both matlab and/or iFit:
    
      - sudo apt install matlab-support
 
    
    then specify the Matlab directory path, such as:
    
      - /opt/MATLAB/R2010A
 
      - /opt/MATLAB/MATLAB_Compiler_Runtime/v713/
 
    
    You may use that fix for more than one Matlab/iFit installation
    typing again:
    
      - sudo dpkg-reconfigure matlab-support
 
    
    Matlab rendering
      is poor
    If you get messages such as:
    Warning: OpenGL appears to be installed
      incorrectly.
    
    or
    libGL error: unable to load driver:
      radeonsi_dri.so
    
    and the rendering is not so nice (e.g. slow and no transparency),
    then you may overcome this issue by launching the matlab and
    ifit commands with e.g.:
    LD_PRELOAD='/usr/$LIB/libstdc++.so.6' ifit
    
    and
    LD_PRELOAD='/usr/$LIB/libstdc++.so.6' matlab
    
    This overrides the C library shipped with Matlab/iFit in order to
    use the system one (which e.g. works better with the installed
    graphics cards).
    
    The iFit / Matlab launchers (e.g. /usr/share/applications/ifit.desktop)
    should be updated accordingly at the line 'Exec':
    
      [Desktop Entry]
...
Exec=env LD_PRELOAD='/usr/$LIB/libstdc++.so.6' ifit -nodesktop %F
    
    miFit/matlab
      crashes when starting/loading/saving
    The storage class for iData and iFunc has changed. This makes old
    '.mat' files crash when imported. To solve this issue, you should
    start a previous version of iFit (e.g. 1.10) and export your objects
    into e.g. HDF5 files. Then, with the new iFit version, import back
    this files to recreate the same iData objects.
    
    With miFit, you may reset the application with:
    
    which fully resets its configuration and data to the factory
    settings. Your existing data stored in miFit will be lost.
    Alternatively, you may start an older iFit version (e.g. 1.10), and
    export the workspace items into e.g. HDF5. Then start the new miFit
    interface (from iFit 2.x), and load the HDF5 files in the workspace.
    
    
    
      E.
Farhi
          - iFit/Changes - 
          Nov. 27, 2018 2.0.2  -
        back to 
Main iFit Page