Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • nloqo/snlo-helper
1 result
Show changes
Commits on Source (13)
Showing
with 609 additions and 0 deletions
# CHANGELOG
## [0.4.0] - 2024-6-18
### Added
* Add support for 2D-cav-LP by @NoahDornhecker in https://github.com/BenediktBurger/snlo-helper/pull/4
**Full Changelog**: https://github.com/BenediktBurger/snlo-helper/compare/v0.3.0...v0.4.0
## [0.3.0] - 2024-05-27
### Added
* Add Qmix & PW-OPO-BB support by @NoahDornhecker in https://github.com/BenediktBurger/snlo-helper/pull/3
* Add license by @BenediktBurger in https://github.com/BenediktBurger/snlo-helper/pull/2
### New Contributors
* @BenediktBurger made their first contribution in https://github.com/BenediktBurger/snlo-helper/pull/2
* @NoahDornhecker made their first contribution in https://github.com/BenediktBurger/snlo-helper/pull/3
**Full Changelog**: https://github.com/BenediktBurger/snlo-helper/compare/v0.2.0...v0.3.0
## [0.2.0] - 2024-05-07
_Completely restructured package for easier maintenance and extension._
......@@ -12,5 +33,7 @@ _Completely restructured package for easier maintenance and extension._
_Initial release_
[0.4.0]: https://github.com/BenediktBurger/snlo-helper/releases/tag/v0.4.0
[0.3.0]: https://github.com/BenediktBurger/snlo-helper/releases/tag/v0.3.0
[0.2.0]: https://github.com/BenediktBurger/snlo-helper/releases/tag/v0.2.0
[0.1.0]: https://github.com/BenediktBurger/snlo-helper/releases/tag/v0.1.0
MIT License
Copyright (c) 2024 Benedikt Burger
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
......@@ -17,8 +17,11 @@ Attention:
Currently it supports the following functions (feel free to add more):
- Ref. Ind.
- Qmix
- 2D-mix-LP
- 2D-mix-SP
- PW-OPO-BB
- 2D-cav-LP
- Focus
......@@ -44,6 +47,7 @@ from snlohelper.main_window import MainWindow
mw = MainWindow()
mix = mw.open_two_d_mix_lp()
mix.configure({"Wavelengths (nm)": [1064.5, None, None]})
mix.accept()
result = mix.run_and_read()
print(result)
```
......@@ -57,6 +61,7 @@ For more examples see the `examples` folder.
* For several functions exists a module containing a class, which in turn allows to configure the function, to run the calculation, and to extract the result.
1. You start that class, for example `mix = two_d_mix_lp.TwoDMixLp()` or `mix = MainWindow().open_function("2D-Mix-LP")`.
2. You can configure it giving a configuration dictionary (the keys correspond to the names) with `mix.configure({"Wavelengths": [1064, None, None]})`. If a value is `None`, it won't be changed.
3. Click accept with `mix.accept()`
3. You can run it with `mix.run()`
4. With `results = mix.read_results()` you can extract the resulting text.
5. With `result_dict = mix.interpret_results(results)` you get a dictionary of the result data
......
# MIT License
# Copyright (c) 2024 Benedikt Burger
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
"""
Example on how to use the SNLO data files.
"""
......
# MIT License
# Copyright (c) 2024 Benedikt Burger
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
from snlohelper.main_window import MainWindow
mw = MainWindow()
......
# MIT License
# Copyright (c) 2024 Benedikt Burger
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
"""
Example of a simulation using SNLO
......
# MIT License
# Copyright (c) 2024 Benedikt Burger
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
import time
from typing import Any, Optional, Protocol
......@@ -73,6 +95,12 @@ class BaseFunction(Protocol):
"""Interpret the results and return them as a dictionary."""
data = {}
for row in rows:
# skip empty lines
if not row:
continue
if row == 'ERROR: No phase match found.':
raise Exception('No phase match found')
text, values = row.split("=")
content = []
for element in values.split():
......
# MIT License
# Copyright (c) 2024 Benedikt Burger
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
from typing import Optional
from .base_function import BaseFunction
......
# MIT License
# Copyright (c) 2024 Benedikt Burger
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
from enum import StrEnum
from .utils import Point, gui, scale
......
# MIT License
# Copyright (c) 2024 Benedikt Burger
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
import re
import numpy as np
......
# MIT License
# Copyright (c) 2024 Benedikt Burger
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
"""
The SNLO main window
"""
......@@ -11,12 +33,18 @@ from .ref_index import RefractiveIndex
from .focus import Focus
from .two_d_mix_lp import TwoDMixLP
from .two_d_mix_sp import TwoDMixSP
from .q_mix import QMix
from .pw_opo_bb import PW_OPO_BB
from .two_d_cav_lp import TwoDCavLP
function_classes = {
Functions.REF_INDEX: RefractiveIndex,
Functions.QMIX: QMix,
Functions.TWOD_MIX_LP: TwoDMixLP,
Functions.TWOD_MIX_SP: TwoDMixSP,
Functions.PW_OPO_BB: PW_OPO_BB,
Functions.TWOD_CAV_LP: TwoDCavLP,
Functions.FOCUS: Focus,
}
......@@ -48,11 +76,20 @@ class MainWindow:
def open_refractive_index(self) -> RefractiveIndex:
return self._open_function(RefractiveIndex)
def open_q_mix(self) -> QMix:
return self._open_function(QMix)
def open_two_d_mix_lp(self) -> TwoDMixLP:
return self._open_function(TwoDMixLP)
def open_two_d_mix_sp(self) -> TwoDMixSP:
return self._open_function(TwoDMixSP)
def open_pw_opo_bb(self) -> PW_OPO_BB:
return self._open_function(PW_OPO_BB)
def open_two_d_cav_lp(self) -> TwoDCavLP:
return self._open_function(TwoDCavLP)
def open_focus(self) -> Focus:
return self._open_function(Focus)
# MIT License
# Copyright (c) 2024 Benedikt Burger
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
from typing import Any, Optional, Protocol
from .utils import Point, gui, scale
......
# MIT License
# Copyright (c) 2024 Benedikt Burger
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
from typing import Any
from collections import defaultdict
from .base_function import BaseFunction, Functions
class PW_OPO_BB(BaseFunction):
_function = Functions.PW_OPO_BB
_run_pos = (433, 475)
_result_pos = (182, 618)
_close_pos = (515, 174)
_configuration_pos = {
"Wavelengths (nm)": [(351, 219), (423, 219), (489, 219)],
"Index of refraction": [(351, 235), (423, 235), (489, 235)],
"Group velocity index": [(351, 251), (423, 251), (489, 251)],
"Crystal left reflectivity": [(351, 267), (423, 267), (489, 267)],
"Crystal right reflectivity": [(351, 283), (423, 283), (489, 283)],
"Crystal loss (per mm)": [(351, 299), (423, 299), (489, 299)],
"Enrgy/Pwr left (J/W)": [(351, 315), (423, 315), (489, 315)],
"Enrgy/Pwr right (J/W)": [(351, 331), (423, 331)],
"Pulse duration (FWHM ns)": [(351, 347), (423, 347), (489, 347)],
"Beam diam. (FWHM mm)": [(351, 363), (423, 363), (489, 363)],
"Left mirror reflectivity": [(351, 379), (423, 379), (489, 379)],
"Right mirror reflectivity": [(351, 395), (423, 395), (489, 395)],
"L mir. to Xtal phase (rad)": [(351, 411), (423, 411), (489, 411)],
"R mir. to Xtal phase (rad)": [(351, 427), (423, 427), (489, 427)],
"Cavity/Xtal length (mm)": [(351, 443), (423, 443)],
"Pump bandwidth (MHz)": [(351, 459)],
"Pump mode spacing (MHz)": [(351, 475)],
"Pump FM (1/0)": [(351, 491)],
"Deff (pm/V)": [(351, 507)],
"Cav. type (1=lin. 0=ring)": [(351, 523)],
"Delta k(1/mm)": [(351, 539)],
"# of z integration steps": [(351, 555)],
"New noise (1/0)": [(351, 571)]
}
def interpret_results(self, rows: list[str]) -> dict[str, Any]:
"""Interpret the results and return them as a dictionary."""
data = defaultdict(list) # to support duplicate rows e.g., in qmix for different phase-matching conditions
for row in rows:
# skip empty lines
if not row:
continue
if row == 'ERROR: No phase match found.':
raise Exception('No phase match found')
text, values = row.split("=")
content = []
for element in values.split():
try:
val = float(element)
except ValueError:
val = element
content.append(val)
data[text.strip()].append(content)
return data
def run_and_read(
self,
waiting_time: float = 0.1,
max_tries: int = 10,
interval: float = 0.1,
waiting_line_count: int = 3,
) -> dict[str, Any]:
return super().run_and_read(waiting_time, max_tries, interval, waiting_line_count)
# MIT License
# Copyright (c) 2024 Benedikt Burger
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
from typing import Any
from collections import defaultdict
from .base_function import BaseFunction, Functions
class QMix(BaseFunction):
_function = Functions.QMIX
_run_pos = (174, 61)
_result_pos = (160, 260)
_close_pos = (446, 20)
_configuration_pos = {
"Crystal": [(250, 76)],
"Temperature": [(360, 76)],
"Red1": [(155, 155)],
"Red2": [(209, 155)],
"Blue": [(266, 155)],
"XY": [(357, 128)],
"XZ": [(396, 128)],
"YZ": [(429, 128)],
"Mix": [(359, 168)],
"OPO": [(416, 168)]
}
def interpret_results(self, rows: list[str]) -> dict[str, Any]:
"""Interpret the results and return them as a dictionary."""
data = defaultdict(list) # to support duplicate rows e.g., in qmix for different phase-matching conditions
for row in rows:
# skip empty lines
if not row:
continue
if row == 'ERROR: No phase match found.':
raise Exception('No phase match found')
text, values = row.split("=")
content = []
for element in values.split():
try:
val = float(element)
except ValueError:
val = element
content.append(val)
data[text.strip()].append(content)
return data
def run_and_read(
self,
waiting_time: float = 0.1,
max_tries: int = 10,
interval: float = 0.1,
waiting_line_count: int = 3,
) -> dict[str, Any]:
return super().run_and_read(waiting_time, max_tries, interval, waiting_line_count)
# MIT License
# Copyright (c) 2024 Benedikt Burger
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
from typing import Any
from .base_function import BaseFunction, Functions
......
# MIT License
# Copyright (c) 2024 Benedikt Burger
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
import logging
from . import utils
......
# MIT License
# Copyright (c) 2024 Benedikt Burger
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
from .main_window import Functions
from .mix_methods import MixMethods
class TwoDCavLP(MixMethods):
"""The '2D-cav-LP' method."""
_function = Functions.TWOD_CAV_LP
_accept_pos = (480, 537)
_run_pos = (148, 275)
_result_pos = (148, 357)
_change_inputs_pos = (157, 310)
_close_pos = (480, 135)
_configuration_pos = {"Wavelengths (nm)": [(330, 151), (397, 151), (464, 151)],
"Indexes of refraction": [(330, 167), (397, 167), (464, 167)],
"Crystal left reflectivity": [(330, 183), (397, 183), (464, 183)],
"Crystal right reflectivity": [(330, 199), (397, 199), (464, 199)],
"Crystal loss (per mm)": [(330, 215), (397, 215), (464, 215)],
"Enrgy/Pwr left (J/W)": [(330, 231), (397, 231), (464, 231)],
"Enrgy/Pwr right (J/W)": [(330, 247), (397, 247)],
"Pulse duration (FWHM ns)": [(330, 263), (397, 263), (464, 263)],
"Pulse delay (ns)": [(330, 279), (397, 279)],
"Beam diameter (FWHM mm)": [(330, 295), (397, 295), (464, 295)],
"Supergaussian coefficient": [(330, 311), (397, 311), (464, 311)],
"Walk off angle (mard)": [(330, 327), (397, 327), (464, 327)],
"Beam offset (mm)": [(397, 343), (464, 343)],
"Beam radius of curv. (mm)": [(330, 359), (397, 359), (464, 359)],
"Left mirror reflectivity": [(330, 375), (397, 375), (464, 375)],
"Right mirror reflectivity": [(330, 391), (397, 391), (464, 391)],
"Phase L-C (radians)": [(330, 407), (397, 407), (464, 407)],
"Phase C-R (radians)": [(330, 423), (397, 423), (464, 423)],
"Phase R-L (radians)": [(330, 439), (397, 439), (464, 439)],
"Mirror roc L R (mm)": [(330, 463), (397, 463)],
"Dist. L-C C-R R-L (mm)": [(330, 479), (397, 479), (464, 479)],
"Grid numbers z x y": [(330, 495), (397, 495), (464, 495)],
"Crystal/grid sizes (mm)": [(330, 511), (397, 511), (464, 511)],
"Cavity type/inversion": [(330, 527), (397, 527)],
"Deff (pm/V)/delta k (1/mm)": [(330, 543), (397, 543)]}
def interpret_results(self, rows: list[str]) -> dict[str, float | list[float]]:
"""Interpret the results."""
return {
"Right input (W W -)": [float(i) for i in rows[0].split()[6:]],
"Left input (W W J)": [float(i) for i in rows[1].split()[6:]],
"Left output energy (J)": [float(i) for i in rows[2].split()[5:]],
"Right output energy (J)": [float(i) for i in rows[3].split()[5:]],
"So (W/sq cm)": float(rows[4].split()[4]),
}
# MIT License
# Copyright (c) 2024 Benedikt Burger
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
from .main_window import Functions
from .mix_methods import MixMethods
......
# MIT License
# Copyright (c) 2024 Benedikt Burger
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
from .main_window import Functions
from .mix_methods import MixMethods
......
# MIT License
# Copyright (c) 2024 Benedikt Burger
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
"""
Autoclicker setup
=================
......