bbrozyna / light-propagation

Python lib to calculate diffraction structures and light propagation
MIT License
1 stars 2 forks source link

LightField storage data type #21

Open micdol opened 2 years ago

micdol commented 2 years ago

Reading the LigthField code now I see

so all math operations which are implemented so far are carried out on re and im representation, yet we store data as amp and phase. This leads to conversion back and forth on each call.

__mul__ can be simply refactored to

self.amplitde *= other.amplitude
self.phase += other.phase

however I see no improvement for __add__ and __sub__.

I'd analyze whether this for of data storage is the best for us.

Ideas:

micdol commented 2 years ago

Also I'd think whether we can just keep phase between [0, 2π) or [-π, π)