Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ The first public release. It contains:
the generalised nonlinear Schrödinger equation (GNLSE), for the real electric field or
a complex envelope, in waveguides and in free space.
- **Waveguides.**
- Gas-filled hollow capillaries, mode-averaged or with resolved modes. Tapers,
- Gas-filled hollow capillaries, with resolved modes (the default) or mode-averaged
(`mode_average=True` on `prop_capillary` and `prop_waveguide`). Tapers,
pressure gradients and gas flow are supported, as is a coherent wall that couples
the modes.
- Antiresonant hollow-core fibres (the Vincetti model).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,50 +89,6 @@
"name": "int"
}
],
"Simulation.from_capillary": [
{
"is_class": true,
"is_explicit": false,
"module": "solprop.driver.simulation",
"module_short": "solprop.driver",
"name": "Simulation.from_capillary"
},
{
"is_class": true,
"is_explicit": false,
"module": "solprop.driver",
"module_short": "solprop.driver",
"name": "Simulation.from_capillary"
},
{
"is_class": true,
"is_explicit": false,
"module": "solprop",
"module_short": "solprop",
"name": "Simulation.from_capillary"
},
{
"is_class": true,
"is_explicit": false,
"module": "solprop._display",
"module_short": "solprop._display",
"name": "Displayed.from_capillary"
},
{
"is_class": true,
"is_explicit": false,
"module": "solprop",
"module_short": "solprop",
"name": "Displayed.from_capillary"
},
{
"is_class": false,
"is_explicit": false,
"module": "solprop.driver.Simulation",
"module_short": "solprop.driver.Simulation",
"name": "from_capillary"
}
],
"ax": [
{
"is_class": false,
Expand Down Expand Up @@ -1009,22 +965,6 @@
"name": "ndarray"
}
],
"default_spec": [
{
"is_class": false,
"is_explicit": false,
"module": "builtins",
"module_short": "builtins",
"name": "function"
},
{
"is_class": false,
"is_explicit": false,
"module": "solprop.stats",
"module_short": "solprop.stats",
"name": "default_spec"
}
],
"density": [
{
"is_class": false,
Expand Down Expand Up @@ -1535,7 +1475,7 @@
"name": "subplots"
}
],
"replace": [
"prop_capillary": [
{
"is_class": false,
"is_explicit": false,
Expand All @@ -1546,9 +1486,9 @@
{
"is_class": false,
"is_explicit": false,
"module": "dataclasses",
"module_short": "dataclasses",
"name": "replace"
"module": "solprop.driver",
"module_short": "solprop.driver",
"name": "prop_capillary"
}
],
"rin": [
Expand Down Expand Up @@ -1767,140 +1707,6 @@
"name": "ndarray"
}
],
"simulation": [
{
"is_class": false,
"is_explicit": false,
"module": "solprop.driver.simulation",
"module_short": "solprop.driver",
"name": "Simulation"
},
{
"is_class": false,
"is_explicit": false,
"module": "solprop.driver",
"module_short": "solprop.driver",
"name": "Simulation"
},
{
"is_class": false,
"is_explicit": false,
"module": "solprop",
"module_short": "solprop",
"name": "Simulation"
}
],
"simulation.run": [
{
"is_class": false,
"is_explicit": false,
"module": "solprop.driver.simulation",
"module_short": "solprop.driver",
"name": "Simulation.run"
},
{
"is_class": false,
"is_explicit": false,
"module": "solprop.driver",
"module_short": "solprop.driver",
"name": "Simulation.run"
},
{
"is_class": false,
"is_explicit": false,
"module": "solprop",
"module_short": "solprop",
"name": "Simulation.run"
},
{
"is_class": false,
"is_explicit": false,
"module": "solprop._display",
"module_short": "solprop._display",
"name": "Displayed.run"
},
{
"is_class": false,
"is_explicit": false,
"module": "solprop",
"module_short": "solprop",
"name": "Displayed.run"
}
],
"simulation.settings": [
{
"is_class": false,
"is_explicit": false,
"module": "solprop.driver.simulation",
"module_short": "solprop.driver",
"name": "Simulation.settings"
},
{
"is_class": false,
"is_explicit": false,
"module": "solprop.driver",
"module_short": "solprop.driver",
"name": "Simulation.settings"
},
{
"is_class": false,
"is_explicit": false,
"module": "solprop",
"module_short": "solprop",
"name": "Simulation.settings"
},
{
"is_class": false,
"is_explicit": false,
"module": "solprop._display",
"module_short": "solprop._display",
"name": "Displayed.settings"
},
{
"is_class": false,
"is_explicit": false,
"module": "solprop",
"module_short": "solprop",
"name": "Displayed.settings"
}
],
"simulation.translate": [
{
"is_class": false,
"is_explicit": false,
"module": "solprop.driver.simulation",
"module_short": "solprop.driver",
"name": "Simulation.translate"
},
{
"is_class": false,
"is_explicit": false,
"module": "solprop.driver",
"module_short": "solprop.driver",
"name": "Simulation.translate"
},
{
"is_class": false,
"is_explicit": false,
"module": "solprop",
"module_short": "solprop",
"name": "Simulation.translate"
},
{
"is_class": false,
"is_explicit": false,
"module": "solprop._display",
"module_short": "solprop._display",
"name": "Displayed.translate"
},
{
"is_class": false,
"is_explicit": false,
"module": "solprop",
"module_short": "solprop",
"name": "Displayed.translate"
}
],
"spectra": [
{
"is_class": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## The ensemble\nEach shot is the same run with a different realisation of the quantum shot noise:\none photon per active spectral bin, with a random phase, added to the input spectrum\n(``noise=\"input\"``), drawn from the generator seeded by ``seed``.\nClearing the transverse quadrature selects mode averaging. Merely setting\n``modes=1`` would retain a resolved single-mode calculation. The assertions check\nboth the translated problem and the saved metadata so the approximation is\nrecorded with the result.\n\n"
"## The ensemble\nEach shot is the same run with a different realisation of the quantum shot noise:\none photon per active spectral bin, with a random phase, added to the input spectrum\n(``noise=\"input\"``), drawn from the generator seeded by ``seed``.\n``mode_average=True`` selects mode averaging; ``modes=1`` alone, the default, would\nretain a resolved single-mode calculation. The assertions check the saved metadata\nso the approximation is recorded with the result.\n\n"
]
},
{
Expand All @@ -22,7 +22,7 @@
},
"outputs": [],
"source": [
"import time\nimport warnings\nfrom dataclasses import replace\n\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nfrom solprop.constants import C\nfrom solprop.driver import Simulation\nfrom solprop.exceptions import MaterialRangeWarning\nfrom solprop.processing import g12_of, get_spectral_density\nfrom solprop.stats import default_spec\n\nSHOTS = 8\n\"\"\"The size of the ensemble.\"\"\"\n\nstarted = time.perf_counter()\nruns = []\nwith warnings.catch_warnings():\n warnings.simplefilter(\"ignore\", MaterialRangeWarning)\n for seed in range(SHOTS):\n simulation = Simulation.from_capillary(\n 16e-6,\n 0.4,\n \"Ar\",\n 40.0,\n lambda0=1030e-9,\n fwhm=400e-15,\n energy=5e-6,\n loss=False,\n plasma=True,\n raman=False,\n trange=4e-12,\n wavelength_limits=(170e-9, 4e-6),\n noise=\"input\",\n seed=seed,\n n_save=101,\n )\n simulation.settings = replace(\n simulation.settings,\n quadrature=None,\n components=None,\n stats=default_spec(\"mode_averaged\"),\n )\n assert simulation.translate().flags.mode_averaged\n run = simulation.run(progress=\"none\")\n assert run.metadata.simulation_kind == \"mode_averaged\"\n assert run.metadata.quadrature is None\n runs.append(run)\n print(f\"seed {seed}: {run.metadata.simulation_kind}, z = {run['z'][-1]:.2f} m\")"
"import time\nimport warnings\n\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nfrom solprop.constants import C\nfrom solprop.driver import prop_capillary\nfrom solprop.exceptions import MaterialRangeWarning\nfrom solprop.processing import g12_of, get_spectral_density\n\nSHOTS = 8\n\"\"\"The size of the ensemble.\"\"\"\n\nstarted = time.perf_counter()\nruns = []\nwith warnings.catch_warnings():\n warnings.simplefilter(\"ignore\", MaterialRangeWarning)\n for seed in range(SHOTS):\n run = prop_capillary(\n 16e-6,\n 0.4,\n \"Ar\",\n 40.0,\n lambda0=1030e-9,\n fwhm=400e-15,\n energy=5e-6,\n loss=False,\n plasma=True,\n raman=False,\n trange=4e-12,\n wavelength_limits=(170e-9, 4e-6),\n noise=\"input\",\n seed=seed,\n n_save=101,\n mode_average=True,\n progress=\"none\",\n )\n assert run.metadata.simulation_kind == \"mode_averaged\"\n assert run.metadata.quadrature is None\n runs.append(run)\n print(f\"seed {seed}: {run.metadata.simulation_kind}, z = {run['z'][-1]:.2f} m\")"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,20 @@
# Each shot is the same run with a different realisation of the quantum shot noise:
# one photon per active spectral bin, with a random phase, added to the input spectrum
# (``noise="input"``), drawn from the generator seeded by ``seed``.
# Clearing the transverse quadrature selects mode averaging. Merely setting
# ``modes=1`` would retain a resolved single-mode calculation. The assertions check
# both the translated problem and the saved metadata so the approximation is
# recorded with the result.
# ``mode_average=True`` selects mode averaging; ``modes=1`` alone, the default, would
# retain a resolved single-mode calculation. The assertions check the saved metadata
# so the approximation is recorded with the result.

import time
import warnings
from dataclasses import replace

import matplotlib.pyplot as plt
import numpy as np

from solprop.constants import C
from solprop.driver import Simulation
from solprop.driver import prop_capillary
from solprop.exceptions import MaterialRangeWarning
from solprop.processing import g12_of, get_spectral_density
from solprop.stats import default_spec

SHOTS = 8
"""The size of the ensemble."""
Expand All @@ -79,7 +76,7 @@
with warnings.catch_warnings():
warnings.simplefilter("ignore", MaterialRangeWarning)
for seed in range(SHOTS):
simulation = Simulation.from_capillary(
run = prop_capillary(
16e-6,
0.4,
"Ar",
Expand All @@ -95,15 +92,9 @@
noise="input",
seed=seed,
n_save=101,
mode_average=True,
progress="none",
)
simulation.settings = replace(
simulation.settings,
quadrature=None,
components=None,
stats=default_spec("mode_averaged"),
)
assert simulation.translate().flags.mode_averaged
run = simulation.run(progress="none")
assert run.metadata.simulation_kind == "mode_averaged"
assert run.metadata.quadrature is None
runs.append(run)
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
814fb0daa5794e3950a30c26755b6a26
4bfd22e913423f4b067115cb97c2aca8
Loading
Loading