For Field sensor p(x,y,z,f):
Easiest is to create a 'Calculator' and calculate it yourself, then right click field and select 'To Python..' to get the corresponding Python code
Select overall field -> p(x,y,z,f) -> Field Data Tools -> Calculator -> Value Location: Cell Center -> Scalar Variables: F (Re{p}) -> Scalar Variables: G (Im{p}) -> Expression: atan(G/F) (change it to read this or whatever suitable formula you wish)
Then you can use the viewers (note, careful with division by zero, you'll need to adjust the color bar accordingly, also you'll get 'wrapped' angles)
(In the next reply I'll show you how you can extract the field, manipulate it, and plot it back ... Very useful to plot arbitrary numpy arrays in S4L)
Python code:
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 ReleaseVersion
from s4l_v1 import Unit
# Creating the analysis pipeline
# Adding a new SimulationExtractor
simulation = document.AllSimulations["Single Element Focused Transducer"]
simulation_extractor = simulation.Results()
# Adding a new AcousticSensorExtractor
acoustic_sensor_extractor = simulation_extractor["Overall Field"]
# Adding a new FieldCalculator
inputs = [acoustic_sensor_extractor.Outputs["p(x,y,z,f)"]]
field_calculator = analysis.field.FieldCalculator(inputs=inputs)
field_calculator.Expression = u"atan(G/F)"
field_calculator.ValueLocation = field_calculator.ValueLocation.enum.CellCenter
field_calculator.UpdateAttributes()
document.AllAlgorithms.Add(field_calculator)
# Adding a new SliceFieldViewer
inputs = [field_calculator.Outputs["Result(x,y,z)"]]
slice_field_viewer = analysis.viewers.SliceFieldViewer(inputs=inputs)
slice_field_viewer.Data.Mode = slice_field_viewer.Data.Mode.enum.QuantityRealPart
slice_field_viewer.Slice.Plane = slice_field_viewer.Slice.Plane.enum.XZ
slice_field_viewer.Slice.Index = 155
slice_field_viewer.UpdateAttributes()
document.AllAlgorithms.Add(slice_field_viewer)