All the calculations should be carried out on single data structure as input/output.
This structure:
physically = state of light field at given plane
mathematically = I'd say it should support simple operations which make sense physically like add, multiply but not necessarily all
programatically = I'd say array with two matrices, each pixel is [re, im]
I am not sure whether all of that make sens but maybe it will be easier to discuss if you see usage I have in mind
re = propagation.load(re = 're.png', im = 0)
im = propagation.load(re = 0, im = 'im.png')
field = re + im
init_field = field #deep copy?
#dummy ASD
propagation.fft(field, inplace=true)
field = field * propagation.kernel(distance = 0.3)
propagation.ifft(field, inplace=true)
#but also
propagator = propagation.get_propagator_for(type = 'ASD')
back_propagated_field = propagator.propagate(field, distance = -0.3, inplace = false)
assert back_propagated_field == init_field
I am wondering where to draw a line between which math operations should be members of field class and which should be utility methods in the propagation namespace. I'd consider cv::Mat as a good reference.
Some other properties to consider
field.intensity() -> [re**2+im**2, 1]?field.abs() -> #[sqrt(re**2 + im**2, 1]?field.re() -> #[re, 0]field.im() -> #[0, im]field.arg() -> [atan2(im/re), 1]??? so mod 2π, how would it differ from field.phase() should you decide on adding that one?
All the calculations should be carried out on single data structure as input/output.
This structure:
I am not sure whether all of that make sens but maybe it will be easier to discuss if you see usage I have in mind
I am wondering where to draw a line between which math operations should be members of
field
class and which should be utility methods in thepropagation
namespace. I'd consider cv::Mat as a good reference.Some other properties to consider
field.intensity()
->[re**2+im**2, 1]?
field.abs()
->#[sqrt(re**2 + im**2, 1]?
field.re()
->#[re, 0]
field.im()
->#[0, im]
field.arg()
->[atan2(im/re), 1]???
so mod 2π, how would it differ fromfield.phase()
should you decide on adding that one?