Skip to content

Commit

Permalink
refactor to v2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Sylwia Majchrowska authored and majsylw committed Apr 26, 2022
1 parent 81e2858 commit ffd53af
Show file tree
Hide file tree
Showing 20 changed files with 88 additions and 87 deletions.
23 changes: 14 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ python test_Dudley.py
And you expect to visualise supercontinuum generation process in use of 3 types
of pulses (simulation similar to Fig.3 of Dudley et. al, RMP 78 1135 (2006)):

![supercontinuum_generation](https://github.com/WUST-FOG/gnlse-python/raw/master/data/supercontinuum_3pulses.png)
![soliton_traping](./data/supercontinuum_3pulses.png)

### Major features

Expand Down Expand Up @@ -80,23 +80,26 @@ And you expect to visualise supercontinuum generation process in use of 3 types
- **Available demos**

We prepare few examples in `examples` subdirectory:
- plot_input_pulse.py: plots envelope of different impulse shapes,
- plot_input_pulse.py: plots envelope of different pulse shapes,
- plot_Raman_response.py: plots different Raman in temporal domain,
- test_3rd_order_soliton.py: evolution of the spectral and temporal characteristics of the 3rd order soliton,
- test_dispersion.py: example of supercontinuum generation using different dispersion operators,
- test_nonlinearity.py: example of supercontinuum generation using different GNLSE and M-GNLSE (take into account mode profile dispersion),
- test_Dudley.py: example of supercontinuum generation with three types of input pulse,
- test_gvd.py: example of impuls broadening due to group velocity dispersion,
- test_gvd.py: example of pulse broadening due to group velocity dispersion,
- test_import_export.py: example of saving file with `.mat` extension,
- test_raman.py: example of soliton fision for diffrent raman response functions,
- test_spm.py: example of self phase modulation,
- test_spm+gvd.py: example of generation of 1st order soliton.

## Release History

v1.1.3 was released in 13/2/2022.
The master branch works with **python 3.7**.
v2.0.0 was released in 26/4/2022.
The main branch works with **python 3.7**.

* **2.0.0 -> Apr 26th, 2022**
* CHANGE: Code refactor - rename envelopes module
* FIX: Fixed extrapolation for nonlinear coefficient
* **1.1.3 -> Feb 13th, 2022**
* FIX: Shift scalling data for interpolated dispersion
* **1.1.2 -> Aug 30th, 2021**
Expand All @@ -115,10 +118,10 @@ The master branch works with **python 3.7**.

## Authors

- [Adam Pawłowski](https://github.com/adampawl)
- [Paweł Redman](https://redman.xyz/)
- [Daniel Szulc](http://szulc.xyz/)
- [Magda Zatorska](https://github.com/magdazatorska)
- [Adam Pawłowski](https://github.com/adampawl)
- [Daniel Szulc](http://szulc.xyz/)
- [Sylwia Majchrowska](https://majsylw.netlify.app/)
- [Karol Tarnowski](http://www.if.pwr.wroc.pl/~tarnowski/)

Expand All @@ -136,8 +139,10 @@ by J. M. Dudley and J. R. Taylor, available at

```
@misc{redman2021gnlsepython,
title={gnlse-python: Open Source Software to Simulate Nonlinear Light Propagation In Optical Fibers},
author={Paweł Redman and Magdalena Zatorska and Adam Pawłowski and Daniel Szulc and Sylwia Majchrowska and Karol Tarnowski},
title={gnlse-python: Open Source Software to Simulate
Nonlinear Light Propagation In Optical Fibers},
author={Paweł Redman and Magdalena Zatorska and Adam Pawłowski
and Daniel Szulc and Sylwia Majchrowska and Karol Tarnowski},
year={2021},
eprint={2110.00298},
archivePrefix={arXiv},
Expand Down
2 changes: 1 addition & 1 deletion docs/code_documentation.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GNLSE package documentation
===========================

Impulse envelopes
Pulse envelopes
-----------------

This module allows one to model proper input envelope as the given initial
Expand Down
2 changes: 1 addition & 1 deletion docs/envelopes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ input pulse. The below figure illustrates a modulated waves varying between
an upper and a lower envelope of four types of optical signal.

.. image:: _static/input_pulse.png
:alt: example_input_impulse
:alt: example_input_pulse

.. autoclass:: gnlse.SechEnvelope
.. autoclass:: gnlse.GaussianEnvelope
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/example_dispersive_wave.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ crystal fiber using three different models to model Raman response. ::
setup.time_window = 12.5 # ps
setup.z_saves = 400
# Input impulse parameters
# Input pulse parameters
peak_power = 10000 # W
duration = 0.050284 # ps
# Physical parameters
setup.wavelength = 835 # nm
setup.fiber_length = 0.15 # m
setup.nonlinearity = 0.11 # 1/W/m
setup.impulse_model = gnlse.SechEnvelope(peak_power, duration)
setup.pulse_model = gnlse.SechEnvelope(peak_power, duration)
setup.self_steepening = True
# The dispersion model is built from a Taylor expansion with coefficients
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/example_effective_mode_area.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ a 15 centimeter long photonic crystal fiber. ::
setup.raman_model = gnlse.raman_blowwood
setup.self_steepening = True

# Input impulse parameters
# Input pulse parameters
power = 10000
# pulse duration [ps]
tfwhm = 0.05
# hyperbolic secant
setup.impulse_model = gnlse.SechEnvelope(power, tfwhm)
setup.pulse_model = gnlse.SechEnvelope(power, tfwhm)

# The dispersion model is built from a Taylor expansion with coefficients
# given below.
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/example_soliton.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ higher-order N = 3 soliton in three cases:
Z0 = np.pi * LD / 2
# Fiber length [m]
setup.fiber_length = .5
# Type of impulse: hyperbolic secant
setup.impulse_model = gnlse.SechEnvelope(power, 0.050)
# Type of pulse: hyperbolic secant
setup.pulse_model = gnlse.SechEnvelope(power, 0.050)
# Loss coefficient [dB/m]
loss = 0
# Type of dyspersion operator: build from Taylor expansion
Expand Down
14 changes: 7 additions & 7 deletions docs/examples/example_supercontinuum.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,28 @@ different input shape of input pulse's envelopes.
])
setup.dispersion_model = gnlse.DispersionFiberFromTaylor(loss, betas)
# Input impulse parameters
# Input pulse parameters
peak_power = 10000 # W
duration = 0.050 # ps
# This example extends the original code with additional simulations for
impulse_models = [
pulse_models = [
gnlse.SechEnvelope(peak_power, duration),
gnlse.GaussianEnvelope(peak_power, duration),
gnlse.LorentzianEnvelope(peak_power, duration)
]
count = len(impulse_models)
count = len(pulse_models)
plt.figure(figsize=(14, 8), facecolor='w', edgecolor='k')
for i, impulse_model in enumerate(impulse_models):
print('%s...' % impulse_model.name)
for i, pulse_model in enumerate(pulse_models):
print('%s...' % pulse_model.name)
setup.impulse_model = impulse_model
setup.pulse_model = pulse_model
solver = gnlse.GNLSE(setup)
solution = solver.run()
plt.subplot(2, count, i + 1)
plt.title(impulse_model.name)
plt.title(pulse_model.name)
gnlse.plot_wavelength_vs_distance(solution, WL_range=[400, 1400])
plt.subplot(2, count, i + 1 + count)
Expand Down
41 changes: 20 additions & 21 deletions docs/gnlse_intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ Installation

``git clone https://github.com/WUST-FOG/gnlse-python.git``

4. Install the requirements:

``pip install -r requirements.txt``

5. Install the package:
4. Install the package with all requirements:

``pip install .``

Expand Down Expand Up @@ -85,7 +81,7 @@ Major features
and calculated from effective refractive indices.
* A number of example scripts in the ``examples`` subdirectory:

* ``plot_input_pulse.py``, plotting various input impulse envelopes,
* ``plot_input_pulse.py``, plotting various input pulse envelopes,
* ``plot_Raman_response.py``, plotting supported Raman response functions
in the time domain,
* ``test_3rd_order_soliton.py``, demonstrating the evolution of spectral
Expand All @@ -96,8 +92,8 @@ Major features
different GNLSE and M-GNLSE
(take into account mode profile dispersion),
* ``test_Dudley``, an example of supercontinuum generation using
different input impulse envelopes,
* ``test_gvd``, showing impulse broadening due to group velocity
different input pulse envelopes,
* ``test_gvd``, showing pulse broadening due to group velocity
dispersion,
* ``test_import_export.py``, an example of saving and loading simulation
results to and from a \*.mat file.
Expand All @@ -110,21 +106,24 @@ Major features
Release information
-------------------

v1.1.2 was released on August 30, 2021. The master branch works with
v2.0.0 was released on April 26, 2022. The master branch works with
**Python 3.7.**

======= =============== ====================================================
Version Date Notes
======= =============== ====================================================
1.1.2 August 30, 2021 * ADD: Continious wave envelope
* FIX: Shift scalling data for nonlinear coefficient
1.1.1 August 28, 2021 * CHANGE: Minor bug fix with scaling
* CHANGE: Few minor changes in the documentation
1.1.0 August 21, 2021 * Modified-GNLSE extension
* CHANGE: Code refactor - relocate attribiutes
1.0.0 August 13, 2020 * The first proper release
* CHANGE: Complete documentation and code.
======= =============== ====================================================
======= ================= ====================================================
Version Date Notes
======= ================= ====================================================
2.0.0 April 26, 2022 * CHANGE: Code refactor - rename modules
* FIX: Fixed extrapolation for nonlinear coefficient
1.1.3 February 13, 2022 * FIX: Fix scaling for interpolated dispersion
1.1.2 August 30, 2021 * ADD: Continious wave envelope
* FIX: Shift scalling data for nonlinear coefficient
1.1.1 August 28, 2021 * CHANGE: Minor bug fix with scaling
* CHANGE: Few minor changes in the documentation
1.1.0 August 21, 2021 * Modified-GNLSE extension
* CHANGE: Code refactor - relocate attribiutes
1.0.0 August 13, 2020 * The first proper release
* CHANGE: Complete documentation and code.
======= ================= ====================================================

Authors
*******
Expand Down
14 changes: 7 additions & 7 deletions examples/plot_input_pulse.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Calculates envelopes of various impulses and plots them.
Based on the chosen envelopes impulse, the aplitude envelope is
"""Calculates envelopes of various pulses and plots them.
Based on the chosen envelopes pulse, the aplitude envelope is
calculated and shown on the graph. There are three
available envelopes impulses models:
available envelopes pulses models:
hyperbolic secant, gaussian and lorentzian.
"""

Expand All @@ -11,18 +11,18 @@
import gnlse

if __name__ == '__main__':
# time full with half maximum of impulse
# time full with half maximum of pulse
FWHM = 2
# Time grid [ps]
T = np.linspace(-2 * FWHM, 2 * FWHM, 1000 * FWHM)
# peak power [W]
Pmax = 100

# Amplitude envelope of gaussina impulse
# Amplitude envelope of gaussina pulse
A1 = gnlse.GaussianEnvelope(Pmax, FWHM).A(T)
# Amplitude envelope of hiperbolic secans impulse
# Amplitude envelope of hiperbolic secans pulse
A2 = gnlse.SechEnvelope(Pmax, FWHM).A(T)
# Amplitude envelope of lorentzian impulse
# Amplitude envelope of lorentzian pulse
A3 = gnlse.LorentzianEnvelope(Pmax, FWHM).A(T)
# Amplitude envelope of continious wave
A4 = gnlse.CWEnvelope(Pmax).A(T)
Expand Down
4 changes: 2 additions & 2 deletions examples/test_3rd_order_soliton.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
Z0 = np.pi * LD / 2
# Fiber length [m]
setup.fiber_length = .5
# Type of impulse: hyperbolic secant
setup.impulse_model = gnlse.SechEnvelope(power, 0.050)
# Type of pulse: hyperbolic secant
setup.pulse_model = gnlse.SechEnvelope(power, 0.050)
# Loss coefficient [dB/m]
loss = 0
# Type of dyspersion operator: build from Taylor expansion
Expand Down
14 changes: 7 additions & 7 deletions examples/test_Dudley.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,28 +39,28 @@
])
setup.dispersion_model = gnlse.DispersionFiberFromTaylor(loss, betas)

# Input impulse parameters
# Input pulse parameters
peak_power = 10000 # W
duration = 0.050 # ps

# This example extends the original code with additional simulations for
impulse_models = [
pulse_models = [
gnlse.SechEnvelope(peak_power, duration),
gnlse.GaussianEnvelope(peak_power, duration),
gnlse.LorentzianEnvelope(peak_power, duration)
]

count = len(impulse_models)
count = len(pulse_models)
plt.figure(figsize=(14, 8), facecolor='w', edgecolor='k')
for i, impulse_model in enumerate(impulse_models):
print('%s...' % impulse_model.name)
for i, pulse_model in enumerate(pulse_models):
print('%s...' % pulse_model.name)

setup.impulse_model = impulse_model
setup.pulse_model = pulse_model
solver = gnlse.GNLSE(setup)
solution = solver.run()

plt.subplot(2, count, i + 1)
plt.title(impulse_model.name)
plt.title(pulse_model.name)
gnlse.plot_wavelength_vs_distance(solution, WL_range=[400, 1400])

plt.subplot(2, count, i + 1 + count)
Expand Down
4 changes: 2 additions & 2 deletions examples/test_dispersion.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@
betas = np.array([-0.024948815481502, 8.875391917212998e-05,
-9.247462376518329e-08, 1.508210856829677e-10])

# Input impulse parameters
# Input pulse parameters
power = 10000
# pulse duration [ps]
tfwhm = 0.05
# hyperbolic secant
setup.impulse_model = gnlse.SechEnvelope(power, tfwhm)
setup.pulse_model = gnlse.SechEnvelope(power, tfwhm)

# Type of dyspersion operator: build from interpolation of given neffs
# read mat file for neffs
Expand Down
4 changes: 2 additions & 2 deletions examples/test_gvd.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
power = 1 # value can be choosen arbitrarily
# Fiber length [m]
setup.fiber_length = 4 * LD
# Type of impulse: gaussian
setup.impulse_model = gnlse.GaussianEnvelope(power, tFWHM)
# Type of pulse: gaussian
setup.pulse_model = gnlse.GaussianEnvelope(power, tFWHM)
# Loss coefficient [dB/m]
loss = 0
# Type of dyspersion operator: build from Taylor expansion
Expand Down
2 changes: 1 addition & 1 deletion examples/test_import_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
setup.z_saves = 200
setup.fiber_length = 0.15 # m
setup.wavelength = 835 # nm
setup.impulse_model = gnlse.GaussianEnvelope(1, 0.1)
setup.pulse_model = gnlse.GaussianEnvelope(1, 0.1)

solver = gnlse.GNLSE(setup)
solution = solver.run()
Expand Down
2 changes: 1 addition & 1 deletion examples/test_nonlinearity.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
# pulse duration [ps]
tfwhm = 0.05
# hyperbolic secant
setup.impulse_model = gnlse.SechEnvelope(power, tfwhm)
setup.pulse_model = gnlse.SechEnvelope(power, tfwhm)

# The dispersion model is built from a Taylor expansion with coefficients
# given below.
Expand Down
4 changes: 2 additions & 2 deletions examples/test_raman.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
setup.time_window = 12.5 # ps
setup.z_saves = 400

# Input impulse parameters
# Input pulse parameters
peak_power = 10000 # W
duration = 0.050284 # ps

# Physical parameters
setup.wavelength = 835 # nm
setup.fiber_length = 0.15 # m
setup.nonlinearity = 0.11 # 1/W/m
setup.impulse_model = gnlse.SechEnvelope(peak_power, duration)
setup.pulse_model = gnlse.SechEnvelope(peak_power, duration)
setup.self_steepening = True

# The dispersion model is built from a Taylor expansion with coefficients
Expand Down
4 changes: 2 additions & 2 deletions examples/test_spm+gvd.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
power = 1 / (LNL * setup.nonlinearity)
# Fiber length [m]
setup.fiber_length = 10 * LD
# Type of impulse: gaussian
setup.impulse_model = gnlse.GaussianEnvelope(power, tFWHM)
# Type of pulse: gaussian
setup.pulse_model = gnlse.GaussianEnvelope(power, tFWHM)
# Loss coefficient [dB/m]
loss = 0
# Type of dyspersion operator: build from Taylor expansion
Expand Down
4 changes: 2 additions & 2 deletions examples/test_spm.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
LNL = 1 / (power * setup.nonlinearity)
# Fiber length [m]
setup.fiber_length = 3.5 * np.pi * LNL
# Type of impulse: gaussian
setup.impulse_model = gnlse.GaussianEnvelope(power, tFWHM)
# Type of pulse: gaussian
setup.pulse_model = gnlse.GaussianEnvelope(power, tFWHM)
# Loss coefficient [dB/m]
loss = 0
# Type of dyspersion operator: build from Taylor expansion
Expand Down
Loading

0 comments on commit ffd53af

Please sign in to comment.