.\" Man page generated from reStructuredText. . .TH "NAVARP" "1" "Sep 30, 2021" "" "navarp" .SH NAME navarp \- navarp Documentation . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .SH ABSTRACT .INDENT 0.0 .TP \fBNav\fPigation tools for \fBA\fPngle \fBR\fPesolved \fBP\fPhotoemission spectroscopy data, \fIi.e.\fP: .INDENT 7.0 .IP \(bu 2 a \fBcompanion app\fP during ARPES data acquitision (as in beamtime); .IP \(bu 2 a set of \fBdedicated libs\fP helping to get high quality figures for publication. .UNINDENT .UNINDENT .sp \fIBy Federico Bisti, University of L\(aqAquila, Italy.\fP [image] .SH CONTENTS .SS Installation .sp Download and install the last Anaconda distribution for Python 3.x from \fI\%here\fP, it can be installed with or without admin privilege (just remind the chosen option for later). .sp After installation, few commands must be run in the proper \fBcommand line interface\fP before being able to use the NavARP package, and this \fBcommand line interface\fP depends on the operating system. .sp The \fBcommand line interface\fP corresponds to the \fBAnaconda Prompt\fP on Windows (that can be found in the Start menu after searching Anaconda Prompt or after opening the Anaconda Navigator), and to the \fBterminal\fP on macOS and Linux. .sp Regarding macOS, it might happen that after Anaconda installation the default Python version accessible from the terminal is still the default one from macOS (so not the one related to the Anaconda distribution). To check if it is the case, type and run \fBpython \-\-version\fP in the terminal. If the word \fBAnaconda\fP is not the printed lines, then Python is not of Anaconda and the installation cannot continue. To fix it, you can change the python environment by typing \fBconda activate\fP\&. Or (at your risk!), you can try to change your \fB\&.bash_profile\fP making sure that the Anaconda directory is the first one in the line beginning with \fBexport PATH=...\fP . .sp Therefore, launch the proper \fBcommand line interface\fP and run the following command to install igor (necessary for opening ibw and pxt files) and colorcet (it gives additional perceptually uniform colormap): .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C conda install \-\-channel conda\-forge igor colorcet .ft P .fi .UNINDENT .UNINDENT .sp Otherwise, add conda\-forge channel first and then install the packages: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C conda config \-\-append channels conda\-forge conda install igor colorcet .ft P .fi .UNINDENT .UNINDENT .sp After this step, NavARP must be installed as a package using pip. To do it with admin privilege (depending on the Anaconda installation), run the following command for the last stable version: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C pip install https://gitlab.com/fbisti/navarp/\-/archive/master/navarp\-master.zip .ft P .fi .UNINDENT .UNINDENT .sp Without administrator privilege run instead: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C pip install \-\-user https://gitlab.com/fbisti/navarp/\-/archive/master/navarp\-master.zip .ft P .fi .UNINDENT .UNINDENT .sp If you are brave enough you can also install the version still under development by using one of the two commands: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C pip install https://gitlab.com/fbisti/navarp/\-/archive/develop/navarp\-develop.zip pip install \-\-user https://gitlab.com/fbisti/navarp/\-/archive/develop/navarp\-develop.zip .ft P .fi .UNINDENT .UNINDENT .sp After this steps NavARP should run directly by typing in the \fBcommand line interface\fP the following command: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C navarp .ft P .fi .UNINDENT .UNINDENT .sp Instead, for getting familiar with the libraries, launch Jupyter Notebook from the Anaconda Navigator (or in proper \fIcommand line interface\fP run the command \fBjupyter notebook\fP) and open some examples which you can find in the \fI\%example folder\fP: .sp Finally, if you are familiar with \fBconda\fP you can also create a dedicated enviroment (for example \fBnavarp\-env\fP) and install only the basic packages using the following commands: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C conda create \-\-name navarp\-env numpy scipy matplotlib colorcet h5py pyqt=5 jupyter pyyaml click conda activate navarp\-env conda install \-c conda\-forge igor .ft P .fi .UNINDENT .UNINDENT .sp And then you can install it directly with: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C pip install https://gitlab.com/fbisti/navarp/\-/archive/master/navarp\-master.zip .ft P .fi .UNINDENT .UNINDENT .sp Or maybe you can also have it under control with \fBgit\fP, then do: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C conda install \-c conda\-forge git git clone https://gitlab.com/fbisti/navarp pip install \-e . .ft P .fi .UNINDENT .UNINDENT .sp The version under development will be installed and any modification in the local directory will affect the installed program. .SS Update .sp To update the NavARP project to the last version, run the following command for the last stable version: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C pip install https://gitlab.com/fbisti/navarp/\-/archive/master/navarp\-master.zip .ft P .fi .UNINDENT .UNINDENT .sp Or for the last version still under development run: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C pip install https://gitlab.com/fbisti/navarp/\-/archive/develop/navarp\-develop.zip .ft P .fi .UNINDENT .UNINDENT .SS Usage .sp The following documentation is covering only the basic commands in the NavARP GUI (\fBnavarp.py\fP). The independent usage of the \fBnavarp.utils\fP libraries is instead reported as Jupyter notebooks in the \fBexample\fP folder. .SS Loading data .sp NavARP can open the following data types: .INDENT 0.0 .IP \(bu 2 NXarpes file from LOREA/ALBA(ES) and I05/Diamond(GB); .IP \(bu 2 HDF5 file from SXARPES\-ADRESS/PSI(CH); .IP \(bu 2 NEXUS file from Antares/Soleil(FR) (only deflector scan); .IP \(bu 2 folder with txt\-files from Cassiopee/Soleil(FR); .IP \(bu 2 txt\-file from MBS A1Soft program; .IP \(bu 2 zip\- or txt\-file from Scienta\-Omicron SES program; .IP \(bu 2 sp2 file from Specs program; .IP \(bu 2 pxt, ibw and itx file of Igor\-pro as saved by Scienta\-Omicron SES program; .IP \(bu 2 txt file in itx format of Igor\-pro considering the order (energy, angle, scan); .IP \(bu 2 yaml file with dictionary to load files (txt, sp2 or pxt) in a folder or to only add metadata to a single file. .UNINDENT .sp To open the file click on the button on the top left and select the single file or, in the case collection of txt\-files from Cassiopee/Soleil(FR), select a ROI\-file inside the folder. To open a folder with a collection of txt\-files from MBS A1Soft, sp2\-files from Specs program, pxt\- or txt\-files from Scienta\-Omicron SES program, write first a yaml\-file inside that folder with the instruction for opening the file. If for example the folder contains "file_name_001.txt, file_name_002.txt, file_name_003.txt, etc." the related yaml\-file inside that folder (called for example \fBfile_name.yaml\fP) can be: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C # \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- # Required parameters # \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- # file_path, the * must to be exactly where the variable number is file_path: \(aqfile_name_*.txt\(aq # scans can be start and step (as below), or start and stop (replace step with stop) # in the case below, it starts from 20 with a step of 0.5 scans: start: 20 step: 0.5 # scan_type can be \(aqtilt\(aq, \(aqpolar\(aq, \(aqazimuth\(aq, \(aqdeflector\(aq or \(aqhv\(aq scan_type: \(aqazimuth\(aq # \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- # Optional parameters # \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- # photon energy, it can be specified and other value from the files will be discarded hv: 60 # analyzer, this define the analyzer geometry, if not specified default values will be used analyzer: tht_ap: 50 phi_ap: 0 work_fun: 4.5 deflector: False .ft P .fi .UNINDENT .UNINDENT .SS Navigate through the data .sp To navigate the data use the \fBNavigation panel\fP at the top right or \fBmouse right\-click\fP on the top (bottom) graph to change the energy (scan) value. .sp The mouse action can be only a single right\-click\-and\-release in a particular region or the right\-click can be kept pressed for a smooth movement to a final release point. .sp \fBImportant\fP, the right\-click mouse navigation works properly if the "pan/zoom" or "zoom rect" are not selected in the navigation toolbar at the bottom of the figure (the GUI start with neither of the two options selected). .sp With the mouse cursor on top of a graph (either top or bottom), use the \fBmouse scroll\fP to change the integration region for the iso\-value (energy or angle), each scroll step is doubling or halving such region. .SS Colormap scale .sp Color scale setting can be modified in the \fBColor scale parameters\fP tab on the right (click on the tab name if not already selected). .SS Fermi level .sp Fermi level can be determined in the \fBFermi level alignment\fP tab (click on the tab name if not already selected). .sp The "\fBNo Fermi level alignment\fP" option keep the data in kinetic energy (E_{kin}) or, in the case of photon energy scan, in binding energy (E_{bin}) as obtained from E_{bin} = E_{kin} \- (h\enu \- \ePhi), where h\enu is the photon energy and \ePhi is the analyzer work function. .sp "\fBUse Fermi level at\fP" uses the Fermi level inserted in the box below. "\fBFind Fermi level using\fP" looks for the Fermi level following the set\-up selected below where: "Energy range" can be all the available one (selecting the radio button on \fBfull\fP) or within the horizontal lines in the top panel (selecting \fBcursor\fP instead); the Fermi level can be the same for all the scan image (selecting "Scan value" \fBall\fP) or different values for each scan image, option particularly useful in photon energy scan ("Scan value" radio button on \fBeach\fP). .SS Transformation in the k\-space .sp In the \fBk\-space transformation\fP tab it is possible to set up all the parameters used for the transformation from angle to momentum scale (the method is based on the kinetic energy of the electrons and so it is independent from the Fermi level alignment). .sp The \fBfrom cursor\fP button auto\-fills the "Point in angles" with the actual cursor position in the figure. .sp The \fBset\fP \eGamma just put zeros in k_x and k_y\&. The inner potential (V0) is 10 by default, it is used only for the photon energy scan and so it must be properly modified only in that case. Use photons = yes to include the photon momentum for the determination of the initial electron momentum. In this case, the "Analyzer" parameters must be properly filled (\fBimportant\fP, at the present version, the "Analyzer" parameters, and so the photon momentum, are correctly defined only for beamlines LOREA/ALBA(ES) and SXARPES\-ADRESS/PSI(CH)). Once everything is properly set, it is possible to click the Iso\-E (k) blue button in the "Plot mode". .SS File information .sp \fBFile information\fP tab is the selected one by default after starting the GUI and it is reporting the information extracted from the data file. .SS Credits .SS Development Lead .INDENT 0.0 .IP \(bu 2 Federico Bisti <\fI\%federico.bisti@univaq.it\fP> .UNINDENT .SS Contributors .sp None yet. Why not be the first? .SS Contributing .sp Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given. .sp You can contribute in many ways: .SS Types of Contributions .SS Report Bugs .sp Report bugs at \fI\%Issue tracker\fP\&. .sp If you are reporting a bug, please include: .INDENT 0.0 .IP \(bu 2 Your operating system name and version. .IP \(bu 2 Any details about your local setup that might be helpful in troubleshooting. .IP \(bu 2 Detailed steps to reproduce the bug. .UNINDENT .SS Fix Bugs .sp Look through the \fI\%Issue tracker\fP for bugs. Anything tagged with "bug" and "help wanted" is open to whoever wants to implement it. .SS Implement Features .sp Look through the \fI\%Issue tracker\fP for features. Anything tagged with "enhancement" and "help wanted" is open to whoever wants to implement it. .SS Write Documentation .sp NavARP could always use more documentation, whether as part of the official NavARP docs, in docstrings, or even on the web in blog posts, articles, and such. .SS Submit Feedback .sp The best way to send feedback is to file an issue at \fI\%Issue tracker\fP . .sp If you are proposing a feature: .INDENT 0.0 .IP \(bu 2 Explain in detail how it would work. .IP \(bu 2 Keep the scope as narrow as possible, to make it easier to implement. .IP \(bu 2 Remember that this is a volunteer\-driven project, and that contributions are welcome :) .UNINDENT .SS Get Started! .sp Ready to contribute? Here\(aqs how to set up \fInavarp\fP for local development. .INDENT 0.0 .IP 1. 3 Fork the \fInavarp\fP repo on GitLab. .IP 2. 3 Clone your fork locally: .INDENT 3.0 .INDENT 3.5 .sp .nf .ft C $ git clone git@gitlab.com:your_name_here/navarp.git .ft P .fi .UNINDENT .UNINDENT .IP 3. 3 Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development: .INDENT 3.0 .INDENT 3.5 .sp .nf .ft C $ mkvirtualenv navarp $ cd navarp/ $ python setup.py develop .ft P .fi .UNINDENT .UNINDENT .IP 4. 3 Create a branch for local development: .INDENT 3.0 .INDENT 3.5 .sp .nf .ft C $ git checkout \-b name\-of\-your\-bugfix\-or\-feature .ft P .fi .UNINDENT .UNINDENT .sp Now you can make your changes locally. .IP 5. 3 When you\(aqre done making changes, check the code by using navarp.py and/or running the examples. .IP 6. 3 Commit your changes and push your branch to GitLab: .INDENT 3.0 .INDENT 3.5 .sp .nf .ft C $ git add . $ git commit \-m "Your detailed description of your changes." $ git push origin name\-of\-your\-bugfix\-or\-feature .ft P .fi .UNINDENT .UNINDENT .IP 7. 3 Submit a pull request through the GitLab website. .UNINDENT .SS Pull Request Guidelines .sp Before you submit a pull request, check that it meets these guidelines: .INDENT 0.0 .IP 1. 3 The pull request should include tests. .IP 2. 3 If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.rst. .UNINDENT .SS Deploying .sp A reminder for the maintainers on how to deploy. Make sure all your changes are committed (including an entry in CHANGELOG.rst). Then run: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C $ bump2version patch # possible: major / minor / patch $ git push $ git push \-\-tags .ft P .fi .UNINDENT .UNINDENT .SS Changelog .SS 1.0.0: 2021/04/11 .sp This is one of the most important release of NavARP, and the project is approaching to a more stable stage. This new version adds very important methods to the NavEntry class which are nicely shown in the now\-available examples gallery! In addition, the loading speed has been improved for many text\-based files input, and now the krx\-MBS format is also supported. Below a list of the main changes divided by modules: .INDENT 0.0 .IP \(bu 2 \fInavarp_gui.py\fP: .INDENT 2.0 .IP \(bu 2 Added more colorscale maps; .IP \(bu 2 After closing the program, its window size and position are saved (as a file called .navarp inside the user home directory) and they will be used to restore the program the next time it will be opened; .UNINDENT .IP \(bu 2 \fIutils.navfile\fP: .INDENT 2.0 .IP \(bu 2 Added support for krx\-MBS file format; .IP \(bu 2 Added support for ibw file format as saved by Scienta\-Omicron SES program; .IP \(bu 2 Added support for txt\-Scienta file format with 3 dimensions; .IP \(bu 2 Added support for igor\-pro text file format (saved as .itx or .txt); .IP \(bu 2 Loading speed of about x3 faster for txt\-based file input (txt from Scienta and MBS, sp2 from Specs); .IP \(bu 2 Added set_efermi method to NavEntry to set the efermi of the entry object; .IP \(bu 2 Added autoset_efermi method to NavEntry to automatically found the efermi by curve fitting; .IP \(bu 2 Added plt_efermi_fit method to NavEntry to show the autoset_efermi results; .IP \(bu 2 Added set_tht_an method to NavEntry to set the tht_an angle of the the entry object for k\-space tranformation; .IP \(bu 2 Added set_kspace method to NavEntry to set tht_an, phi_an, scans_0 and phi used in the k\-space tranformation; .IP \(bu 2 Added isoscan, isoenergy, isoangle and isok methods in the NavEntry calling the respectively classes in isomclass. .IP \(bu 2 Extended dictionary in yaml\-file, if loaded overwrite any attribute and efermi and tht_an can be also directly assigned. .UNINDENT .IP \(bu 2 \fIutils.isomclass\fP (new file): .INDENT 2.0 .IP \(bu 2 Added IsoScan class with the methods to show in a plot, export as NXdata or Igor\-pro text file, postprocessing as interpolation, second derivative and curvature; .IP \(bu 2 Added IsoEnergy class with the methods to show in a plot, export as NXdata or Igor\-pro text file, postprocessing as interpolation, second derivative and curvature; .IP \(bu 2 Added IsoAngle class with the methods to show in a plot, postprocessing as second derivative and curvature; .IP \(bu 2 Added IsoK class with the methods to show in a plot, export as NXdata or Igor\-pro text file, postprocessing as second derivative and curvature; .UNINDENT .IP \(bu 2 \fIutils.fermilevel\fP: .INDENT 2.0 .IP \(bu 2 Added fit procedure without using lmfit, lmfit is no longer required in navarp; .IP \(bu 2 Removed all the previous functions based on lmfit. .UNINDENT .IP \(bu 2 \fIutils.ktransf\fP: .INDENT 2.0 .IP \(bu 2 Removed all the deprecated functions for k\-space transformation. .UNINDENT .IP \(bu 2 \fIexamples directory\fP: .INDENT 2.0 .IP \(bu 2 The old example directory now is called examples and contains the python script to get the gallery. .UNINDENT .IP \(bu 2 \fIextras.simulation\fP: .INDENT 2.0 .IP \(bu 2 Added functions to simulate the graphene band structure probed by deflector and hv scans. .UNINDENT .IP \(bu 2 \fIrequirements.txt and setup.py\fP: .INDENT 2.0 .IP \(bu 2 Removed lmfit from the required packages. .UNINDENT .UNINDENT .SS 0.18.0: 2020/04/11 .sp This version gives the possibility to open four additional file formats. .INDENT 0.0 .IP \(bu 2 \fInavarp.py\fP (now renamed as \fInavarp_gui.py\fP): .INDENT 2.0 .IP \(bu 2 Added click command; .IP \(bu 2 Import navarp.utils, so now navarp requires installation with pip before usage; .IP \(bu 2 Renamed as navarp_gui.py so to avoid importing conflicts. .UNINDENT .IP \(bu 2 \fIutils.navfile\fP: .INDENT 2.0 .IP \(bu 2 Added loading MBS A1Soft text\-files; .IP \(bu 2 Added case scan_type=deflector for Lorea by reading defl_angles. .UNINDENT .IP \(bu 2 \fIsetup.py\fP: .INDENT 2.0 .IP \(bu 2 Added click command. .UNINDENT .UNINDENT .SS 0.17.0: 2020/08/14 .sp This version gives the possibility to open four additional file formats. .INDENT 0.0 .IP \(bu 2 \fInavarp.py\fP: .INDENT 2.0 .IP \(bu 2 Added .navarp configuration file saved in the local user home .IP \(bu 2 Set the initial default value of k\-transf to be without photons contribution .UNINDENT .IP \(bu 2 \fIutils.navfile\fP: .INDENT 2.0 .IP \(bu 2 Added loading Scienta\-Omicron SES zip and text files; .IP \(bu 2 Added loading Specs Prodigy sp2 files; .IP \(bu 2 Added loading Igor\-pro pxt files as saved by Scienta\-Omicron SES; .IP \(bu 2 Added loading folder with txt, sp2 or pxt files using instructions in a yaml file. .UNINDENT .IP \(bu 2 \fIsetup.py\fP: .INDENT 2.0 .IP \(bu 2 Improved requirements avoiding to install PyQt5 if in conda it is already present. .UNINDENT .UNINDENT .SS 0.16.0: 2020/08/05 .sp This version adds the sphinx\-doc integrated in GitLab pages and utils.kinterp. .INDENT 0.0 .IP \(bu 2 \fInavarp.py\fP: .INDENT 2.0 .IP \(bu 2 Added azimuth scan_type .IP \(bu 2 Added arctan2 value for sample alignment .IP \(bu 2 Fixed Antares data including the case of MBSAcquisition_1 .UNINDENT .IP \(bu 2 \fIutils\fP: .INDENT 2.0 .IP \(bu 2 Added \fIkinterp\fP .UNINDENT .UNINDENT .SH EXAMPLES .SS Examples gallery .sp Below is a gallery of examples .SS Simulated cone basic analysis .sp Simple workflow for analyzing a deflector scan data. The same workflow can be applied in the case of manipulator angular scans. .sp Import the "fundamental" python libraries for a generic data analysis: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C import numpy as np .ft P .fi .UNINDENT .UNINDENT .sp Import the navarp libraries: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C from navarp.utils import navfile .ft P .fi .UNINDENT .UNINDENT .sp Load the data from a file: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C file_name = r"nxarpes_simulated_cone.nxs" entry = navfile.load(file_name) .ft P .fi .UNINDENT .UNINDENT .sp Out: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C instrument_name = simulated .ft P .fi .UNINDENT .UNINDENT .sp Plot a single slice Ex: scan = 0.5 .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C scan = 0.5 entry.isoscan(scan).show() .ft P .fi .UNINDENT .UNINDENT [image: plot basic commands] [image] .sp Out: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C .ft P .fi .UNINDENT .UNINDENT .sp Fermi level determination .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C entry.autoset_efermi(energy_range=[93.8, 94.3]) entry.plt_efermi_fit() print("Fermi level = {:.3f} meV".format(entry.efermi)) print("Energy resolution = {:.0f} meV".format(entry.efermi_fwhm*1000)) print("hv = {:g} eV".format(np.squeeze(entry.hv))) .ft P .fi .UNINDENT .UNINDENT [image: plot basic commands] [image] .sp Out: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C /build/navarp\-uNOccK/navarp\-1.0.0/navarp/utils/fermilevel.py:67: RuntimeWarning: divide by zero encountered in true_divide ddata_s_denergies = ddata_s_denergies/np.abs(data_sum) /build/navarp\-uNOccK/navarp\-1.0.0/navarp/utils/fermilevel.py:67: RuntimeWarning: invalid value encountered in true_divide ddata_s_denergies = ddata_s_denergies/np.abs(data_sum) Fermi level at 93.8881 eV Energy resolution = 67.2 meV (i.e. FWHM of the Gaussian shape which, convoluted with a step function, fits the Fermi edge) Photon energy is now set to 98.4881 eV (instead of 100.0000 eV) Fermi level = 93.888 meV Energy resolution = 67 meV hv = 98.4881 eV .ft P .fi .UNINDENT .UNINDENT .sp Since now the Fermi level is known, the same plot is automatically aligned Ex: scan = 0.5 .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C scan = 0.5 entry.isoscan(scan).show() .ft P .fi .UNINDENT .UNINDENT [image: plot basic commands] [image] .sp Out: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C .ft P .fi .UNINDENT .UNINDENT .sp Plotting iso\-energetic cut Ex: isoenergy cut at ekin = efermi .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C ebin = 0 debin = 0.005 entry.isoenergy(ebin, debin).show() .ft P .fi .UNINDENT .UNINDENT [image: plot basic commands] [image] .sp Out: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C .ft P .fi .UNINDENT .UNINDENT .sp \fBTotal running time of the script:\fP ( 0 minutes 3.123 seconds) .SS Export isoenergy at the Fermi level .sp Simple workflow for exporting the isoenergy at the Fermi level. The data are a deflector scan on graphene as simulated from a third nearest neighbor tight binding model. The same workflow can be applied to any tilt\-, polar\-, deflector\- or hv\-scan. .sp Import the "fundamental" python libraries for a generic data analysis: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C import numpy as np .ft P .fi .UNINDENT .UNINDENT .sp Instead of loading the file as for example: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C # from navarp.utils import navfile # file_name = r"nxarpes_simulated_cone.nxs" # entry = navfile.load(file_name) .ft P .fi .UNINDENT .UNINDENT .sp Here we build the simulated graphene signal with a dedicated function defined just for this purpose: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C from navarp.extras.simulation import get_tbgraphene_deflector entry = get_tbgraphene_deflector( scans=np.linspace(\-5., 20., 91), angles=np.linspace(\-25, 6, 400), ebins=np.linspace(\-13, 0.4, 700), tht_an=\-18, phi_an=0, hv=120, gamma=0.05 ) .ft P .fi .UNINDENT .UNINDENT .SS Fermi level autoset .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C entry.autoset_efermi(scan_range=[\-5, 5], energy_range=[115.2, 115.8]) print("Energy of the Fermi level = {:.0f} eV".format(entry.efermi)) print("Energy resolution = {:.0f} meV".format(entry.efermi_fwhm*1000)) entry.plt_efermi_fit() .ft P .fi .UNINDENT .UNINDENT [image: plot export isoenergy as nxs or itx] [image] .sp Out: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C Fermi level at 115.4091 eV Energy resolution = 138.1 meV (i.e. FWHM of the Gaussian shape which, convoluted with a step function, fits the Fermi edge) Photon energy is now set to 120.0091 eV (instead of 120.0000 eV) Energy of the Fermi level = 115 eV Energy resolution = 138 meV .ft P .fi .UNINDENT .UNINDENT .SS Set the k\-space for the transformation .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C entry.set_kspace( tht_p=0.1, k_along_slit_p=1.7, scan_p=0, ks_p=0, e_kin_p=114.3, ) .ft P .fi .UNINDENT .UNINDENT .sp Out: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C tht_an = \-17.979 scan_type = deflector inn_pot = 14.000 scans_0 = 0.000 phi_an = 0.000 kspace transformation ready .ft P .fi .UNINDENT .UNINDENT .SS Export the Fermi surface: .sp First of all let\(aqs show it: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C entry.isoenergy(0, 0.02).show() .ft P .fi .UNINDENT .UNINDENT [image: plot export isoenergy as nxs or itx] [image] .sp Out: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C .ft P .fi .UNINDENT .UNINDENT .sp Then to be exported it mush be interpolated in a uniform grid. This can be done by defining kbins in the isoenergy definition, which is the number of points the momentum along the analyzer slit and the scan. In this case the number will be [1000, 800] and we will call such isoenergy object as isoatfermi. sphinx_gallery_thumbnail_number = 3 .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C isoatfermi = entry.isoenergy(0, 0.02, kbins=[1000, 800]) .ft P .fi .UNINDENT .UNINDENT .sp To show what we are going to save, the method is always the same: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C isoatfermi.show() .ft P .fi .UNINDENT .UNINDENT [image: plot export isoenergy as nxs or itx] [image] .sp Out: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C .ft P .fi .UNINDENT .UNINDENT .sp To export it as NXdata class of the nexus format uncomment this line: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C # isoatfermi.export_as_nxs(\(aqfermimap.nxs\(aq) .ft P .fi .UNINDENT .UNINDENT .sp To export it as igor\-pro text file (itx) uncomment this line: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C # isoatfermi.export_as_itx(\(aqfermimap.itx\(aq) .ft P .fi .UNINDENT .UNINDENT .sp \fBTotal running time of the script:\fP ( 0 minutes 20.597 seconds) .SS Export isoenergy at the Fermi level .sp Simple workflow for exporting the isoenergy at the Fermi level. The data are a deflector scan on graphene as simulated from a third nearest neighbor tight binding model. The same workflow can be applied to any tilt\-, polar\-, deflector\- or hv\-scan. .sp Import the "fundamental" python libraries for a generic data analysis: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C import numpy as np .ft P .fi .UNINDENT .UNINDENT .sp Instead of loading the file as for example: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C # from navarp.utils import navfile # file_name = r"nxarpes_simulated_cone.nxs" # entry = navfile.load(file_name) .ft P .fi .UNINDENT .UNINDENT .sp Here we build the simulated graphene signal with a dedicated function defined just for this purpose: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C from navarp.extras.simulation import get_tbgraphene_deflector entry = get_tbgraphene_deflector( scans=np.linspace(\-0.1, 0.1, 3), angles=np.linspace(\-25, 6, 400), ebins=np.linspace(\-13, 0.4, 700), tht_an=\-18, phi_an=0, hv=120, gamma=0.05 ) .ft P .fi .UNINDENT .UNINDENT .SS Fermi level autoset .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C entry.autoset_efermi(scan_range=[\-2, 2], energy_range=[115.2, 115.8]) print("Energy of the Fermi level = {:.0f} eV".format(entry.efermi)) print("Energy resolution = {:.0f} meV".format(entry.efermi_fwhm*1000)) entry.plt_efermi_fit() .ft P .fi .UNINDENT .UNINDENT [image: plot postprocessing isoscan] [image] .sp Out: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C Fermi level at 115.4065 eV Energy resolution = 143.7 meV (i.e. FWHM of the Gaussian shape which, convoluted with a step function, fits the Fermi edge) Photon energy is now set to 120.0065 eV (instead of 120.0000 eV) Energy of the Fermi level = 115 eV Energy resolution = 144 meV .ft P .fi .UNINDENT .UNINDENT .SS Set the k\-space for the transformation .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C entry.set_kspace( tht_p=0.1, k_along_slit_p=1.7, scan_p=0, ks_p=0, e_kin_p=114.3, ) .ft P .fi .UNINDENT .UNINDENT .sp Out: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C tht_an = \-17.979 scan_type = deflector inn_pot = 14.000 scans_0 = 0.000 phi_an = 0.000 kspace transformation ready .ft P .fi .UNINDENT .UNINDENT .SS Post processing on the isoscan: .sp First of all let\(aqs show it: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C entry.isoscan(0).show() .ft P .fi .UNINDENT .UNINDENT [image: plot postprocessing isoscan] [image] .sp Out: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C .ft P .fi .UNINDENT .UNINDENT .sp The second derivative can be obtained using sigma in the definition, which define the extension in points of the Gaussian filter used to then get the second derivative. In this case the sigma is different from zero only on the second element, meaning that the derivative will be performed only along the energy axis: sphinx_gallery_thumbnail_number = 3 .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C entry.isoscan(0, sigma=[0, 5]).show() .ft P .fi .UNINDENT .UNINDENT [image: plot postprocessing isoscan] [image] .sp Out: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C .ft P .fi .UNINDENT .UNINDENT .sp Only the Gaussian filtered image can be obtained using again sigma but also specifying the order=0, which by default is equal to 2 giving the second derivative as before.: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C entry.isoscan(0, sigma=[3, 5], order=0).show() .ft P .fi .UNINDENT .UNINDENT [image: plot postprocessing isoscan] [image] .sp Out: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C .ft P .fi .UNINDENT .UNINDENT .sp To export it as NXdata class of the nexus format uncomment this line: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C # entry.isoscan(0, 0, sigma=[3, 5], order=0).export_as_nxs(\(aqfermimap.nxs\(aq) .ft P .fi .UNINDENT .UNINDENT .sp To export it as igor\-pro text file (itx) uncomment this line: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C # entry.isoscan(0, 0, sigma=[3, 5], order=0).export_as_itx(\(aqfermimap.itx\(aq) .ft P .fi .UNINDENT .UNINDENT .sp \fBTotal running time of the script:\fP ( 0 minutes 1.881 seconds) .SS Interpolation on Graphene deflector scan .sp Simple workflow for the interpolation of data along a generic path in the k\-space from its isoenergy cuts. The data are a deflector scan on graphene as simulated from a third nearest neighbor tight binding model. The same workflow can be applied to any tilt\-, polar\-, deflector\- or hv\-scan. .sp Import the "fundamental" python libraries for a generic data analysis: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C import numpy as np import matplotlib.pyplot as plt .ft P .fi .UNINDENT .UNINDENT .sp Instead of loading the file as for example: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C # from navarp.utils import navfile # file_name = r"nxarpes_simulated_cone.nxs" # entry = navfile.load(file_name) .ft P .fi .UNINDENT .UNINDENT .sp Here we build the simulated graphene signal with a dedicated function defined just for this purpose: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C from navarp.extras.simulation import get_tbgraphene_deflector entry = get_tbgraphene_deflector( scans=np.linspace(\-5., 20., 91), angles=np.linspace(\-25, 6, 400), ebins=np.linspace(\-13, 0.4, 700), tht_an=\-18, phi_an=0, hv=120, gamma=0.05 ) .ft P .fi .UNINDENT .UNINDENT .SS Fermi level autoset .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C entry.autoset_efermi(scan_range=[\-5, 5], energy_range=[115.2, 115.8]) print("Energy of the Fermi level = {:.0f} eV".format(entry.efermi)) print("Energy resolution = {:.0f} meV".format(entry.efermi_fwhm*1000)) entry.plt_efermi_fit() .ft P .fi .UNINDENT .UNINDENT [image: plot interpolation gr deflector scan] [image] .sp Out: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C Fermi level at 115.4094 eV Energy resolution = 137.5 meV (i.e. FWHM of the Gaussian shape which, convoluted with a step function, fits the Fermi edge) Photon energy is now set to 120.0094 eV (instead of 120.0000 eV) Energy of the Fermi level = 115 eV Energy resolution = 138 meV .ft P .fi .UNINDENT .UNINDENT .SS Check for the Fermi level alignment .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C entry.isoscan(scan=0, dscan=0).show(yname=\(aqeef\(aq) .ft P .fi .UNINDENT .UNINDENT [image: plot interpolation gr deflector scan] [image] .sp Out: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C .ft P .fi .UNINDENT .UNINDENT .SS Plotting iso\-energetic cut at ekin = efermi .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C entry.isoenergy(0, 0.02).show() .ft P .fi .UNINDENT .UNINDENT [image: plot interpolation gr deflector scan] [image] .sp Out: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C .ft P .fi .UNINDENT .UNINDENT .SS Set the k\-space for the transformation .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C entry.set_kspace( tht_p=0.1, k_along_slit_p=1.7, scan_p=0, ks_p=0, e_kin_p=114.3, ) .ft P .fi .UNINDENT .UNINDENT .sp Out: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C tht_an = \-17.979 scan_type = deflector inn_pot = 14.000 scans_0 = 0.000 phi_an = 0.000 kspace transformation ready .ft P .fi .UNINDENT .UNINDENT .sp and check the isoenergy at the Fermi level: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C entry.isoenergy(0, 0.02).show() .ft P .fi .UNINDENT .UNINDENT [image: plot interpolation gr deflector scan] [image] .sp Out: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C .ft P .fi .UNINDENT .UNINDENT .SS Define the interpolation path points .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C kbins = 900 k_GK = 1.702 k_pts_xy = np.array([ [0, 0], [k_GK, 0], [k_GK*np.cos(np.pi/3), k_GK*np.sin(np.pi/3)+0.05], [0, 0] ]) kx_pts = k_pts_xy[:, 0] ky_pts = k_pts_xy[:, 1] klabels = [ r\(aq$\eGamma$\(aq, r\(aq$\emathrm{K}$\(aq, r\(aq$\emathrm{K}^{\eprime}$\(aq, r\(aq$\eGamma$\(aq ] .ft P .fi .UNINDENT .UNINDENT .sp and show them on the isoenergy at the Dirac point energy: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C entry.isoenergy(\-1.1, 0.02).show() plt.plot(kx_pts, ky_pts, \(aq\-+\(aq) .ft P .fi .UNINDENT .UNINDENT [image: plot interpolation gr deflector scan] [image] .sp Out: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C [] .ft P .fi .UNINDENT .UNINDENT .sp Run the interpolation defining an isok: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C isok = entry.isok(kx_pts, ky_pts, klabels) .ft P .fi .UNINDENT .UNINDENT .sp Show the final results with the executed path on the isoenergy: sphinx_gallery_thumbnail_number = 6 .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C fig, axs = plt.subplots(1, 2) entry.isoenergy(0, 0.02).show(ax=axs[0]) isok.path_show(axs[0], \(aqk\(aq, \(aqk\(aq, xytext=(8, 8)) qmesh = isok.show(ax=axs[1]) fig.tight_layout() fig.colorbar(qmesh) .ft P .fi .UNINDENT .UNINDENT [image: plot interpolation gr deflector scan] [image] .sp Out: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C .ft P .fi .UNINDENT .UNINDENT .sp \fBTotal running time of the script:\fP ( 0 minutes 21.724 seconds) .SS The old way analysis .sp Old workflow for analyzing a deflector scan data. This workflow use the all the function in the most explicit way without using any entry method. This is not a recommended workflow but it can help on understanding what it is behind the entry methods. .sp Import the "fundamental" python libraries for a generic data analysis: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C import numpy as np import matplotlib.pyplot as plt .ft P .fi .UNINDENT .UNINDENT .sp Import the navarp libraries: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C from navarp.utils import navfile, fermilevel, navplt, ktransf, isocut .ft P .fi .UNINDENT .UNINDENT .sp Load the data from a file: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C file_name = r"nxarpes_simulated_cone.nxs" entry = navfile.load(file_name) .ft P .fi .UNINDENT .UNINDENT .sp Out: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C instrument_name = simulated .ft P .fi .UNINDENT .UNINDENT .sp Plot a single slice Ex: scan = 0.5 .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C scan = 0.5 scan_ind = np.argmin(abs(entry.scans\-scan)) isoscan = isocut.maps_sum(scan, 0, entry.scans, entry.data) qmisoscan = navplt.pimage( entry.angles, entry.energies, isoscan, cmap=\(aqbinary\(aq, style=\(aqtht_ekin\(aq) .ft P .fi .UNINDENT .UNINDENT [image: plot cone old way] [image] .sp Fermi level determination .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C energy_range = [93.8, 94.3] data_sum = np.sum(entry.data, axis=tuple([0, 1])) popt = fermilevel.fit_efermi(entry.energies, data_sum, energy_range) efermi, res = popt[0], popt[1]*4 fig, axfit = plt.subplots(1) axfit.axvline(popt[0]) axfit.plot(entry.energies, data_sum, \(aq+\(aq) axfit.plot(entry.energies, fermilevel.fermi_fun(entry.energies, *popt), \(aqr\-\(aq) axfit.set_xlabel(r\(aqKinetic Energy (eV)\(aq) axfit.set_xlim(energy_range) dvis = data_sum[ (entry.energies >= energy_range[0]) & (entry.energies <= energy_range[1]) ] dvis_min = dvis.min() dvis_max = dvis.max() dvis_delta = dvis_max \- dvis_min axfit.set_ylim( dvis_min \- dvis_delta*0.05, dvis_max + dvis_delta*0.05 ) # Overwrite hv from the derived fermi level and the known work function hv_from_file = np.copy(entry.hv) entry.hv = np.array([efermi + entry.analyzer.work_fun]) print( "hv = {:g} eV (from the file was {:g})".format( np.squeeze(entry.hv), np.squeeze(hv_from_file)) ) print("Energy resolution = {:.0f} meV".format(res*1000)) .ft P .fi .UNINDENT .UNINDENT [image: plot cone old way] [image] .sp Out: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C /build/navarp\-uNOccK/navarp\-1.0.0/navarp/utils/fermilevel.py:67: RuntimeWarning: divide by zero encountered in true_divide ddata_s_denergies = ddata_s_denergies/np.abs(data_sum) /build/navarp\-uNOccK/navarp\-1.0.0/navarp/utils/fermilevel.py:67: RuntimeWarning: invalid value encountered in true_divide ddata_s_denergies = ddata_s_denergies/np.abs(data_sum) hv = 98.4881 eV (from the file was 100) Energy resolution = 67 meV .ft P .fi .UNINDENT .UNINDENT .sp Plot a single slice with fermi level alignment Ex: scan = 0.5 .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C scan = 0.5 scan_ind = np.argmin(abs(entry.scans\-scan)) isoscan = isocut.maps_sum(scan, 0, entry.scans, entry.data) qmisoscan = navplt.pimage( entry.angles, entry.energies\-efermi, isoscan, cmap=\(aqmagma_r\(aq, style=\(aqtht_eef\(aq) .ft P .fi .UNINDENT .UNINDENT [image: plot cone old way] [image] .sp Plotting iso\-energetic cut Ex: isoenergy cut at ekin = efermi .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C ekin = efermi dekin = 0.005 isoev = isocut.maps_sum(ekin, dekin, entry.energies, entry.data) qmisoev = navplt.pimage( entry.angles, entry.scans, isoev, cmap=\(aqmagma_r\(aq, style=\(aqtht_phi\(aq, cmapscale=\(aqlinear\(aq) .ft P .fi .UNINDENT .UNINDENT [image: plot cone old way] [image] .sp \fBTotal running time of the script:\fP ( 0 minutes 1.861 seconds) .SS Graphene deflector scan .sp Simple workflow for analyzing a deflector scan data of graphene as simulated from a third nearest neighbor tight binding model. The same workflow can be applied to any tilt\-, polar\- or deflector\-scan. .sp Import the "fundamental" python libraries for a generic data analysis: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C import numpy as np import matplotlib.pyplot as plt .ft P .fi .UNINDENT .UNINDENT .sp Instead of loading the file as for example: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C # from navarp.utils import navfile # file_name = r"nxarpes_simulated_cone.nxs" # entry = navfile.load(file_name) .ft P .fi .UNINDENT .UNINDENT .sp Here we build the simulated graphene signal with a dedicated function defined just for this purpose: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C from navarp.extras.simulation import get_tbgraphene_deflector entry = get_tbgraphene_deflector( scans=np.linspace(\-5., 5., 51), angles=np.linspace(\-7, 7, 300), ebins=np.linspace(\-3.3, 0.4, 450), tht_an=\-18, phi_an=0, hv=120 ) .ft P .fi .UNINDENT .UNINDENT .SS Plot a single analyzer image at scan = 0 .sp First I have to extract the isoscan from the entry, so I use the isoscan method of entry: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C iso0 = entry.isoscan(scan=0, dscan=0) .ft P .fi .UNINDENT .UNINDENT .sp Then to plot it using the \(aqshow\(aq method of the extracted iso0: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C iso0.show(yname=\(aqekin\(aq) .ft P .fi .UNINDENT .UNINDENT [image: plot gr deflector scan] [image] .sp Out: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C .ft P .fi .UNINDENT .UNINDENT .sp Or by string concatenation, directly as: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C entry.isoscan(scan=0, dscan=0).show(yname=\(aqekin\(aq) .ft P .fi .UNINDENT .UNINDENT [image: plot gr deflector scan] [image] .sp Out: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C .ft P .fi .UNINDENT .UNINDENT .SS Fermi level determination .sp The initial guess for the binding energy is: ebins = ekins \- (hv \- work_fun). However, the better way is to proper set the Fermi level first and then derives everything form it. The Fermi level can be given directly as a value using: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C entry.set_efermi(114.8) .ft P .fi .UNINDENT .UNINDENT .sp Or it can be detected from a fit using the method autoset_efermi. In both cases the binding energy and the photon energy will be updated consistently. Note that the work function depends on the beamline or laboratory. If not specified is 4.5 eV. .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C entry.autoset_efermi(scan_range=[\-5, 5], energy_range=[115.2, 115.8]) print("Energy of the Fermi level = {:.0f} eV".format(entry.efermi)) print("Energy resolution = {:.0f} meV".format(entry.efermi_fwhm*1000)) entry.plt_efermi_fit() .ft P .fi .UNINDENT .UNINDENT [image: plot gr deflector scan] [image] .sp Out: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C Fermi level at 115.4016 eV Energy resolution = 56.6 meV (i.e. FWHM of the Gaussian shape which, convoluted with a step function, fits the Fermi edge) Photon energy is now set to 120.0016 eV (instead of 120.0000 eV) Energy of the Fermi level = 115 eV Energy resolution = 57 meV .ft P .fi .UNINDENT .UNINDENT .SS Plot a single analyzer image at scan = 0 with the Fermi level aligned .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C entry.isoscan(scan=0, dscan=0).show(yname=\(aqeef\(aq) .ft P .fi .UNINDENT .UNINDENT [image: plot gr deflector scan] [image] .sp Out: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C .ft P .fi .UNINDENT .UNINDENT .SS Plotting iso\-energetic cut at ekin = efermi .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C entry.isoenergy(0).show() .ft P .fi .UNINDENT .UNINDENT [image: plot gr deflector scan] [image] .sp Out: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C .ft P .fi .UNINDENT .UNINDENT .SS Plotting in the reciprocal space (k\-space) .sp I have to define first the reference point to be used for the transformation. Meaning a point in the angular space which I know it correspond to a particular point in the k\-space. In this case the graphene Dirac\-point which is at ekin = 114.3 eV, in angle is at (tht_p, phi_p) = (0.1, 0) and in the k\-space has to correspond to (kx, ky) = (1.7, 0). .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C entry.set_kspace( tht_p=0.1, k_along_slit_p=1.7, scan_p=0, ks_p=0, e_kin_p=114.3, ) .ft P .fi .UNINDENT .UNINDENT .sp Out: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C tht_an = \-17.979 scan_type = deflector inn_pot = 14.000 scans_0 = 0.000 phi_an = 0.000 kspace transformation ready .ft P .fi .UNINDENT .UNINDENT .sp Once it is set, all the isoscan or isoenergy extracted from the entry will now get their proper k\-space scales: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C entry.isoscan(0).show() .ft P .fi .UNINDENT .UNINDENT [image: plot gr deflector scan] [image] .sp Out: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C .ft P .fi .UNINDENT .UNINDENT .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C entry.isoenergy(0).show() .ft P .fi .UNINDENT .UNINDENT [image: plot gr deflector scan] [image] .sp Out: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C .ft P .fi .UNINDENT .UNINDENT .sp I can also place together in a single figure different images: sphinx_gallery_thumbnail_number = 5 .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C fig, axs = plt.subplots(1, 2) entry.isoscan(0).show(ax=axs[0]) entry.isoenergy(0).show(ax=axs[1]) plt.tight_layout() .ft P .fi .UNINDENT .UNINDENT [image: plot gr deflector scan] [image] .SS Many other options: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C fig, axs = plt.subplots(2, 2) scan = 0.8 dscan = 0.05 ebin = \-0.4 debin = 0.05 entry.isoscan(scan, dscan).show(ax=axs[0][0], xname=\(aqtht\(aq, yname=\(aqekin\(aq) entry.isoscan(scan, dscan).show(ax=axs[0][1], cmap=\(aqbinary\(aq) axs[0][0].axhline(ebin\-debin+entry.efermi) axs[0][0].axhline(ebin+debin+entry.efermi) axs[0][1].axhline(ebin\-debin) axs[0][1].axhline(ebin+debin) entry.isoenergy(ebin, debin).show( ax=axs[1][0], xname=\(aqtht\(aq, yname=\(aqphi\(aq, cmap=\(aqcividis\(aq) entry.isoenergy(ebin, debin).show( ax=axs[1][1], cmap=\(aqmagma\(aq, cmapscale=\(aqlog\(aq) axs[1][0].axhline(scan, color=\(aqw\(aq) x_note = 0.05 y_note = 0.98 for ax in axs[0][:]: ax.annotate( "$scan \e: = \e: {} \epm {} \e; ^\ecirc$".format(scan, dscan), (x_note, y_note), xycoords=\(aqaxes fraction\(aq, size=8, rotation=0, ha="left", va="top", bbox=dict( boxstyle="round", fc=\(aqw\(aq, alpha=0.65, edgecolor=\(aqNone\(aq, pad=0.05 ) ) for ax in axs[1][:]: ax.annotate( "$E\-E_F \e: = \e: {} \epm {} \e; eV$".format(ebin, debin), (x_note, y_note), xycoords=\(aqaxes fraction\(aq, size=8, rotation=0, ha="left", va="top", bbox=dict( boxstyle="round", fc=\(aqw\(aq, alpha=0.65, edgecolor=\(aqNone\(aq, pad=0.05 ) ) plt.tight_layout() .ft P .fi .UNINDENT .UNINDENT [image: plot gr deflector scan] [image] .sp \fBTotal running time of the script:\fP ( 0 minutes 5.859 seconds) .SS Graphene hv scan .sp Simple workflow for analyzing a photon energy scan data of graphene as simulated from a third nearest neighbor tight binding model. The same workflow can be applied to any photon energy scan. .sp Import the "fundamental" python libraries for a generic data analysis: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C import numpy as np import matplotlib.pyplot as plt .ft P .fi .UNINDENT .UNINDENT .sp Instead of loading the file as for example: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C # from navarp.utils import navfile # file_name = r"nxarpes_simulated_cone.nxs" # entry = navfile.load(file_name) .ft P .fi .UNINDENT .UNINDENT .sp Here we build the simulated graphene signal with a dedicated function defined just for this purpose: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C from navarp.extras.simulation import get_tbgraphene_hv entry = get_tbgraphene_hv( scans=np.arange(90, 150, 2), angles=np.linspace(\-7, 7, 300), ebins=np.linspace(\-3.3, 0.4, 450), tht_an=\-18, ) .ft P .fi .UNINDENT .UNINDENT .SS Plot a single analyzer image at scan = 90 .sp First I have to extract the isoscan from the entry, so I use the isoscan method of entry: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C iso0 = entry.isoscan(scan=90) .ft P .fi .UNINDENT .UNINDENT .sp Then to plot it using the \(aqshow\(aq method of the extracted iso0: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C iso0.show(yname=\(aqekin\(aq) .ft P .fi .UNINDENT .UNINDENT [image: plot gr hv scan] [image] .sp Out: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C .ft P .fi .UNINDENT .UNINDENT .sp Or by string concatenation, directly as: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C entry.isoscan(scan=90).show(yname=\(aqekin\(aq) .ft P .fi .UNINDENT .UNINDENT [image: plot gr hv scan] [image] .sp Out: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C .ft P .fi .UNINDENT .UNINDENT .SS Fermi level determination .sp The initial guess for the binding energy is: ebins = ekins \- (hv \- work_fun). However, the better way is to proper set the Fermi level first and then derives everything form it. In this case the Fermi level kinetic energy is changing along the scan since it is a photon energy scan. So to set the Fermi level I have to give an array of values corresponding to each photon energy. By definition I can give: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C efermis = entry.hv \- entry.analyzer.work_fun entry.set_efermi(efermis) .ft P .fi .UNINDENT .UNINDENT .sp Or I can use a method for its detection, but in this case, it is important to give a proper energy range for each photon energy. For example for each photon a good range is within 0.4 eV around the photon energy minus the analyzer work function: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C energy_range = ( (entry.hv[:, None] \- entry.analyzer.work_fun) + np.array([\-0.4, 0.4])[None, :]) entry.autoset_efermi(energy_range=energy_range) .ft P .fi .UNINDENT .UNINDENT .sp Out: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C scan(eV) efermi(eV) FWHM(meV) new hv(eV) 90.0000 85.4000 58.5 90.0000 92.0000 87.3999 58.8 91.9999 94.0000 89.3995 59.6 93.9995 96.0000 91.4000 58.7 96.0000 98.0000 93.4004 58.5 98.0004 100.0000 95.3997 59.6 99.9997 102.0000 97.4000 59.1 102.0000 104.0000 99.3997 60.1 103.9997 106.0000 101.4007 58.5 106.0007 108.0000 103.4006 58.5 108.0006 110.0000 105.4002 59.4 110.0002 112.0000 107.4006 57.4 112.0006 114.0000 109.4006 58.9 114.0006 116.0000 111.4004 58.9 116.0004 118.0000 113.3998 59.5 117.9998 120.0000 115.4002 59.4 120.0002 122.0000 117.4009 57.7 122.0009 124.0000 119.4004 58.0 124.0004 126.0000 121.4001 58.9 126.0001 128.0000 123.4002 59.0 128.0002 130.0000 125.4004 58.6 130.0004 132.0000 127.4006 58.9 132.0006 134.0000 129.4005 57.3 134.0005 136.0000 131.4002 59.1 136.0002 138.0000 133.4001 58.7 138.0001 140.0000 135.4000 58.1 140.0000 142.0000 137.4007 57.6 142.0007 144.0000 139.4005 58.5 144.0005 146.0000 141.4004 57.8 146.0004 148.0000 143.4001 60.0 148.0001 .ft P .fi .UNINDENT .UNINDENT .sp In both cases the binding energy and the photon energy will be updated consistently. Note that the work function depends on the beamline or laboratory. If not specified is 4.5 eV. .sp To check the Fermi level detection I can have a look on each photon energy. Here I show only the first 10 photon energies: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C for scan_i in range(10): print("hv = {} eV, E_F = {:.0f} eV, Res = {:.0f} meV".format( entry.hv[scan_i], entry.efermi[scan_i], entry.efermi_fwhm[scan_i]*1000 )) entry.plt_efermi_fit(scan_i=scan_i) .ft P .fi .UNINDENT .UNINDENT .INDENT 0.0 .IP \(bu 2 [image: plot gr hv scan] [image] .IP \(bu 2 [image: plot gr hv scan] [image] .IP \(bu 2 [image: plot gr hv scan] [image] .IP \(bu 2 [image: plot gr hv scan] [image] .IP \(bu 2 [image: plot gr hv scan] [image] .IP \(bu 2 [image: plot gr hv scan] [image] .IP \(bu 2 [image: plot gr hv scan] [image] .IP \(bu 2 [image: plot gr hv scan] [image] .IP \(bu 2 [image: plot gr hv scan] [image] .IP \(bu 2 [image: plot gr hv scan] [image] .UNINDENT .sp Out: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C hv = 89.99998283633579 eV, E_F = 85 eV, Res = 59 meV hv = 91.9998627668236 eV, E_F = 87 eV, Res = 59 meV hv = 93.99949668680733 eV, E_F = 89 eV, Res = 60 meV hv = 96.00002470385328 eV, E_F = 91 eV, Res = 59 meV hv = 98.00040009140567 eV, E_F = 93 eV, Res = 59 meV hv = 99.99973916893491 eV, E_F = 95 eV, Res = 60 meV hv = 101.99995912743783 eV, E_F = 97 eV, Res = 59 meV hv = 103.99974209235835 eV, E_F = 99 eV, Res = 60 meV hv = 106.00073875670226 eV, E_F = 101 eV, Res = 58 meV hv = 108.0006350982113 eV, E_F = 103 eV, Res = 59 meV .ft P .fi .UNINDENT .UNINDENT .SS Plot a single analyzer image at scan = 110 with the Fermi level aligned .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C entry.isoscan(scan=110).show(yname=\(aqeef\(aq) .ft P .fi .UNINDENT .UNINDENT [image: plot gr hv scan] [image] .sp Out: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C .ft P .fi .UNINDENT .UNINDENT .SS Plotting iso\-energetic cut at ekin = efermi .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C entry.isoenergy(0).show() .ft P .fi .UNINDENT .UNINDENT [image: plot gr hv scan] [image] .sp Out: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C .ft P .fi .UNINDENT .UNINDENT .SS Plotting in the reciprocal space (k\-space) .sp I have to define first the reference point to be used for the transformation. Meaning a point in the angular space which I know it correspond to a particular point in the k\-space. In this case the graphene Dirac\-point is for hv = 120 is at ekin = 114.3 eV and tht_p = \-0.6 (see the figure below), which in the k\-space has to correspond to kx = 1.7. .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C hv_p = 120 entry.isoscan(scan=hv_p, dscan=0).show(yname=\(aqekin\(aq, cmap=\(aqcividis\(aq) tht_p = \-0.6 e_kin_p = 114.3 plt.axvline(tht_p, color=\(aqw\(aq) plt.axhline(e_kin_p, color=\(aqw\(aq) entry.set_kspace( tht_p=tht_p, k_along_slit_p=1.7, scan_p=0, ks_p=0, e_kin_p=e_kin_p, inn_pot=14, p_hv=True, hv_p=hv_p, ) .ft P .fi .UNINDENT .UNINDENT [image: plot gr hv scan] [image] .sp Out: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C tht_an = \-18.040 scan_type = hv inn_pot = 14.000 phi_an = 0.000 k_perp_slit_for_kz = 0.000 kspace transformation ready .ft P .fi .UNINDENT .UNINDENT .sp Once it is set, all the isoscan or iscoenergy extracted from the entry will now get their proper k\-space scales: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C entry.isoscan(120).show() .ft P .fi .UNINDENT .UNINDENT [image: plot gr hv scan] [image] .sp Out: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C .ft P .fi .UNINDENT .UNINDENT .sp sphinx_gallery_thumbnail_number = 17 .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C entry.isoenergy(0).show(cmap=\(aqcividis\(aq) .ft P .fi .UNINDENT .UNINDENT [image: plot gr hv scan] [image] .sp Out: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C .ft P .fi .UNINDENT .UNINDENT .sp I can also place together in a single figure different images: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C fig, axs = plt.subplots(1, 2) entry.isoscan(120).show(ax=axs[0]) entry.isoenergy(\-0.9).show(ax=axs[1]) plt.tight_layout() .ft P .fi .UNINDENT .UNINDENT [image: plot gr hv scan] [image] .SS Many other options: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C fig, axs = plt.subplots(2, 2) scan = 110 dscan = 0 ebin = \-0.9 debin = 0.01 entry.isoscan(scan, dscan).show(ax=axs[0][0], xname=\(aqtht\(aq, yname=\(aqekin\(aq) entry.isoscan(scan, dscan).show(ax=axs[0][1], cmap=\(aqbinary\(aq) axs[0][1].axhline(ebin\-debin) axs[0][1].axhline(ebin+debin) entry.isoenergy(ebin, debin).show( ax=axs[1][0], xname=\(aqtht\(aq, yname=\(aqphi\(aq, cmap=\(aqcividis\(aq) entry.isoenergy(ebin, debin).show( ax=axs[1][1], cmap=\(aqmagma\(aq, cmapscale=\(aqlog\(aq) axs[1][0].axhline(scan, color=\(aqw\(aq, ls=\(aq\-\-\(aq) axs[0][1].axvline(1.7, color=\(aqr\(aq, ls=\(aq\-\-\(aq) axs[1][1].axvline(1.7, color=\(aqr\(aq, ls=\(aq\-\-\(aq) x_note = 0.05 y_note = 0.98 for ax in axs[0][:]: ax.annotate( "$scan \e: = \e: {} eV$".format(scan, dscan), (x_note, y_note), xycoords=\(aqaxes fraction\(aq, size=8, rotation=0, ha="left", va="top", bbox=dict( boxstyle="round", fc=\(aqw\(aq, alpha=0.65, edgecolor=\(aqNone\(aq, pad=0.05 ) ) for ax in axs[1][:]: ax.annotate( "$E\-E_F \e: = \e: {} \epm {} \e; eV$".format(ebin, debin), (x_note, y_note), xycoords=\(aqaxes fraction\(aq, size=8, rotation=0, ha="left", va="top", bbox=dict( boxstyle="round", fc=\(aqw\(aq, alpha=0.65, edgecolor=\(aqNone\(aq, pad=0.05 ) ) plt.tight_layout() .ft P .fi .UNINDENT .UNINDENT [image: plot gr hv scan] [image] .sp \fBTotal running time of the script:\fP ( 0 minutes 7.611 seconds) .SH API REFERENCE .INDENT 0.0 .IP \(bu 2 genindex .IP \(bu 2 modindex .IP \(bu 2 search .UNINDENT .SH PROJECT ON GITLAB .INDENT 0.0 .IP \(bu 2 \fI\%Source repository\fP .IP \(bu 2 \fI\%Issue tracker\fP .UNINDENT .SH AUTHOR Federico Bisti .SH COPYRIGHT 2021, Federico Bisti .\" Generated by docutils manpage writer. .