Tutorial: MAGIX function

The function starts the MAGIX program.
 

Input parameters:

  • MAGIXExpXML: path and name of the experimental xml-file.

  • MAGIXInstanceXML: path and name of the instance xml-file

  • MAGIXFitXML: path and name of the xml file controlling the fitting process

  • MAGIXRegXML: path and name of the so-called registration xml file containing the description of the input and output files of the external model program

  • MAGIXOption: option for the MAGIX run (default is ""):
    • "" (default): all informations are printed out to the screen
    • quiet: no informations are printed to the screen except warning and error messages
    • plotsaveonly: MAGIX disables the interactive GUI of matplotlib but creates all plots and saves them into files
    • debug: Stop MAGIX after the first function call. This flag can be very helpful to analyze problems occurring with the call of the external model program.

Output parameters:

  • JobDir: absolute path of the job directory created for the current run.
     

Examples:

  • list all transitions within given frequency range

    # In CASA:
    MAGIXExpXML = "path-to-XCLASS/demo/MAGIX/TwoOscillators_RefFit_R.xml"
    MAGIXInstanceXML = "path-to-XCLASS/demo/MAGIX/parameters.xml"
    MAGIXFitXML = "path-to-XCLASS/demo/MAGIX/Levenberg-Marquardt_Parameters.xml"
    MAGIXRegXML = "path-to-XCLASS/Fit-Functions/Drude-Lorentz_conv/xml/Conventional_Drude-Lorentz.xml"
    MAGIXOption = " "
    JobDir = MAGIX()
    
    

    Output:

    Start function MAGIX:
    
    
    Creating job directory for current myXCLASS run: path-to-xclass/run/MAGIX/job__14-06-2017__21-57-06__69257140/ .. done!
    
    All files of the current MAGIX run are stored here!
    
    
    
    
    Copy instance xml-file to MAGIX temp directory path-to-xclass/run/MAGIX/job__14-06-2017__21-57-06__69257140/ .. done!
    Copy algorithm xml-file to MAGIX temp directory path-to-xclass/run/MAGIX/job__14-06-2017__21-57-06__69257140/ .. done!
    Copy experimental xml-file to MAGIX temp directory path-to-xclass/run/MAGIX/job__14-06-2017__21-57-06__69257140/ .. done!
    Make paths of all data files defined in the experimental xml-file absolute .. done!
    Copy all experimental data file(s) defined in the experimental data file to MAGIX temp directory path-to-xclass/run/MAGIX/job__14-06-2017__21-57-06__69257140/ and modify xml-file .. done!
    
    
    Create io-control xml-file .. done!
    Read i/o control file.
    	 Open control file: path-to-xclass/run/MAGIX/job__14-06-2017__21-57-06__69257140/io_control.xml
    	 Reading control parameters .. done!
     
    	 experimental_data:   path-to-xclass/run/MAGIX/job__14-06-2017__21-57-06__69257140/TwoOscillators_RefFit_R.xml
    	 parameter_file:      path-to-xclass/run/MAGIX/job__14-06-2017__21-57-06__69257140/parameters.xml
    	 fit_control:         path-to-xclass/run/MAGIX/job__14-06-2017__21-57-06__69257140/Levenberg-Marquardt_Parameters.xml
    	 fit_log:             path-to-xclass/run/MAGIX/job__14-06-2017__21-57-06__69257140/fit.log
    	 model_description:   path-to-xclass/programs/MAGIX/Fit-Functions/Drude-Lorentz_conv/xml/Conventional_Drude-Lorentz.xml
    
    Import experimental file using settings declared in the xml-file.
    	 Open xml-file: path-to-xclass/run/MAGIX/job__14-06-2017__21-57-06__69257140/TwoOscillators_RefFit_R.xml for experimental file import.
    	 Reading file ..
    
    	 Import settings:
    
    	 NumberExpFiles =  1
    	 Experimental file number:  1
    	 FileNamesExpFiles[0] = path-to-xclass/run/MAGIX/job__14-06-2017__21-57-06__69257140/TwoOscillators_RefFit_R.dat
    	 NumberExpRanges[0]   = 1
    	 MinExpRange[0][0]    = [50.0]
    	 MaxExpRange[0][0]    = [1000.0]
     
    	 Reading ASCII-file path-to-xclass/run/MAGIX/job__14-06-2017__21-57-06__69257140/TwoOscillators_RefFit_R.dat .. done!
     
    	 File Nr.:  1
    		 LengthExpRange[1] = 950
    		 ExpDataX[1][0] = [ 50.]
    		 ExpDataX[1][LengthExpRange] = [ 1000.]
    		 ExpDataY[1][0] = [ 0.09108]
    		 ExpDataY[1][LengthExpRange] = [ 0.04392]
     
    Read the xml-file containing the start values for the fit process.
    	 Open xml-file: path-to-xclass/run/MAGIX/job__14-06-2017__21-57-06__69257140/parameters.xml
    	 Reading file .. done!
    
    	 FitParametersNumber =  8
    	 FitParameters =  [[2.5, 2, 150.0, 200.0, 10.0, 600.0, 400.0, 10.0], [0, 0, 0, 1, 1, 0, 1, 1], ['0', '0', '0', '0', '0', '0', '0', '0'], ['10', '100', '1000', '1000', '1000', '1000', '1000', '1000']]
    	 FitParameterName =  ['EpsilonInfinity[[1]]', 'NumberOscillators[[1]]', 'EigenFrequency[[1]]', 'PlasmaFrequency[[1]]', 'Damping[[1]]', 'EigenFrequency[[2]]', 'PlasmaFrequency[[2]]', 'Damping[[2]]']
    
    Start fit process.
    	 Open fit-control file: path-to-xclass/run/MAGIX/job__14-06-2017__21-57-06__69257140/Levenberg-Marquardt_Parameters.xml
    	 Reading fit control parameters .. done!
     
    	 NumberOfFitAlgorithms:    1
    	 algorithm:                levenberg-marquardt
    	 Special algorithm settings: [2, 0.001]
    	 chilm:                    1e-07
    	 numrange:                 0
    	 numiter:                  20
    	 NumberProcessors:         8
    	 MPI host file:            
    	 DeterminationChi2:        default
    	 PlotOption:               ['normal', 'Frequency [cm$^{-1}$]', 'Reflectance', 'z-axis', 'no']
    	 Renormalized Chi^2:       yes
     
    	 Read the xml-description of the input and the output file of the chosen fit-function module.
    	 Open xml-description stored in file: path-to-xclass/programs/MAGIX/Fit-Functions/Drude-Lorentz_conv/xml/Conventional_Drude-Lorentz.xml
    	 The maximum number of groups in the registration file is set to MaxNumberOfGroups =  100
    	   If you use more groups in the registration file, please increase the variable MaxNumberOfGroups
    	   defined in line 2339 of the file Modules/magix-parts_python/FittingEngine.py
    
    	 Reading registration xml-file .. done!
     
    	 WARNING:
    	 The defined number of processors (8) 
    	 is larger than the number of available processors (4). 
    	 Reduce number of processors to the number of available processors.
     
    	 Number of Processors: 4 
     
             Writing registration mask for the fit model .. done!
     
     
             Temporary files are stored in: /dev/shm/moeller/job_69253430/
     
     
             Start Levenberg-Marquardt algorithm (SMP version) ..
     
     
               Renormalized limit for chi^2 =     9.3300000000E-05
     
     
               Using Numerical Recepies (NR) version!
     
     
               Iteration:                    chi^2:     alamda:     Parameter:
                        1     4.146650256764262E+00      1.E-04     1.973139158621755E+02,  2.691634682529142E+01,  3.719163886497902E+02,  1.770052027955023E+01
                        2     4.178855603288089E-01      1.E-05     1.593575801137591E+02,  3.086922078226792E+01,  3.082618459792574E+02,  6.633931189934566E+00
                        3     3.633119684738698E-01      1.E-06     1.167476687848677E+02,  5.935681163029031E+00,  3.034480633797393E+02,  6.041813366709920E+00
                        4     2.133661374780669E-02      1.E-07     1.196559531025190E+02,  9.564833528160545E+00,  3.029946162886080E+02,  5.998968424569728E+00
                        5     1.387108605852744E-04      1.E-08     1.200305177227736E+02,  1.089147791310344E+01,  3.029968834414155E+02,  5.999876575616630E+00
                        6     1.272858321597434E-08      1.E-09     1.200007923676226E+02,  1.099958426126912E+01,  3.029998376378692E+02,  6.000008057595156E+00
     
               Iteration stopped. chi^2 (=1.272858321597434E-08) dropped below limit = 9.329999999999999E-05
     
     
               Sorting chi2-log file .. done!                                                                                                                        
     
     
             Finished Levenberg-Marquardt algorithm!
     
     
    Write values of the fit function to files.
    	 Writing data to ASCII file path-to-xclass/run/MAGIX/job__14-06-2017__21-57-06__69257140/TwoOscillators_RefFit_R.LM.out.dat .. done!
    	 Writing chi^2 values to file path-to-xclass/run/MAGIX/job__14-06-2017__21-57-06__69257140/TwoOscillators_RefFit_R.LM.out.chi2.dat .. done!
    
    
    Write optimized model parameter to file.
    	 Open xml-file: path-to-xclass/run/MAGIX/job__14-06-2017__21-57-06__69257140/parameters.LM.out.xml
    	 Writing file .. done !
    
    
    Program finished!
    
    
    IMPORTANT:
    ----------
    
    All files of the current MAGIX run are stored in the MAGIX job directory: path-to-xclass/run/MAGIX/job__14-06-2017__21-57-06__69257140/