Example of mask filter in postpro?

I have an e-field in a simulation. I would like to mask some regions to compute statistics. Is there an example/tutorial about how to do this in python? thx

The typical workflow is to first build the postprocessing pipeline in the GUI, then use the "To Python" tool (available from the right-click contextual menu) to generate the corresponding Python script.

For the mask filter + SAR statistics, it would give something like this:

import numpy
import s4l_v1.analysis as analysis
import s4l_v1.document as document
import s4l_v1.model as model
import s4l_v1.units as units
from s4l_v1 import Unit

# Creating the analysis pipeline
# Adding a new SimulationExtractor
simulation = document.AllSimulations["Dipole (Broadband) - Copy"]
simulation_extractor = simulation.Results()

# Adding a new EmSensorExtractor
em_sensor_extractor = simulation_extractor["Overall Field"]
em_sensor_extractor.FrequencySettings.ExtractedFrequency = u"All"
em_sensor_extractor.Normalization.Normalize = True
em_sensor_extractor.Normalization.AvailableReferences = u"EM Input Power(f)"
em_sensor_extractor.SurfaceCurrent.SurfaceResolution = 0.001, units.Meters
document.AllAlgorithms.Add(em_sensor_extractor)

entity1=model.AllEntities()['Sphere 1']

# Adding a new FieldMaskingFilter
inputs = [em_sensor_extractor.Outputs["EM E(x,y,z,f0)"]]
field_masking_filter = analysis.core.FieldMaskingFilter(inputs=inputs)
field_masking_filter.SetAllMaterials(False)
field_masking_filter.SetEntities([entity1])
field_masking_filter.UpdateAttributes()
document.AllAlgorithms.Add(field_masking_filter)

# Adding a new SarStatisticsEvaluator
inputs = [field_masking_filter.Outputs["EM E(x,y,z,f0)"]]
sar_statistics_evaluator = analysis.em_evaluators.SarStatisticsEvaluator(inputs=inputs)
sar_statistics_evaluator.Snapshot = u"3e+08"
sar_statistics_evaluator.StdDev = False
sar_statistics_evaluator.TotalLossyVolume = False
sar_statistics_evaluator.VoxelCount = False
sar_statistics_evaluator.LossyVoxelCount = False
sar_statistics_evaluator.UpdateAttributes()
document.AllAlgorithms.Add(sar_statistics_evaluator)

Thanks so much!