Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pykat
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sean Leavey
pykat
Commits
043fa0c4
Commit
043fa0c4
authored
11 years ago
by
Daniel Brown
Browse files
Options
Downloads
Patches
Plain Diff
adding kat file loading
parent
473c52a4
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
pykat/finesse.py
+24
-6
24 additions, 6 deletions
pykat/finesse.py
with
24 additions
and
6 deletions
pykat/finesse.py
+
24
−
6
View file @
043fa0c4
...
...
@@ -58,9 +58,10 @@ class kat(object):
def
__init__
(
self
,
katexe
=
""
):
self
.
scene
=
None
# scene object for GUI
self
.
__components
=
{}
self
.
__detectors
=
{}
self
.
__commands
=
{}
self
.
__components
=
{}
# dictionary of optical components
self
.
__detectors
=
{}
# dictionary of detectors
self
.
__commands
=
{}
# dictionary of commands
self
.
__extra_lines
=
[]
# an array of strings which are just normal finesse code to include when running
self
.
__gui
=
None
self
.
nodes
=
NodeNetwork
(
self
)
self
.
__katexe
=
katexe
...
...
@@ -85,6 +86,16 @@ class kat(object):
@noxaxis.setter
def
noxaxis
(
self
,
value
):
self
.
__noxaxis
=
bool
(
value
)
def
load
(
self
,
katfile
):
"""
Loads the kat file specified which can then be run
"""
with
open
(
katfile
)
as
f
:
for
lines
in
f
.
readlines
():
self
.
__extra_lines
.
append
(
lines
)
def
run
(
self
,
printout
=
1
,
printerr
=
1
,
save_output
=
False
,
save_kat
=
False
,
kat_name
=
None
)
:
"""
Runs the current simulation setup that has been built thus far.
...
...
@@ -235,8 +246,6 @@ class kat(object):
def
generateKatScript
(
self
)
:
"""
Generates the kat file which can then be run
"""
if
len
(
self
.
__components
)
==
0
:
raise
exceptions
.
RuntimeError
(
"
No components have been added
"
)
out
=
[]
...
...
@@ -275,6 +284,15 @@ class kat(object):
if
self
.
phase
!=
None
:
out
.
append
(
"
phase {0}
\n
"
.
format
(
self
.
phase
))
if
self
.
maxtem
!=
None
:
out
.
append
(
"
maxtem {0}
\n
"
.
format
(
self
.
maxtem
))
# There maybe extra lines we want to include in the kat
# script which aren't parseable into components, detectors
# or commands. Typically when something hasn't been fully
# supported yet. So bung these extra lines on at the end
for
lines
in
self
.
__extra_lines
:
out
.
append
(
lines
)
# ensure we don't do any plotting. That should be handled
# by user themselves
out
.
append
(
"
gnuterm no
\n
"
)
out
.
append
(
"
pyterm no
\n
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment