Skip to content

Commit dd59551

Browse files
v0.0.1.3
Better xlim fix doc encoding bug in pypi
1 parent 6268611 commit dd59551

23 files changed

+71
-106
lines changed

beampy/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
# module
3030
from beampy import examples
3131

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

3434

3535
def help():

beampy/bpm.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
1111
The bpm codes are mainly based on a compilation of MatLab codes initialy
1212
developed by Régis Grasser during his PhD thesis[2],
13-
and later modified at the LMOPS laboratory[3].
13+
and later modified at the FEMTO-ST institute of the Université de
14+
Franche-Comté and at the LMOPS laboratory [3] of the
15+
Université de Lorraine.
1416
1517
[1] K. Okamoto, in Fundamentals of Optical Waveguides,
1618
2nd ed., edited by K. Okamoto (Academic, Burlington, 2006), pp. 329–397.

beampy/user_interface.py

Lines changed: 20 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,22 @@ def addmpl(self, tab='guide', pow_index=0):
477477
if pow_index < 0:
478478
pow_index_guide -= 1 # Display the -2 guide for the -1 beam
479479

480+
x_min = self.x[0]
481+
x_max = self.x[-1]
482+
483+
if (self.topology == 'array' # If array of guides
484+
and self.nbr_p != 0 and self.p != 0 # If guides exists
485+
and self.peaks[0, 0] >= self.x[0] # If guides in the windows
486+
and self.peaks[-1, -1] <= self.x[-1]):
487+
x_min = self.offset_guide - self.nbr_p*self.p
488+
x_max = self.offset_guide + self.nbr_p*self.p
489+
490+
if (self.topology == 'curved' # If curved guides
491+
and self.peaks[0, 0] >= self.x[0] # If guides in the windows
492+
and self.peaks[-1, -1] <= self.x[-1]):
493+
x_min = self.peaks[0, 0] - self.width
494+
x_max = self.peaks[-1, -1] + self.width
495+
480496
if tab == 'guide':
481497
fig = Figure()
482498
fig.set_tight_layout(True) # Prevent axes to be cut when resizing
@@ -485,16 +501,7 @@ def addmpl(self, tab='guide', pow_index=0):
485501
ax1.set_xlabel('x (µm)')
486502
ax1.set_ylabel('z (mm)')
487503

488-
if self.nbr_p != 0 and self.p != 0 and self.topology != 'curved':
489-
x_min = self.offset_guide - self.nbr_p*self.p
490-
if x_min < self.x[0]:
491-
x_min = self.x[0]
492-
493-
x_max = self.offset_guide + self.nbr_p*self.p
494-
if x_max > self.x[-1]:
495-
x_max = self.x[-1]
496-
497-
ax1.set_xlim(x_min, x_max)
504+
ax1.set_xlim(x_min, x_max)
498505

499506
# note that a colormesh pixel is based on 4 points
500507
ax1.pcolormesh(self.xv,
@@ -524,16 +531,7 @@ def addmpl(self, tab='guide', pow_index=0):
524531
poly = Polygon(verts, facecolor='0.9', edgecolor='0.5')
525532
ax2.add_patch(poly)
526533

527-
if self.p != 0 and self.topology != 'curved':
528-
x_min = self.offset_guide - self.nbr_p*self.p
529-
if x_min < self.x[0]:
530-
x_min = self.x[0]
531-
532-
x_max = self.offset_guide + self.nbr_p*self.p
533-
if x_max > self.x[-1]:
534-
x_max = self.x[-1]
535-
536-
ax2.set_xlim(x_min, x_max)
534+
ax2.set_xlim(x_min, x_max)
537535

538536
ax2.set_ylim(0,
539537
max(self.dn[0, :])*1.1 + 1E-20)
@@ -572,16 +570,7 @@ def addmpl(self, tab='guide', pow_index=0):
572570
poly = Polygon(verts, facecolor='0.9', edgecolor='0.5')
573571
ax1.add_patch(poly)
574572

575-
if self.p != 0 and self.topology != 'curved':
576-
x_min = self.offset_guide - self.nbr_p*self.p
577-
if x_min < self.x[0]:
578-
x_min = self.x[0]
579-
580-
x_max = self.offset_guide + self.nbr_p*self.p
581-
if x_max > self.x[-1]:
582-
x_max = self.x[-1]
583-
584-
ax1.set_xlim(x_min, x_max)
573+
ax1.set_xlim(x_min, x_max)
585574

586575
ax1.set_ylim(0,
587576
max(1.1*self.dn[pow_index_guide, :]) + 1E-20)
@@ -621,18 +610,7 @@ def addmpl(self, tab='guide', pow_index=0):
621610
ax1.set_xlabel('x (µm)')
622611
ax1.set_ylabel('z (mm)')
623612

624-
if (self.nbr_p != 0 and self.p != 0
625-
and self.topology != 'curved'):
626-
627-
x_min = self.offset_guide - self.nbr_p*self.p
628-
if x_min < self.x[0]:
629-
x_min = self.x[0]
630-
631-
x_max = self.offset_guide + self.nbr_p*self.p
632-
if x_max > self.x[-1]:
633-
x_max = self.x[-1]
634-
635-
ax1.set_xlim(x_min, x_max)
613+
ax2.set_xlim(x_min, x_max)
636614

637615
ax1.pcolormesh(self.xv,
638616
self.zv,

docs/conf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
# sphinx-build -b html . html
2525
# sphinx-build -M latexpdf . latexpdf
2626

27+
# When uploading the online version, wipe the project cache at readthedocs
28+
# before or will fail compiling pip
2729
# -- Project information -----------------------------------------------------
2830

2931
project = 'beampy'

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: 8116325f5fcdc414db89fc5ae6481eaf
3+
config: 0d720dd1f008c44a89fa7d947d94833c
44
tags: 645f666f9bcd5a90fca523b33c5a78b7

docs/html/.doctrees/beampy.doctree

204 Bytes
Binary file not shown.

docs/html/.doctrees/codes.doctree

-1.37 KB
Binary file not shown.
0 Bytes
Binary file not shown.

docs/html/.doctrees/index.doctree

0 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.2 documentation</title>
11+
<title>MIT License &mdash; beampy 0.0.1.3 documentation</title>
1212

1313

1414

0 commit comments

Comments
 (0)