Open field¶
Description¶
The open field operation consists of an erosion treatment followed by a dilate treatment
Parameters¶
- base:
Base
The input base
- base:
- variables: list(str)
The list of variables to open
- passes: int, default = 1
The number of times the dilate and erosion treatments are applied to the base
- memory_mode: bool, default =
False
If True, the modifications are done directly on the input base to limit memory usage. If False, a new base is created.
- memory_mode: bool, default =
Preconditions¶
Same as the dilate and erosion treatments.
Postconditions¶
Same as the dilate and erosion treatments.
Usage¶
import antares
treatment = antares.Treatment('openfield')
treatment['base'] = base
treatment['variables'] = ['var1', 'var2']
treatment['passes'] = 2
open_base = treatment.execute()
or
import antares
open_base = antares.treatment.OpenField(
base = base,
variables = ['var1', 'var2'],
passes = 2,)
Example¶
The following example shows the effect of opening a field for 1 pass and 2 passes.
import os
import antares
# Prepare output folder
output_folder = os.path.join("OUTPUT", "TreatmentOpenField")
os.makedirs(output_folder, exist_ok=True)
# Read example base
base = antares.io.Read(
filename='../data/AMR/amr_example.h5',
format='hdf_antares',)
# Apply open field treatment
open_base_1_pass = antares.treatment.OpenField(
base=base,
variables=['metric'],
passes=1)
open_base_2_passes = antares.treatment.OpenField(
base=base,
variables=['metric'],
passes=2)
# Dump bases
antares.io.Dump(
base=open_base_1_pass,
filename='open_base_1_pass',
folder=output_folder,
format='hdf_antares',)
antares.io.Dump(
base=open_base_2_passes,
filename='open_base_2_passes',
folder=output_folder,
format='hdf_antares',)
Open field after 1 pass
Open field after 2 passes