Skip to content

Commit 4e5a46d

Browse files
fixed bug v0.0.1.2
Changing the number of guide will correcly change the beams position relative to the new guides
1 parent 8964908 commit 4e5a46d

22 files changed

+51
-40
lines changed

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ under the directive of Pr. Nicolas Fressengeas.
1818
The bpm codes are mainly based on a compilation of MatLab codes initialy
1919
developed by Régis Grasser during his PhD thesis [#thesis]_,
2020
and later modified at the FEMTO-ST institute of the Université de
21-
Bourgogne-Franche-Comté and at the LMOPS laboratory [#lmops]_ of the
21+
Franche-Comté and at the LMOPS laboratory [#lmops]_ of the
2222
Université de Lorraine.
2323

2424
References

beampy/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Beampy is a module based on Beam Propagation Method, a numerical method
1+
"""Beampy is a module based on Beam Propagation Method, a numerical method
22
used to compute light propagation into a refractive index.
33
The light propagation is done by the :mod:`beampy.bpm` module, shown and
44
piloted by the :mod:`beampy.user_interface` module.
@@ -29,7 +29,7 @@
2929
# module
3030
from beampy import examples
3131

32-
__version__ = "0.0.1.1"
32+
__version__ = "0.0.1.2"
3333

3434

3535
def help():

beampy/user_interface.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ def calculate_guide(self, topology='array'):
279279
self.doubleSpinBox_offset_light.setEnabled(True)
280280
self.checkBox_offset_light.setChecked(False)
281281
self.checkBox_offset_light.setDisabled(True)
282+
self.offset_check *= 0
282283
self.checkBox_lost.setDisabled(True)
283284
self.checkBox_lost.setChecked(False)
284285
self.frame_lost.setDisabled(True)
@@ -291,11 +292,13 @@ def calculate_guide(self, topology='array'):
291292
self.checkBox_check_power.setEnabled(True)
292293

293294
# Define new min/max for light and looses, based on selected guides
294-
self.doubleSpinBox_offset_light.setMinimum(min(self.x))
295-
self.doubleSpinBox_offset_light.setMaximum(max(self.x))
296295
self.doubleSpinBox_offset_light.setSingleStep(1.0)
297296
self.doubleSpinBox_width_lost.setMaximum(self.length_x-self.dist_x)
298297
self.doubleSpinBox_lobe_size.setMaximum(self.length_x-self.dist_x)
298+
# If want to use min/max for offset: multiple beams will have issue if
299+
# the windows size change (min/max will only be for the displayed beam)
300+
# self.doubleSpinBox_offset_light.setMinimum(self.x[0])
301+
# self.doubleSpinBox_offset_light.setMaximum(self.x[-1])
299302

300303
self.calculate_guide_done = True
301304
t_guide_end = time.process_time()
@@ -325,16 +328,17 @@ def calculate_light(self):
325328

326329
for i in range(nbr_light):
327330

328-
# Check if offset in µm or in guide number
331+
# Check if offset relative to guide number or else in µm
329332
if self.offset_check[i] and self.peaks.shape[0] != 0:
330333

331334
# Reduce light # if > guides #
332-
if (self.topology == 'array'
333-
and self.offset_light_peak[i] > self.nbr_p):
334-
self.offset_light_peak[i] = self.nbr_p - 1
335-
elif (self.topology == 'curved'
336-
and self.offset_light_peak[i] > 3):
337-
self.offset_light_peak[i] = 3 - 1
335+
peaks_i = self.offset_light_peak[i]
336+
peaks_max = self.spinBox_offset_light_peak.maximum()
337+
338+
if peaks_i > peaks_max:
339+
print("beam", i+1, "has a non-existing guide position")
340+
print("Change position from", peaks_i, "to", peaks_max)
341+
self.offset_light_peak[i] = peaks_max
338342

339343
offset_light = self.peaks[self.offset_light_peak[i], 0]
340344

docs/html/.buildinfo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Sphinx build info version 1
22
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3-
config: a5a90952a14e9d65e4eace05767b9430
3+
config: 8116325f5fcdc414db89fc5ae6481eaf
44
tags: 645f666f9bcd5a90fca523b33c5a78b7

docs/html/.doctrees/beampy.doctree

0 Bytes
Binary file not shown.

docs/html/.doctrees/codes.doctree

480 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

docs/html/.doctrees/index.doctree

391 Bytes
Binary file not shown.

docs/html/LICENSE.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<meta name="viewport" content="width=device-width, initial-scale=1.0">
1010

11-
<title>MIT License &mdash; beampy 0.0.1.1 documentation</title>
11+
<title>MIT License &mdash; beampy 0.0.1.2 documentation</title>
1212

1313

1414

docs/html/_static/documentation_options.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
var DOCUMENTATION_OPTIONS = {
22
URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
3-
VERSION: '0.0.1.1',
3+
VERSION: '0.0.1.2',
44
LANGUAGE: 'None',
55
COLLAPSE_INDEX: false,
66
FILE_SUFFIX: '.html',

0 commit comments

Comments
 (0)