ledsa 0.9.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ledsa might be problematic. Click here for more details.
- ledsa-0.9.2/PKG-INFO +174 -0
- ledsa-0.9.2/README.md +144 -0
- ledsa-0.9.2/ledsa/__init__.py +0 -0
- ledsa-0.9.2/ledsa/__main__.py +48 -0
- ledsa-0.9.2/ledsa/analysis/ConfigDataAnalysis.py +163 -0
- ledsa-0.9.2/ledsa/analysis/Experiment.py +313 -0
- ledsa-0.9.2/ledsa/analysis/ExperimentData.py +118 -0
- ledsa-0.9.2/ledsa/analysis/ExtinctionCoefficients.py +216 -0
- ledsa-0.9.2/ledsa/analysis/ExtinctionCoefficientsLinear.py +147 -0
- ledsa-0.9.2/ledsa/analysis/ExtinctionCoefficientsNonLinear.py +136 -0
- ledsa-0.9.2/ledsa/analysis/__init__.py +0 -0
- ledsa-0.9.2/ledsa/analysis/data_preparation.py +28 -0
- ledsa-0.9.2/ledsa/core/ConfigData.py +385 -0
- ledsa-0.9.2/ledsa/core/__init__.py +0 -0
- ledsa-0.9.2/ledsa/core/file_handling.py +400 -0
- ledsa-0.9.2/ledsa/core/image_handling.py +39 -0
- ledsa-0.9.2/ledsa/core/image_reading.py +100 -0
- ledsa-0.9.2/ledsa/core/parser_arguments_declaration.py +109 -0
- ledsa-0.9.2/ledsa/core/parser_arguments_run.py +244 -0
- ledsa-0.9.2/ledsa/data_extraction/DataExtractor.py +266 -0
- ledsa-0.9.2/ledsa/data_extraction/LEDAnalysisData.py +85 -0
- ledsa-0.9.2/ledsa/data_extraction/__init__.py +0 -0
- ledsa-0.9.2/ledsa/data_extraction/init_functions.py +228 -0
- ledsa-0.9.2/ledsa/data_extraction/model.py +103 -0
- ledsa-0.9.2/ledsa/data_extraction/step_1_functions.py +58 -0
- ledsa-0.9.2/ledsa/data_extraction/step_2_functions.py +428 -0
- ledsa-0.9.2/ledsa/data_extraction/step_3_functions.py +312 -0
- ledsa-0.9.2/ledsa/demo/__init__.py +0 -0
- ledsa-0.9.2/ledsa/demo/demo_run.py +29 -0
- ledsa-0.9.2/ledsa/demo/demo_setup.py +252 -0
- ledsa-0.9.2/ledsa/ledpositions/__init__.py +0 -0
- ledsa-0.9.2/ledsa/ledpositions/coordinates.py +222 -0
- ledsa-0.9.2/ledsa/postprocessing/__init__.py +0 -0
- ledsa-0.9.2/ledsa/postprocessing/helper_functions.py +3 -0
- ledsa-0.9.2/ledsa/postprocessing/simulation.py +410 -0
- ledsa-0.9.2/ledsa/tests/AcceptanceTests/LedsaATestLibrary.py +226 -0
- ledsa-0.9.2/ledsa/tests/AcceptanceTests/TestExperiment.py +148 -0
- ledsa-0.9.2/ledsa/tests/AcceptanceTests/__init__.py +0 -0
- ledsa-0.9.2/ledsa/tests/AcceptanceTests/__main__.py +14 -0
- ledsa-0.9.2/ledsa/tests/__init__.py +0 -0
- ledsa-0.9.2/ledsa/tests/__main__.py +0 -0
- ledsa-0.9.2/ledsa/tools/__init__.py +0 -0
- ledsa-0.9.2/ledsa/tools/photo_renamer.py +160 -0
- ledsa-0.9.2/ledsa.egg-info/PKG-INFO +174 -0
- ledsa-0.9.2/ledsa.egg-info/SOURCES.txt +48 -0
- ledsa-0.9.2/ledsa.egg-info/dependency_links.txt +1 -0
- ledsa-0.9.2/ledsa.egg-info/requires.txt +20 -0
- ledsa-0.9.2/ledsa.egg-info/top_level.txt +1 -0
- ledsa-0.9.2/pyproject.toml +41 -0
- ledsa-0.9.2/setup.cfg +4 -0
ledsa-0.9.2/PKG-INFO
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ledsa
|
|
3
|
+
Version: 0.9.2
|
|
4
|
+
Summary: A scientific package to analyse smoke via the dimming of light sources.
|
|
5
|
+
Author-email: Kristian Börger <boerger@uni-wuppertal.de>, Lukas Arnold <arnold@uni-wuppertal.de>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://firedynamics.github.io/LEDSmokeAnalysis/
|
|
8
|
+
Project-URL: Repository, https://github.com/FireDynamics/LEDSmokeAnalysis
|
|
9
|
+
Project-URL: Bug Tracker, https://github.com/FireDynamics/LEDSmokeAnalysis/issues
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
Requires-Dist: numpy~=1.26.4
|
|
15
|
+
Requires-Dist: matplotlib~=3.7.2
|
|
16
|
+
Requires-Dist: pandas~=2.0.3
|
|
17
|
+
Requires-Dist: scipy~=1.11.1
|
|
18
|
+
Requires-Dist: tables~=3.9.2
|
|
19
|
+
Requires-Dist: newrawpy~=0.18.1; platform_machine == "arm64"
|
|
20
|
+
Requires-Dist: rawpy~=0.18.1; platform_machine != "arm64"
|
|
21
|
+
Requires-Dist: tqdm~=4.66.2
|
|
22
|
+
Requires-Dist: exifread~=3.0.0
|
|
23
|
+
Requires-Dist: piexif~=1.1.3
|
|
24
|
+
Requires-Dist: robotframework~=6.1.1
|
|
25
|
+
Requires-Dist: pillow~=10.0.1
|
|
26
|
+
Requires-Dist: opencv-python>=4.8.0
|
|
27
|
+
Requires-Dist: requests~=2.31.0
|
|
28
|
+
Requires-Dist: sphinx>=7.0.0
|
|
29
|
+
Requires-Dist: sphinx-rtd-theme>=1.3.0
|
|
30
|
+
|
|
31
|
+
# LEDSmokeAnalysis (LEDSA)
|
|
32
|
+
|
|
33
|
+
LEDSA (LEDSmokeAnalysis) is a Python-based software package for the computation of spatially and temporally resolved light extinction coefficients from photometric measurements. The method relies on capturing the change in intensity of individual light sources due to fire-induced smoke. Images can be acquired within laboratory experiments using commercially available digital cameras.
|
|
34
|
+
|
|
35
|
+
[](https://github.com/FireDynamics/LEDSmokeAnalysis/actions/workflows/build_documentation.yaml)
|
|
36
|
+
[](https://github.com/FireDynamics/LEDSmokeAnalysis/actions/workflows/publish_pypi.yml)
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
|
|
40
|
+
### Requirements
|
|
41
|
+
|
|
42
|
+
- Python 3.x
|
|
43
|
+
- pip (Python package installer)
|
|
44
|
+
|
|
45
|
+
### Installation from PyPI
|
|
46
|
+
|
|
47
|
+
The easiest way to install LEDSA is via pip:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
python -m pip install ledsa
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Installation from Source
|
|
54
|
+
|
|
55
|
+
To install LEDSA from source:
|
|
56
|
+
|
|
57
|
+
1. Clone the repository:
|
|
58
|
+
```bash
|
|
59
|
+
git clone https://github.com/FireDynamics/LEDSmokeAnalysis.git
|
|
60
|
+
cd LEDSmokeAnalysis
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
2. Install the package:
|
|
64
|
+
```bash
|
|
65
|
+
pip install .
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Usage
|
|
69
|
+
|
|
70
|
+
LEDSA can be used via its command-line interface (CLI). The general structure is:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
python -m ledsa [ARGUMENT] [OPTIONS]
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Configuration
|
|
77
|
+
|
|
78
|
+
Create a default configuration file:
|
|
79
|
+
```bash
|
|
80
|
+
python -m ledsa -conf
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Create an analysis configuration file:
|
|
84
|
+
```bash
|
|
85
|
+
python -m ledsa -conf_a
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Main Workflow
|
|
89
|
+
|
|
90
|
+
The typical workflow consists of three main steps:
|
|
91
|
+
|
|
92
|
+
1. **Step 1: Find LEDs on a reference image**
|
|
93
|
+
```bash
|
|
94
|
+
python -m ledsa -s1
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
2. **Step 2: Assign LEDs to LED arrays**
|
|
98
|
+
```bash
|
|
99
|
+
python -m ledsa -s2
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
3. **Step 3: Analyze light intensity changes among different images for the RGB color channels**
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
python -m ledsa -s3_fast -rgb
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
4. **Calculate 3D coordinates of the individual LEDs**
|
|
109
|
+
```bash
|
|
110
|
+
python -m ledsa -coord
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
5. **Run computation of extinction coefficient**
|
|
114
|
+
```bash
|
|
115
|
+
python -m ledsa --analysis
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
For a complete list of options, run:
|
|
119
|
+
```bash
|
|
120
|
+
python -m ledsa --help
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Demo
|
|
124
|
+
|
|
125
|
+
LEDSA includes a demo that demonstrates its functionality using sample data.
|
|
126
|
+
|
|
127
|
+
### Setting Up the Demo
|
|
128
|
+
|
|
129
|
+
The demo setup will download approximately 5GB of data from the internet:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
python -m ledsa --demo --setup /path/to/demo/directory
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
This will create two directories:
|
|
136
|
+
- `image_data`: Contains the sample images
|
|
137
|
+
- `simulation`: Contains configuration files and results
|
|
138
|
+
|
|
139
|
+
### Running the Demo
|
|
140
|
+
|
|
141
|
+
After setting up the demo, you can run it:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
python -m ledsa --demo --run
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
By default, the demo uses 1 core. You can specify more cores:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
python -m ledsa --demo --run --n_cores 4
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Documentation
|
|
154
|
+
|
|
155
|
+
Comprehensive documentation is available at [https://firedynamics.github.io/LEDSmokeAnalysis/](https://firedynamics.github.io/LEDSmokeAnalysis/)
|
|
156
|
+
|
|
157
|
+
## Contributing
|
|
158
|
+
|
|
159
|
+
To introduce new, tested, documented, and stable changes, pull/merge requests into the master branch are used.
|
|
160
|
+
|
|
161
|
+
Pull request drafts can be used to communicate about changes and new functionality.
|
|
162
|
+
|
|
163
|
+
After reviewing and testing the changes, they will be merged into master.
|
|
164
|
+
|
|
165
|
+
Every merge with master is followed by introducing a new version tag corresponding to the semantic versioning paradigm.
|
|
166
|
+
|
|
167
|
+
## License
|
|
168
|
+
|
|
169
|
+
LEDSA is licensed under the MIT License. See the LICENSE file for details.
|
|
170
|
+
|
|
171
|
+
## Authors
|
|
172
|
+
|
|
173
|
+
- Kristian Börger (boerger@uni-wuppertal.de)
|
|
174
|
+
- Lukas Arnold (arnold@uni-wuppertal.de)
|
ledsa-0.9.2/README.md
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# LEDSmokeAnalysis (LEDSA)
|
|
2
|
+
|
|
3
|
+
LEDSA (LEDSmokeAnalysis) is a Python-based software package for the computation of spatially and temporally resolved light extinction coefficients from photometric measurements. The method relies on capturing the change in intensity of individual light sources due to fire-induced smoke. Images can be acquired within laboratory experiments using commercially available digital cameras.
|
|
4
|
+
|
|
5
|
+
[](https://github.com/FireDynamics/LEDSmokeAnalysis/actions/workflows/build_documentation.yaml)
|
|
6
|
+
[](https://github.com/FireDynamics/LEDSmokeAnalysis/actions/workflows/publish_pypi.yml)
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
### Requirements
|
|
11
|
+
|
|
12
|
+
- Python 3.x
|
|
13
|
+
- pip (Python package installer)
|
|
14
|
+
|
|
15
|
+
### Installation from PyPI
|
|
16
|
+
|
|
17
|
+
The easiest way to install LEDSA is via pip:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
python -m pip install ledsa
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Installation from Source
|
|
24
|
+
|
|
25
|
+
To install LEDSA from source:
|
|
26
|
+
|
|
27
|
+
1. Clone the repository:
|
|
28
|
+
```bash
|
|
29
|
+
git clone https://github.com/FireDynamics/LEDSmokeAnalysis.git
|
|
30
|
+
cd LEDSmokeAnalysis
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
2. Install the package:
|
|
34
|
+
```bash
|
|
35
|
+
pip install .
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Usage
|
|
39
|
+
|
|
40
|
+
LEDSA can be used via its command-line interface (CLI). The general structure is:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
python -m ledsa [ARGUMENT] [OPTIONS]
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Configuration
|
|
47
|
+
|
|
48
|
+
Create a default configuration file:
|
|
49
|
+
```bash
|
|
50
|
+
python -m ledsa -conf
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Create an analysis configuration file:
|
|
54
|
+
```bash
|
|
55
|
+
python -m ledsa -conf_a
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Main Workflow
|
|
59
|
+
|
|
60
|
+
The typical workflow consists of three main steps:
|
|
61
|
+
|
|
62
|
+
1. **Step 1: Find LEDs on a reference image**
|
|
63
|
+
```bash
|
|
64
|
+
python -m ledsa -s1
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
2. **Step 2: Assign LEDs to LED arrays**
|
|
68
|
+
```bash
|
|
69
|
+
python -m ledsa -s2
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
3. **Step 3: Analyze light intensity changes among different images for the RGB color channels**
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
python -m ledsa -s3_fast -rgb
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
4. **Calculate 3D coordinates of the individual LEDs**
|
|
79
|
+
```bash
|
|
80
|
+
python -m ledsa -coord
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
5. **Run computation of extinction coefficient**
|
|
84
|
+
```bash
|
|
85
|
+
python -m ledsa --analysis
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
For a complete list of options, run:
|
|
89
|
+
```bash
|
|
90
|
+
python -m ledsa --help
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Demo
|
|
94
|
+
|
|
95
|
+
LEDSA includes a demo that demonstrates its functionality using sample data.
|
|
96
|
+
|
|
97
|
+
### Setting Up the Demo
|
|
98
|
+
|
|
99
|
+
The demo setup will download approximately 5GB of data from the internet:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
python -m ledsa --demo --setup /path/to/demo/directory
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
This will create two directories:
|
|
106
|
+
- `image_data`: Contains the sample images
|
|
107
|
+
- `simulation`: Contains configuration files and results
|
|
108
|
+
|
|
109
|
+
### Running the Demo
|
|
110
|
+
|
|
111
|
+
After setting up the demo, you can run it:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
python -m ledsa --demo --run
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
By default, the demo uses 1 core. You can specify more cores:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
python -m ledsa --demo --run --n_cores 4
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Documentation
|
|
124
|
+
|
|
125
|
+
Comprehensive documentation is available at [https://firedynamics.github.io/LEDSmokeAnalysis/](https://firedynamics.github.io/LEDSmokeAnalysis/)
|
|
126
|
+
|
|
127
|
+
## Contributing
|
|
128
|
+
|
|
129
|
+
To introduce new, tested, documented, and stable changes, pull/merge requests into the master branch are used.
|
|
130
|
+
|
|
131
|
+
Pull request drafts can be used to communicate about changes and new functionality.
|
|
132
|
+
|
|
133
|
+
After reviewing and testing the changes, they will be merged into master.
|
|
134
|
+
|
|
135
|
+
Every merge with master is followed by introducing a new version tag corresponding to the semantic versioning paradigm.
|
|
136
|
+
|
|
137
|
+
## License
|
|
138
|
+
|
|
139
|
+
LEDSA is licensed under the MIT License. See the LICENSE file for details.
|
|
140
|
+
|
|
141
|
+
## Authors
|
|
142
|
+
|
|
143
|
+
- Kristian Börger (boerger@uni-wuppertal.de)
|
|
144
|
+
- Lukas Arnold (arnold@uni-wuppertal.de)
|
|
File without changes
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# this file is executed if the package is run via python -m ledsa [arguments]
|
|
2
|
+
import argparse
|
|
3
|
+
import sys
|
|
4
|
+
from typing import List
|
|
5
|
+
|
|
6
|
+
from ledsa.core.parser_arguments_declaration import (add_parser_arguments_tools, add_parser_arguments_data_extraction,
|
|
7
|
+
add_parser_arguments_testing, add_parser_arguments_demo, add_parser_argument_analysis)
|
|
8
|
+
from ledsa.core.parser_arguments_run import run_tools_arguments, run_data_extraction_arguments, run_testing_arguments, run_demo_arguments, \
|
|
9
|
+
run_analysis_arguments, run_analysis_arguments_with_extinction_coefficient
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def main(argv: List[str]) -> None:
|
|
13
|
+
"""
|
|
14
|
+
Main function to execute the LEDSA package with command line arguments.
|
|
15
|
+
|
|
16
|
+
:param argv: Command line arguments.
|
|
17
|
+
:type argv: list[str]
|
|
18
|
+
"""
|
|
19
|
+
parser = argparse.ArgumentParser(description=
|
|
20
|
+
'Allows the analysis of light dampening of LEDs behind a smoke screen.')
|
|
21
|
+
add_parser_arguments_tools(parser)
|
|
22
|
+
add_parser_arguments_data_extraction(parser)
|
|
23
|
+
add_parser_argument_analysis(parser)
|
|
24
|
+
add_parser_arguments_demo(parser)
|
|
25
|
+
add_parser_arguments_testing(parser)
|
|
26
|
+
|
|
27
|
+
args = parser.parse_args(argv)
|
|
28
|
+
|
|
29
|
+
print('ledsa runs with the following arguments:')
|
|
30
|
+
print(args)
|
|
31
|
+
|
|
32
|
+
if len(argv) == 0:
|
|
33
|
+
print('Please run with an argument. --help for possible arguments.')
|
|
34
|
+
exit(0)
|
|
35
|
+
|
|
36
|
+
if args.demo:
|
|
37
|
+
run_demo_arguments(args, parser)
|
|
38
|
+
else:
|
|
39
|
+
run_tools_arguments(args)
|
|
40
|
+
run_data_extraction_arguments(args)
|
|
41
|
+
run_analysis_arguments(args)
|
|
42
|
+
run_analysis_arguments_with_extinction_coefficient(args)
|
|
43
|
+
run_testing_arguments(args)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
if __name__ == "__main__":
|
|
48
|
+
main(sys.argv[1:])
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import configparser as cp
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class ConfigDataAnalysis(cp.ConfigParser):
|
|
5
|
+
"""
|
|
6
|
+
Class responsible for handling the configuration data related to LEDSA's data analysis.
|
|
7
|
+
|
|
8
|
+
"""
|
|
9
|
+
def __init__(self, load_config_file=True, camera_position=None, num_layers=20, domain_bounds=None,
|
|
10
|
+
led_array_indices=None, num_ref_images=10, camera_channels=0, num_cores=1,
|
|
11
|
+
reference_property='sum_col_val',
|
|
12
|
+
average_images=False, solver='linear', weighting_preference=-6e-3, weighting_curvature=1e-6,
|
|
13
|
+
num_iterations=200, lambda_reg=1e-3):
|
|
14
|
+
"""
|
|
15
|
+
:param load_config_file: Determines whether to load the config file on initialization. Defaults to True.
|
|
16
|
+
:type load_config_file: bool
|
|
17
|
+
:param camera_position: Global X, Y, Z position of the camera. Defaults to None.
|
|
18
|
+
:type camera_position: list[float] or None
|
|
19
|
+
:param num_layers: Number of horizontal smoke layers. Defaults to 20.
|
|
20
|
+
:type num_layers: int
|
|
21
|
+
:param domain_bounds: Lower and upper bounds of the computational domain. Defaults to None.
|
|
22
|
+
:type domain_bounds: list[float] or None
|
|
23
|
+
:param led_array_indices: Indices of the LED arrays for which the extinction coefficients should be computed. Defaults to None.
|
|
24
|
+
:type led_array_indices: list[int] or None
|
|
25
|
+
:param num_ref_images: Number of images used to compute normalize LED intensities. Defaults to 10.
|
|
26
|
+
:type num_ref_images: int
|
|
27
|
+
:param camera_channels: Camera channels to be considered in the analysis. Defaults to 0.
|
|
28
|
+
:type camera_channels: List[int]
|
|
29
|
+
:param num_cores: Number of CPU cores for (multicore) processing. If greater than 1, multicore processing is applied. Defaults to 1.
|
|
30
|
+
:type num_cores: int
|
|
31
|
+
:param reference_property: Property used for reference in LEDSA. Defaults to 'sum_col_val'.
|
|
32
|
+
:type reference_property: str
|
|
33
|
+
:param average_images: Determines if intensities are computed as an average from two consecutive images. Defaults to False.
|
|
34
|
+
:type average_images: bool
|
|
35
|
+
:param solver: Method used to compute extinction coefficients - can be 'linear' or 'nonlinear'. Defaults to 'linear'.
|
|
36
|
+
:type solver: str
|
|
37
|
+
:param weighting_preference: Weighting factor for the preference to push the nonlinear solver to high or low values for the extinction coeffiientes. Defaults to -6e-3.
|
|
38
|
+
:type weighting_preference: float
|
|
39
|
+
:param weighting_curvature: Weighting factor for the smoothness of the solution. Defaults to 1e-6.
|
|
40
|
+
:type weighting_curvature: float
|
|
41
|
+
:param num_iterations: Maximum number of iterations for the nonlinear solver. Defaults to 200.
|
|
42
|
+
:type num_iterations: int
|
|
43
|
+
:param lambda_reg: Regularization parameter for the linear solver. Defaults to 1e-3.
|
|
44
|
+
:type lambda_reg: float
|
|
45
|
+
"""
|
|
46
|
+
cp.ConfigParser.__init__(self, allow_no_value=True)
|
|
47
|
+
if load_config_file:
|
|
48
|
+
self.load()
|
|
49
|
+
else:
|
|
50
|
+
self['DEFAULT'] = {}
|
|
51
|
+
self.set('DEFAULT', '# Variables used in multiple parts of LEDSA')
|
|
52
|
+
self.set('DEFAULT', ' # Number of CPUs, multicore processing is applied if > 1')
|
|
53
|
+
self['DEFAULT'][' num_cores'] = str(num_cores)
|
|
54
|
+
self['DEFAULT'][' reference_property'] = str(reference_property)
|
|
55
|
+
self.set('DEFAULT', ' # Number images used to compute normalize LED intensities')
|
|
56
|
+
self['DEFAULT'][' num_ref_images'] = str(num_ref_images)
|
|
57
|
+
self['DEFAULT'][' camera_channels'] = str(camera_channels)
|
|
58
|
+
self.set('DEFAULT', ' # Intensities are computed as average from two consecutive images if set to True ')
|
|
59
|
+
self['DEFAULT'][' average_images'] = str(average_images)
|
|
60
|
+
self.set('DEFAULT', ' # Extinction coefficients can be computed by linear or numeric solver ')
|
|
61
|
+
self['DEFAULT'][' solver'] = str(solver)
|
|
62
|
+
self.set('DEFAULT', ' # Options for nonlinear solver (ignored when linear solver is used) ')
|
|
63
|
+
self['DEFAULT'][' weighting_preference'] = str(weighting_preference)
|
|
64
|
+
self['DEFAULT'][' weighting_curvature'] = str(weighting_curvature)
|
|
65
|
+
self['DEFAULT'][' num_iterations'] = str(num_iterations)
|
|
66
|
+
self.set('DEFAULT', ' # Options for linear solver (ignored when nonlinear solver is used) ')
|
|
67
|
+
self['DEFAULT'][' lambda_reg'] = str(lambda_reg)
|
|
68
|
+
|
|
69
|
+
self['experiment_geometry'] = {}
|
|
70
|
+
self.set('experiment_geometry', '# Global X Y Z position of the camera ')
|
|
71
|
+
self['experiment_geometry'][' camera_position'] = str(camera_position)
|
|
72
|
+
|
|
73
|
+
self['model_parameters'] = {}
|
|
74
|
+
self.set('model_parameters', '# Parameters regarding the discretization of the spatial domain ')
|
|
75
|
+
self.set('model_parameters', ' # LED arrays for that the extinction coefficients should be computed ')
|
|
76
|
+
self['model_parameters'][' led_array_indices'] = str(led_array_indices)
|
|
77
|
+
self.set('model_parameters', ' # Number of horizontal smoke layers ')
|
|
78
|
+
self['model_parameters'][' num_layers'] = str(num_layers)
|
|
79
|
+
self.set('model_parameters', ' # Lower and upper bounds of the computational domain ')
|
|
80
|
+
self['model_parameters'][' domain_bounds'] = str(domain_bounds)
|
|
81
|
+
|
|
82
|
+
with open('config_analysis.ini', 'w') as configfile:
|
|
83
|
+
self.write(configfile)
|
|
84
|
+
print('config_analysis.ini created')
|
|
85
|
+
|
|
86
|
+
def load(self) -> None:
|
|
87
|
+
"""
|
|
88
|
+
Loads the configuration data from 'config_analysis.ini' file.
|
|
89
|
+
|
|
90
|
+
Raises:
|
|
91
|
+
FileNotFoundError: If 'config_analysis.ini' is not found in the working directory.
|
|
92
|
+
"""
|
|
93
|
+
try:
|
|
94
|
+
self.read_file(open('config_analysis.ini'))
|
|
95
|
+
except FileNotFoundError:
|
|
96
|
+
print(
|
|
97
|
+
'config_analysis.ini not found in working directory! Please create it with argument "--config_analysis".')
|
|
98
|
+
exit(1)
|
|
99
|
+
print('config_analysis.ini loaded!')
|
|
100
|
+
|
|
101
|
+
def save(self) -> None:
|
|
102
|
+
"""
|
|
103
|
+
Saves the current configuration to 'config_analysis.ini' file.
|
|
104
|
+
"""
|
|
105
|
+
with open('config_analysis.ini', 'w') as configfile:
|
|
106
|
+
self.write(configfile)
|
|
107
|
+
print('config_analysis.ini saved')
|
|
108
|
+
|
|
109
|
+
def get_list_of_values(self, section:str, option:str, dtype=int) -> None:
|
|
110
|
+
"""
|
|
111
|
+
Returns a list of values of a specified dtype from a given section and option.
|
|
112
|
+
|
|
113
|
+
:param section: Section in the configuration file.
|
|
114
|
+
:type section: str
|
|
115
|
+
:param option: Option under the specified section.
|
|
116
|
+
:type option: str
|
|
117
|
+
:param dtype: Data type of the values to be returned. Defaults to int.
|
|
118
|
+
:type dtype: type
|
|
119
|
+
:return: List of values or None if the option's value is 'None'.
|
|
120
|
+
:rtype: list or None
|
|
121
|
+
"""
|
|
122
|
+
if self[section][option] == 'None':
|
|
123
|
+
return None
|
|
124
|
+
values = [dtype(i) for i in self[section][option].split()]
|
|
125
|
+
return values
|
|
126
|
+
|
|
127
|
+
def in_camera_channels(self) -> None:
|
|
128
|
+
"""
|
|
129
|
+
Prompts the user to input the camera channels to analyse and updates the configuration.
|
|
130
|
+
"""
|
|
131
|
+
self['DEFAULT']['camera_channels'] = input('Please give the camera channels that should be considered in the '
|
|
132
|
+
'analysis: ')
|
|
133
|
+
|
|
134
|
+
def in_camera_position(self) -> None:
|
|
135
|
+
"""
|
|
136
|
+
Prompts the user to input the camera's global X, Y, Z coordinates and updates the configuration.
|
|
137
|
+
"""
|
|
138
|
+
self['experiment_geometry']['camera_position'] = input('Please give the global X Y Z [m] coordinates of the '
|
|
139
|
+
'camera : ')
|
|
140
|
+
|
|
141
|
+
def in_num_layers(self) -> None:
|
|
142
|
+
"""
|
|
143
|
+
Prompts the user to input the number of layers for spatial domain discretization and updates the configuration.
|
|
144
|
+
"""
|
|
145
|
+
self['model_parameters']['num_layers'] = input('Please give number of layers the spatial domain should '
|
|
146
|
+
'be discretized to : ')
|
|
147
|
+
|
|
148
|
+
def in_domain_bounds(self) -> None:
|
|
149
|
+
"""
|
|
150
|
+
Prompts the user to input the lower and upper height of the spatial domain and updates the configuration.
|
|
151
|
+
"""
|
|
152
|
+
self['model_parameters']['domain_bounds'] = input('Please give lower and upper height [m] of the spatial '
|
|
153
|
+
'domain : ')
|
|
154
|
+
|
|
155
|
+
def in_led_array_indices(self) -> None:
|
|
156
|
+
"""
|
|
157
|
+
Prompts the user to input the indices of (merged) LED Arrays for computation and updates the configuration.
|
|
158
|
+
"""
|
|
159
|
+
self['model_parameters']['led_array_indices'] = input('Please give indices of (merged) LED Arrays to compute: ')
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
if __name__ == 'main':
|
|
163
|
+
ConfigDataAnalysis()
|