Open srio opened 7 years ago
To 1&2) Maybe it would be better to remove the current Radiation, rename ElectricalField to Radiation and add an intensity method to Radiation. The sloppy guy who forced in ElectricalField did not want to break the class structure 3 days before the project presentation. But the proposed way is probably better.
To 3) To use a way similar to the Cooley–Tukey FFT algorithm you need an equidistant frequency grid. So maybe it is better to give a start and end frequency as well as the number of frequency points to use. -OR- you use a list and look if the grid is equidistant and use the fast FFT motivated idee. If not equidistant calculate each single point. But in the latter case performance will degrade significantly due to slow calculation of the complex exponential.
For:
Simulation.spectrum will use RadiationFactory to calculate RadiationIntensity (now 3D arrays vs X,Y,E) and return the integral over axes 0 and 1.
Seems to be a good idea to just add the frequency dimension here. There is however one drawback: If you simply use a 3D array to store E(omega, x, y) the x,y dimensions are the same for each energy. However the size of the cone and the resolution which is related to the wavelength changes with omega in consequence x,y dimensions that are good for the first harmonic may be too coarse for the 6th.
A possible alternatie could be: to make a Spectrum class that takes a list of Radiation objects instead. RadiationFactory returns alist of Radiation objects (one per frequency). Use than the factory to create for each harmonic sufficently accurate Radiation objects and merge their lists to a single big list.
Cons:
Pros:
I propose to make these modifications in the classes to allow easier calculations for many energies. Comments welcomed!!
1) Rename Radiation to RadiationIntensity 2) Rename ElectricalField to RadiationElectricField 3) RadiationFactory should accept a list or array in self.photon_frequency and do calculations for all frequencies 4) Simulation should also contain RadiationElectricField.
Simulation.spectrum will use RadiationFactory to calculate RadiationIntensity (now 3D arrays vs X,Y,E) and return the integral over axes 0 and 1.
Cons:
Pros: