Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ coverage:
precision: 2
round: up
range: "90...100"

ignore:
- "spectrafit/plugins/rixs_visualizer.py"
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ repos:
pytest==6.2.5,
]
- repo: https://github.com/pycqa/pydocstyle
rev: 6.2.3 # pick a git hash / tag to point to
rev: 6.2.3
hooks:
- id: pydocstyle
additional_dependencies: [toml==0.10.2]
Expand All @@ -70,4 +70,4 @@ repos:
rev: v3.3.1
hooks:
- id: pyupgrade
args: [--py37-plus]
args: [--py38-plus]
3 changes: 2 additions & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ unsafe-load-any-extension=no
extension-pkg-allow-list=

# Minimum supported python version
py-version = 3.7.2
py-version = 3.8

# Control the amount of potential inferred values when inferring a single
# object. This can help the performance when dealing with large functions or
Expand Down Expand Up @@ -108,6 +108,7 @@ disable=
E0401, # Import is not at the top of the file
R6002, # Old typing definition
R6003, # Old typing definition
# W0621, # Redefining name from outer scope


[REPORTS]
Expand Down
141 changes: 141 additions & 0 deletions docs/examples/example9_4.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"# Test of the RIXS Map visualization tool\n",
"\n",
"For visualization of the RIXS map, we use the `RixsMap` class. The class is initialized with the RIXS map data and the energy axis. The energy axis is a list of two elements: the first element is the energy axis of the RIXS map, the second element is the energy axis of the RIXS map after the energy loss correction. The energy axis is in units of eV."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"from spectrafit.plugins.rixs_visualizer import RIXSApp\n",
"from spectrafit.api.rixs_model import SizeRatioAPI"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Initialization\n",
"\n",
"For visualization of a RIXS map, we use the `RIXSApp` class. The class only requires the _incident_ and _emission_ energy as 1D arrays. \n",
"The RIXS map itself has to be stored as a 2D meshgrid of intensities. By default the RIXS map is assumed to be in units of eV.\n",
"\n",
"> Information \"it is an early version of the RIXS map visualization tool\"\n"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"from typing import Tuple\n",
"\n",
"\n",
"def sin2_as_rixsmap() -> Tuple[np.ndarray, np.ndarray, np.ndarray]:\n",
" \"\"\"Create a RIXS map with a sinusoidal intensity.\"\"\"\n",
" incident_energy = np.linspace(0, 10, 100)\n",
" emission_energy = np.linspace(0, 10, 100)\n",
" grid = np.meshgrid(incident_energy, emission_energy)\n",
" rixs_map = np.sin(grid[0]) * np.sin(grid[1])\n",
" return incident_energy, emission_energy, rixs_map"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"_app = RIXSApp(\n",
" incident_energy=sin2_as_rixsmap()[0],\n",
" emission_energy=sin2_as_rixsmap()[1],\n",
" rixs_map=sin2_as_rixsmap()[2],\n",
" # For avoiding issues with a too large inline visualization, please downsizing the RIXS map size\n",
" size=SizeRatioAPI(size=(200, 200)),\n",
" mode=\"inline\",\n",
" jupyter_dash=True,\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" <iframe\n",
" width=\"100%\"\n",
" height=\"650\"\n",
" src=\"http://127.0.0.1:8050/\"\n",
" frameborder=\"0\"\n",
" allowfullscreen\n",
" \n",
" ></iframe>\n",
" "
],
"text/plain": [
"<IPython.lib.display.IFrame at 0x28cbf3ca0>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"_app.app_run()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": ".venv",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.9"
},
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "b199af289ce012bb6a24205fcd5edae736294423f0e29474acbaa2e2fdaf4f82"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Binary file added docs/examples/images/Figure_9_4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions mkdocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ nav:
- Default Plot: examples/example9_1.ipynb
- Dark Theme: examples/example9_2.ipynb
- Export Results: examples/example9_3.ipynb
- RIXS Map Visualization: examples/example9_4.ipynb
- Documentation:
- Models: doc/models.md
- Expression: doc/expression.md
Expand Down
Loading