Skip to content

Commit 406695f

Browse files
committed
Change Sellmeier to not modify wavelength in-place
Sellmeier was modifying the passed wavelength array in-place, which produced confusing behaviour.
1 parent 37eee5d commit 406695f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

refellips/dispersion.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -293,12 +293,12 @@ def complex(self, wavelength):
293293
wav = wavelength
294294

295295
# Convert between μm & nm (constants are typically given in μm)
296-
wav *= 1e-3
296+
wav_um = wav * 1e-3
297297

298298
real = np.sqrt(
299299
self.Einf.value
300-
+ (self.Am.value * wav**2) / (wav**2 - self.En.value**2)
301-
- (self.P.value * wav**2)
300+
+ (self.Am.value * wav_um**2) / (wav_um**2 - self.En.value**2)
301+
- (self.P.value * wav_um**2)
302302
)
303303
return real + 1j * 0.0
304304

@@ -311,12 +311,12 @@ def epsilon(self, wavelength):
311311
wav = wavelength
312312

313313
# Convert between μm & nm (constants are typically given in μm)
314-
wav *= 1e-3
314+
wav_um = wav * 1e-3
315315

316316
real = (
317317
self.Einf.value
318-
+ (self.Am.value * wav**2) / (wav**2 - self.En.value**2)
319-
- (self.P.value * wav**2)
318+
+ (self.Am.value * wav_um**2) / (wav_um**2 - self.En.value**2)
319+
- (self.P.value * wav_um**2)
320320
)
321321

322322
return real + 1j * 0

0 commit comments

Comments
 (0)