Skip to content

Pytao crashes when bmad lattice throws an error #84

@vhranjbar

Description

@vhranjbar

When I set a quad strength to a bad setting Pytao crashes:
python test2.py
Traceback (most recent call last):
File "/Users/vahidranjbar/Develop/RCS/RCS_2/RCS_DougH/May2024Lat/test2.py", line 17, in
error = tao.cmd("set element QF0 K1=.6")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/vahidranjbar/miniconda3/lib/python3.11/site-packages/pytao/tao_ctypes/core.py", line 146, in cmd
raise RuntimeError(f"Command: {cmd} causes error: {err}")
RuntimeError: Command: set element QF0 K1=.6 causes error: ERROR detected: [ERROR | 2024-JUL-05 21:19:25] closed_orbit_calc:
PARTICLE LOST IN TRACKING!!
ABORTING CLOSED ORBIT SEARCH.
TRACKING BRANCH: 0:RING

This is the python script:

from pytao import Tao
import numpy
import sys
import time
import math
import subprocess
import os

from subprocess import Popen, PIPE

load_lattice ='-lat rcsl4s1-wig_henry.bmad -noplot'
tao=Tao(load_lattice)
#names = tao.ele_gen_attribs('k1')
#print(names[0:105])

#gammaT =float(names[42].split()[1]))
error = tao.cmd("set element QF0 K1=.6")
names = tao.cmd("show universe")
print(error)
print(names)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions