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
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,30 @@ individual runs. Since image IDs are counted per run, `num_ref_images` and `ref_
be set per `[simulation_N]` section; pick the reference images of all cameras from the same time
window before the fire.

### Camera behind a window pane (optional)

A camera that looks into the smoke through a window pane, for example from outside the test
room, sees the LEDs along lines of sight whose part between the camera and the pane is free of
smoke. Only the part behind the pane belongs in the layers; counted from the camera, the light
paths are too long and the extinction coefficients come out too low. `pane_distance` is the
distance in m between the camera and the pane:

```ini
[experiment_geometry]
camera_position = 0 -0.5 1.5
pane_distance = 0.5
```

The pane is taken as normal to the line of sight, so the light path of every LED starts
`pane_distance` away from the camera. A flat pane normal to the optical axis is crossed by a line
of sight at an angle θ to the axis `pane_distance / cos θ` away from the camera, at 15° 3.5 %
farther, which is negligible as long as the pane is close to the camera compared to the LEDs. In
`config_stacked.ini`, every `[simulation_N]` section takes a `pane_distance` of its own. Without
the option, or with `None`, the light paths reach the camera as before. The camera may then stand
outside `domain_bounds`, as long as the layers hold the light paths behind the pane. Only the
geometry is corrected: a pane whose transmission changes during the test, for example by soot or
condensate, dims the LEDs like smoke. The header of each result file names the distance.

### Temperature correction (optional)

LEDs lose radiant power as they heat up, which would otherwise be read as extinction. Reduction
Expand Down
22 changes: 21 additions & 1 deletion ledsa/analysis/ConfigDataAnalysis.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import configparser as cp
from typing import Iterable, List, Optional, Union

from ledsa.analysis.Experiment import read_pane_distance
from ledsa.analysis.temperature_correction import TEMPERATURE_CORRECTION_CHANNELS
from ledsa.core.config_file import report_removed_options, save_config

Expand Down Expand Up @@ -72,7 +73,7 @@ def __init__(self, load_config_file=True, camera_position=None, num_layers=20, d
reference_property='sum_col_val',
average_images=False, n_summarize=2, solver='linear', weighting_preference=-6e-3,
weighting_curvature=1e-2,
num_iterations=1000, lambda_reg=1e-3, reduction_files=None):
num_iterations=1000, lambda_reg=1e-3, reduction_files=None, pane_distance=None):
"""
:param load_config_file: Determines whether to load the config file on initialization. Defaults to True.
:type load_config_file: bool
Expand Down Expand Up @@ -115,6 +116,9 @@ def __init__(self, load_config_file=True, camera_position=None, num_layers=20, d
camera channel. Channels without an entry are analysed without the correction, which is
the default for every channel.
:type reduction_files: dict[int, str] or None
:param pane_distance: Distance [m] between the camera and the window pane it looks through
into the smoke. Defaults to None, for a camera without a pane.
:type pane_distance: float or None
"""
cp.ConfigParser.__init__(self, allow_no_value=True)
if load_config_file:
Expand Down Expand Up @@ -149,6 +153,11 @@ def __init__(self, load_config_file=True, camera_position=None, num_layers=20, d
self['experiment_geometry'] = {}
self.set('experiment_geometry', '# Global X Y Z position of the camera ')
self['experiment_geometry'][' camera_position'] = str(camera_position)
self.set('experiment_geometry', ' # Distance [m] between the camera and the window pane it looks through into the')
self.set('experiment_geometry', ' # smoke, None without a pane. The pane is taken as normal to the line of sight:')
self.set('experiment_geometry', ' # the first pane_distance of every line of sight is free of smoke, so only the')
self.set('experiment_geometry', ' # part behind the pane is distributed over the layers.')
self['experiment_geometry'][' pane_distance'] = str(pane_distance)

self['model_parameters'] = {}
self.set('model_parameters', '# Parameters regarding the discretization of the spatial domain ')
Expand Down Expand Up @@ -272,6 +281,17 @@ def get_reduction_file(self, channel: int) -> Optional[str]:
return None
return raw

def get_pane_distance(self) -> Optional[float]:
"""
Return the distance between the camera and the window pane it looks through into the smoke.

:return: The distance [m], None if the smoke reaches the camera, which is also the case for a
config file written before the option.
:rtype: Optional[float]
:raises ValueError: If pane_distance is not a finite number of at least 0.
"""
return read_pane_distance(self, 'experiment_geometry', 'config_analysis.ini')

def in_camera_channels(self) -> None:
"""
Prompts the user to input the camera channels to analyse and updates the configuration.
Expand Down
14 changes: 14 additions & 0 deletions ledsa/analysis/ConfigDataStacked.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from typing import Dict, List, Optional

from ledsa.analysis.ConfigDataAnalysis import DEFAULT_REFERENCE_PROPERTY, parse_reference_properties
from ledsa.analysis.Experiment import read_pane_distance
from ledsa.analysis.temperature_correction import TEMPERATURE_CORRECTION_CHANNELS
from ledsa.core.config_file import save_config

Expand Down Expand Up @@ -38,6 +39,8 @@ class ConfigDataStacked(cp.ConfigParser):
[simulation_0]
path = /data/exp01/cam0
camera_position = 1.0 0.0 1.5
# distance to the window pane this camera looks through into the smoke, optional
pane_distance = 0.5

[simulation_1]
path = /data/exp01/cam1
Expand Down Expand Up @@ -144,6 +147,14 @@ def get_camera_position(self, sim_idx: int) -> List[float]:
"""Camera position ``[x, y, z]`` for simulation *sim_idx*."""
return self.get_list_of_values(f'simulation_{sim_idx}', 'camera_position', dtype=float)

def get_pane_distance(self, sim_idx: int) -> Optional[float]:
"""Distance [m] between camera *sim_idx* and the window pane it looks
through into the smoke, ``None`` if the smoke reaches the camera.

:raises ValueError: if ``pane_distance`` is not a finite number of at least 0.
"""
return read_pane_distance(self, f'simulation_{sim_idx}', self._filename)

def get_ref_img_indices(self, sim_idx: int) -> Optional[List[int]]:
"""Reference image IDs of simulation *sim_idx*; ``None`` means use
:meth:`get_num_ref_images`.
Expand Down Expand Up @@ -364,6 +375,9 @@ def create_template(cls, filename: str = DEFAULT_FILENAME, num_simulations: int
cfg[section]['path'] = f'/path/to/sim{i}'
cfg.set(section, '# Global X Y Z position [m] of camera')
cfg[section]['camera_position'] = '0.0 0.0 1.5'
cfg.set(section, '# Distance [m] between the camera and the window pane it looks through into')
cfg.set(section, '# the smoke (optional). Only the lines of sight behind the pane are in the smoke.')
cfg.set(section, '# pane_distance = 0.5')
cfg.set(section, '# Reference images of this camera; both options override the ones above')
cfg.set(section, '# Image IDs are counted per camera, so choose images from the same time')
cfg.set(section, '# window before the fire in every camera')
Expand Down
Loading
Loading