Skip to content

Commit

Permalink
v0.0.1.4
Browse files Browse the repository at this point in the history
bpm:
add condition to display the last point.
fixed a possible error for airy_zero not being int.
display max mode when at least one beam uses all_mode.
add ylim condition to scale up if last intensity is higher than first one.
  • Loading branch information
Python-simulation committed Jan 26, 2020
1 parent 02c7ef7 commit 3cf4722
Show file tree
Hide file tree
Showing 22 changed files with 62 additions and 39 deletions.
2 changes: 1 addition & 1 deletion beampy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# module
from beampy import examples

__version__ = "0.0.1.3.post1"
__version__ = "0.0.1.4"


def help():
Expand Down
4 changes: 2 additions & 2 deletions beampy/bpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,6 @@ def all_modes(self, lo, offset_light=0):
except ValueError:
break

print("This guide can propagate up to the modes", i-1)
return [field, h, gamma, beta]

def check_modes(self, lo):
Expand Down Expand Up @@ -1184,7 +1183,8 @@ def main_compute(self, chi3=1e-19, kerr=False, kerr_loop=1,

# Display condition: if i+1 is a multiple of pas: i+1 % pas = 0
# = False, so must use if not to have True
if not (self.i + 1) % self.pas:
# last condition to have last point if not a multiple of pas
if not (self.i + 1) % self.pas or self.i+1 == self.nbr_z-1:
index += 1
self.progress_pow[index, :] = np.array([self.current_power])

Expand Down
16 changes: 11 additions & 5 deletions beampy/user_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def __init__(self):
self.mode = np.array([], dtype=int)
self.offset_light_peak = np.array([], dtype=int)
self.airy_check = []
self.airy_zero = []
self.airy_zero = np.array([], dtype=int)
self.lobe_size = []
self.previous_beam = 0

Expand Down Expand Up @@ -304,7 +304,6 @@ def calculate_guide(self, topology='array'):
self.checkBox_check_power.setEnabled(True)

# Define new min/max for light and looses, based on selected guides
self.doubleSpinBox_offset_light.setSingleStep(1.0)
self.doubleSpinBox_width_lost.setMaximum(self.length_x-self.dist_x)
self.doubleSpinBox_lobe_size.setMaximum(self.length_x-self.dist_x)
# If want to use min/max for offset: multiple beams will have issue if
Expand Down Expand Up @@ -338,6 +337,9 @@ def calculate_light(self):
nbr_light = self.comboBox_light.count() # Number of beams
field = np.zeros((nbr_light, self.nbr_x))

if sum(self.all_modes_check) > 0: # Display only once the max mode
self.check_modes_display()

for i in range(nbr_light):

# Check if offset relative to guide number or else in µm
Expand Down Expand Up @@ -377,7 +379,7 @@ def calculate_light(self):
self.mode[i], self.lo, offset_light=offset_light)[0]

except ValueError as ex: # Say that no mode exist
print(ex)
print(ex, "for the beam", i)
continue # Go to the next field

elif self.airy_check[i]:
Expand Down Expand Up @@ -545,8 +547,12 @@ def addmpl(self, tab='guide', pow_index=0):

ax2.set_xlim(x_min, x_max)

ax2.set_ylim(0,
max(self.dn[0, :])*1.1 + 1E-20)
if max(self.dn[0, :]) > max(self.dn[-1, :]):
ax2.set_ylim(0,
max(self.dn[0, :])*1.1 + 1E-20)
else:
ax2.set_ylim(0,
max(self.dn[-1, :])*1.1 + 1E-20)

ax2.plot(self.x, self.dn[pow_index_guide], 'k')

Expand Down
2 changes: 1 addition & 1 deletion docs/html/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 0d720dd1f008c44a89fa7d947d94833c
config: 956ffc6ad44730b3bf032dd75d98bcab
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file modified docs/html/.doctrees/beampy.doctree
Binary file not shown.
Binary file modified docs/html/.doctrees/codes.doctree
Binary file not shown.
Binary file modified docs/html/.doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/html/.doctrees/index.doctree
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/html/LICENSE.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

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

<title>MIT License &mdash; beampy 0.0.1.3 documentation</title>
<title>MIT License &mdash; beampy 0.0.1.4 documentation</title>



Expand Down
2 changes: 1 addition & 1 deletion docs/html/_static/documentation_options.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var DOCUMENTATION_OPTIONS = {
URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
VERSION: '0.0.1.3',
VERSION: '0.0.1.4',
LANGUAGE: 'None',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
Expand Down
4 changes: 2 additions & 2 deletions docs/html/beampy.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

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

<title>Beampy modules &mdash; beampy 0.0.1.3 documentation</title>
<title>Beampy modules &mdash; beampy 0.0.1.4 documentation</title>



Expand Down Expand Up @@ -160,7 +160,7 @@

<div class="section" id="beampy-modules">
<h1>Beampy modules<a class="headerlink" href="#beampy-modules" title="Permalink to this headline"></a></h1>
<p>List of all the modules used in Beampy as of Jan 25, 2020 for the version 0.0.1.3</p>
<p>List of all the modules used in Beampy as of Jan 26, 2020 for the version 0.0.1.4</p>
<p><a class="reference internal" href="codes.html#codes"><span class="std std-ref">Source codes</span></a></p>
<div class="section" id="beampy-bpm">
<h2>beampy.bpm<a class="headerlink" href="#beampy-bpm" title="Permalink to this headline"></a></h2>
Expand Down

0 comments on commit 3cf4722

Please sign in to comment.