Skip to content

Commit

Permalink
Merge pull request #17 from dls-controls/release
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
willrogers committed Sep 11, 2019
2 parents 82ccc20 + ab294d5 commit 25c80b3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
14 changes: 13 additions & 1 deletion atip/simulator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module containing an interface with the AT simulator."""
import logging
from warnings import warn

import at
Expand Down Expand Up @@ -126,25 +127,36 @@ def _recalculate_phys_data(self, callback):
but as a warning.
"""
while True:
logging.debug('Starting recalculation loop')
self._gather_one_sample()
while self._queue:
self._gather_one_sample()
if bool(self._paused) is False:
try:
if self._emit_calc:
logging.debug('Starting emittance calculation.')
self._at_lat.radiation_on()
self._emitdata = self._at_lat.ohmi_envelope(self._rp)
logging.debug('Completed emittance calculation')
logging.debug('Starting linear optics calculation.')
self._at_lat.radiation_off()
self._lindata = self._at_lat.linopt(0.0, self._rp, True,
coupled=False)
logging.debug('Completed linear optics calculation.')
self._radint = self._at_lat.get_radiation_integrals(
twiss=self._lindata[3]
)
logging.debug('All calculation complete.')
except Exception as e:
warn(at.AtWarning(e))
# Signal up to date before the callback is executed in case
# the callback requires data that requires the calculation
# to be up to date.
self.up_to_date.Signal()
if callback is not None:
logging.debug('Executing callback function.')
callback()
self.up_to_date.Signal()
logging.debug('Callback completed.')

def toggle_calculations(self):
"""Pause or unpause the physics calculations by setting or clearing the
Expand Down
9 changes: 6 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = atip
version = 0.0.1
version = 0.0.2
description = ATIP: Accelerator Toolbox Interface for Pytac
long-description = file: README.rst
author = Tobyn Nicholls
Expand All @@ -27,8 +27,11 @@ packages =
include_package_data = true
python_requires = >=2.7.4
install_requires =
pytac
accelerator-toolbox
# Ensure numpy and scipy are compatible with Python 2.
numpy<1.17.0
scipy<1.3.0
pytac>=0.3.0
accelerator-toolbox>=0.0.2
cothread

[coverage:run]
Expand Down
3 changes: 3 additions & 0 deletions virtac/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ verify_ssl = true
name = "pypi"

[packages]
# pyAT 0.0.2 requires numpy 1.16 due to a bug, despite claiming support
# for 1.10 and up.
numpy = ">=1.16.0,<1.17"
accelerator-toolbox = ">=0.0.2"

0 comments on commit 25c80b3

Please sign in to comment.