docs + plot title

This commit is contained in:
Benoît Sierro
2023-03-21 11:20:36 +01:00
parent 6da66b5990
commit fd6590d819
2 changed files with 44 additions and 12 deletions

View File

@@ -1,7 +1,3 @@
# Crash course on Python installation, with a few small side tracks
# Installation # Installation
1. If not already done so, create a virtual environment to contain all the packages required. Python 3.10 is recommended. The command below will create a new environment named 'app-env' with the latest version of Python 3.10. 1. If not already done so, create a virtual environment to contain all the packages required. Python 3.10 is recommended. The command below will create a new environment named 'app-env' with the latest version of Python 3.10.
@@ -13,4 +9,38 @@ conda activate app-env
3. The prompt should now read '(app-env)' on the left. The app is not published on Github or anywhere else. The link below points to my own personnal home server (I didn't find any way of getting a direct download link You are now ready to install everything with this command: 3. The prompt should now read '(app-env)' on the left. The app is not published on Github or anywhere else. The link below points to my own personnal home server (I didn't find any way of getting a direct download link You are now ready to install everything with this command:
pip install https://bao.dedebenui.me/s/f3KgiqMq7giN73i/download pip install "git+file://<path to the git repository>"
# Usage
1. Make sure your environment is activated (step 1 above)
2. call the `dispersionapp` command
dispersionapp
2*. this can be also done via calling python first (`-m` tells python to open the specified module)
python -m dispersionapp
# Interface
On the top left, you will see a summary of the current configuration. On the right, you will find the paremter list.
from left to right :
- the name of the paramter
- a slider to quickly explore values
- arrow buttons to move from one value to the next
- a text box where you can input your desired value. The closest possible value will then be selected.
- a button to automatically "play" the parameter from its current positition to its maximum
- interval during which each parameter is displayed while playing.
To navigate the plot:
- left-click + drag to move around
- right-click + drag to zoom
- scroll wheel to zoom
- for each kind of movement, you can do it while the cursor is hovering over one of the axis. In that case, only that axis is affected.
- to go back to a view that fits everything, click on the small "A" at the bottom left.
- to hide/show a line, click on it in the legend. You can also click+drag on the legend to move it around.
- double click on the purple title bar (left side or top) to pop out the plot in its own window.

View File

@@ -19,6 +19,7 @@ def app(config_file: os.PathLike | None = None):
wl_ind = sc.math.argclosest(wl, config.wl_pump * 1e-9) wl_ind = sc.math.argclosest(wl, config.wl_pump * 1e-9)
w0 = w[wl_ind] w0 = w[wl_ind]
gas = sc.materials.Gas(config.gas) gas = sc.materials.Gas(config.gas)
with PlotApp( with PlotApp(
@@ -31,9 +32,10 @@ def app(config_file: os.PathLike | None = None):
t_fwhm_fs=np.arange(10, 201, dtype=float), t_fwhm_fs=np.arange(10, 201, dtype=float),
) as app: ) as app:
# initial setup # initial setup
app[0].horizontal_line("reference", 0, color="gray") ax = app["Dispersion plot"]
app[0].set_xlabel("wavelength (nm)") ax.horizontal_line("reference", 0, color="gray")
app[0].set_ylabel("beta2 (fs^2/cm)") ax.set_xlabel("wavelength (nm)")
ax.set_ylabel("beta2 (fs^2/cm)")
if config.current_state is not None: if config.current_state is not None:
app.params["core_diameter_um"].value = config.current_state.core_diameter_um app.params["core_diameter_um"].value = config.current_state.core_diameter_um
app.params["pressure_mbar"].value = config.current_state.pressure_mbar app.params["pressure_mbar"].value = config.current_state.pressure_mbar
@@ -48,7 +50,7 @@ def app(config_file: os.PathLike | None = None):
app.params["n_tubes"].value = 7 app.params["n_tubes"].value = 7
app.params["gap_um"].value = 5 app.params["gap_um"].value = 5
app.params["t_fwhm_fs"].value = 100 app.params["t_fwhm_fs"].value = 100
app[0].set_lim(ylim=(-4, 2)) ax.set_lim(ylim=(-4, 2))
app.update(config.update_current) app.update(config.update_current)
@@ -129,12 +131,12 @@ def app(config_file: os.PathLike | None = None):
b2 = compute_vincetti( b2 = compute_vincetti(
wall_thickness_um, core_diameter_um, pressure_mbar, n_tubes, gap_um wall_thickness_um, core_diameter_um, pressure_mbar, n_tubes, gap_um
) )
app[0].set_line_data("Vincetti", wl * 1e9, sc.units.beta2_fs_cm_inv(b2)) ax.set_line_data("Vincetti", wl * 1e9, sc.units.beta2_fs_cm_inv(b2))
@app.update @app.update
def draw_capillary(core_diameter_um: float, pressure_mbar: float): def draw_capillary(core_diameter_um: float, pressure_mbar: float):
b2 = compute_capillary(core_diameter_um, pressure_mbar) b2 = compute_capillary(core_diameter_um, pressure_mbar)
app[0].set_line_data("Capillary", wl * 1e9, sc.units.beta2_fs_cm_inv(b2)) ax.set_line_data("Capillary", wl * 1e9, sc.units.beta2_fs_cm_inv(b2))
@app.update @app.update
def draw_energy_limit(core_diameter_um: float, pressure_mbar: float, t_fwhm_fs: float): def draw_energy_limit(core_diameter_um: float, pressure_mbar: float, t_fwhm_fs: float):
@@ -151,7 +153,7 @@ def app(config_file: os.PathLike | None = None):
return return
zdw = lim.wl_zero_disp * 1e9 zdw = lim.wl_zero_disp * 1e9
app[0].set_line_data("zdw", [zdw, zdw], [-3, 3]) ax.set_line_data("zdw", [zdw, zdw], [-3, 3])
info_lines.append(f"ZDW = {zdw:.0f}nm") info_lines.append(f"ZDW = {zdw:.0f}nm")
if lim.ion_lim > lim.sf_lim: if lim.ion_lim > lim.sf_lim: