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
8 changes: 8 additions & 0 deletions doc/analysis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ Analysis
:show-inheritance:

.. automodule:: ledsa.analysis.ExperimentData
:members:
:undoc-members:
:show-inheritance:

Stacked Multi-Camera Analysis
------------------------------

.. automodule:: ledsa.analysis.StackedExtinctionCoefficients
:members:
:undoc-members:
:show-inheritance:
23 changes: 21 additions & 2 deletions doc/cli_documentation.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

CLI Documentation
=================

Expand Down Expand Up @@ -68,6 +67,26 @@ Analysis
.. warning::
Color Correction is in a test state and has not yet been sufficiently evaluated. The application may lead to incorrect results.

Stacked Multi-Camera Analysis
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. list-table::
:widths: 20 50 30
:header-rows: 1

* - Argument
- Description
- Options
* - ``-conf_s [FILENAME]``, ``--config_stacked [FILENAME]``
- Create a template ``config_stacked.ini`` for multi-camera stacked analysis. The optional argument sets the output filename (default: ``config_stacked.ini``).
- ``--n_simulations N`` sets the number of simulation blocks in the template (default: 2).
* - ``--n_simulations N``
- Number of ``[simulation_N]`` blocks written into the template ``config_stacked.ini``. Only used together with ``-conf_s``.
- Default: 2
* - ``-as``, ``--analysis_stacked``
- Run the stacked multi-camera extinction coefficient calculation using ``config_stacked.ini`` in the current directory.
- --

Coordinates
^^^^^^^^^^^

Expand Down Expand Up @@ -117,4 +136,4 @@ Demo
- Optional: Path to setup simulation and image directories. Default to ``'.'``
* - ``--run``
- Run the LEDSA demo in the current working directory.
- --
- --
8 changes: 8 additions & 0 deletions doc/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,11 @@ ConfigDataAnalysis
:members:
:undoc-members:
:show-inheritance:

ConfigDataStacked
-----------------

.. automodule:: ledsa.analysis.ConfigDataStacked
:members:
:undoc-members:
:show-inheritance:
226 changes: 226 additions & 0 deletions examples/postprocessing_stacked.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,226 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"collapsed": true,
"pycharm": {
"name": "#%% md\n"
}
},
"source": [
"# Dependencies"
]
},
{
"metadata": {},
"cell_type": "code",
"source": [
"import os\n",
"import numpy as np\n",
"\n",
"import matplotlib.pyplot as plt\n",
"from matplotlib import rcParams\n",
"from mpl_toolkits.axes_grid1.inset_locator import InsetPosition\n",
"import seaborn as sns\n",
"\n",
"from ledsa.postprocessing.simulation import StackedSimData"
],
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
"source": "# Display Config",
"metadata": {
"collapsed": false
}
},
{
"cell_type": "code",
"source": [
"rcParams['font.family'] = 'serif'\n",
"rcParams['font.size'] = 10\n",
"cm = 1 / 2.54"
],
"metadata": {
"collapsed": false,
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
"source": "# Load Simulation Data",
"metadata": {
"collapsed": false
}
},
{
"metadata": {},
"cell_type": "code",
"source": [
"# Input Dir (Simulations)\n",
"path_simulation = '/Path/to/simulation'\n",
"sim = StackedSimData(path_simulation)"
],
"outputs": [],
"execution_count": null
},
{
"metadata": {},
"cell_type": "markdown",
"source": "# Extinction Coefficients"
},
{
"metadata": {},
"cell_type": "markdown",
"source": "## Plot extinction coefficients as a function of time for a specific LED array and height"
},
{
"metadata": {},
"cell_type": "code",
"source": [
"# Parameters\n",
"led_array_id = 1 # LED array to analyze\n",
"window = 3 # Size of moving average window\n",
"color_channels = [0, 1, 2] # RGB channels\n",
"height = 2\n",
"\n",
"# Create figure\n",
"fig, ax = plt.subplots(figsize=(10, 6))\n",
"\n",
"# Plot extinction coefficients for each channel\n",
"for channel in color_channels:\n",
" # Get extinction coefficients at specified height\n",
" extco = sim.get_extco_at_height(channel=channel, height=height, window=window)\n",
"\n",
" # Plot with different colors for each channel\n",
" colors = ['red', 'green', 'blue']\n",
" ax.plot(extco.index, extco.iloc[:, led_array_id],\n",
" color=colors[channel],\n",
" label=f'Channel {channel}')\n",
"\n",
"ax.set_xlabel('Time / s')\n",
"ax.set_ylabel('Extinction Coefficient / $\\mathrm{m^{-1}}$')\n",
"ax.set_title(f'Extinction Coefficients at Height {height} m, LED Array {led_array_id}')\n",
"ax.grid(True)\n",
"ax.legend()\n",
"plt.tight_layout()\n",
"plt.show()"
],
"outputs": [],
"execution_count": null
},
{
"metadata": {},
"cell_type": "markdown",
"source": "## Plot extinction coefficients as a function of height and LED array for a specific point in time"
},
{
"metadata": {},
"cell_type": "code",
"source": [
"# Parameters\n",
"time = 200 # Time point to analyze in seconds\n",
"channel = 0 # RGB channels\n",
"window = 20 # Size of moving average window\n",
"\n",
"# Find closest time point to given time\n",
"closest_time = sim.get_closest_time(time)\n",
"\n",
"extco = sim.get_extco_at_time(channel=channel, time=closest_time, window=window, yaxis='height')\n",
"sns.heatmap(extco.iloc[::-1], cmap='jet', vmax=0.4, cbar_kws={'label': 'Extinction Coefficient / $\\mathrm{m^{-1}}$'})\n",
"plt.tight_layout()"
],
"outputs": [],
"execution_count": null
},
{
"metadata": {},
"cell_type": "markdown",
"source": "## Plot extinction coefficients as a function of height for a specific LED array and point in time\n"
},
{
"cell_type": "code",
"source": [
"# Parameters\n",
"time = 200 # Time point to analyze in seconds\n",
"window = 3 # Size of moving average window\n",
"led_array_id = 2 # LED array to analyze\n",
"color_channels = [0, 1, 2] # RGB channels\n",
"\n",
"# Find closest time point to given time\n",
"closest_time = sim.get_closest_time(time)\n",
"\n",
"# Create figure\n",
"fig, ax = plt.subplots(figsize=(10, 6))\n",
"\n",
"# Plot extinction coefficients for each channel\n",
"for channel in color_channels:\n",
" # Get extinction coefficients at specified time\n",
" extco = sim.get_extco_at_time(channel=channel, time=closest_time, window=window, yaxis='height')\n",
"\n",
" # Plot with different colors for each channel\n",
" colors = ['red', 'green', 'blue']\n",
" ax.plot(extco.iloc[:, led_array_id], extco.index,\n",
" color=colors[channel],\n",
" label=f'Channel {channel}')\n",
"\n",
"ax.set_xlabel('Extinction Coefficient / $\\mathrm{m^{-1}}$')\n",
"ax.set_ylabel('Height / m')\n",
"ax.set_title(f'Extinction Coefficients at Time {closest_time} s, LED Array {led_array_id}')\n",
"ax.grid(True)\n",
"ax.legend()\n",
"plt.tight_layout()\n",
"plt.show()\n"
],
"metadata": {
"collapsed": false,
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"execution_count": null
},
{
"metadata": {},
"cell_type": "code",
"source": "",
"outputs": [],
"execution_count": null
},
{
"metadata": {},
"cell_type": "code",
"source": "",
"outputs": [],
"execution_count": null
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
5 changes: 3 additions & 2 deletions ledsa/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from ledsa.core.parser_arguments_declaration import (add_parser_arguments_tools, add_parser_arguments_data_extraction,
add_parser_arguments_testing, add_parser_arguments_demo, add_parser_argument_analysis)
from ledsa.core.parser_arguments_run import run_tools_arguments, run_data_extraction_arguments, run_testing_arguments, run_demo_arguments, \
run_analysis_arguments, run_analysis_arguments_with_extinction_coefficient
run_analysis_arguments, run_analysis_arguments_with_extinction_coefficient, run_stacked_analysis


def main(argv: List[str]) -> None:
Expand Down Expand Up @@ -40,9 +40,10 @@ def main(argv: List[str]) -> None:
run_data_extraction_arguments(args)
run_analysis_arguments(args)
run_analysis_arguments_with_extinction_coefficient(args)
run_stacked_analysis(args)
run_testing_arguments(args)



if __name__ == "__main__":
main(sys.argv[1:])
main(sys.argv[1:])
Loading
Loading