campas¶
CAMPAS (or the CAMPaign ASsistant) is a scripting library for automating repeating measurement patterns, mainly for ground-based measurements.
Example¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | from runmacs.campas.job import CampasJob, DumbCampasJob
from runmacs.campas.tools import coordinates
from runmacs.campas.meta import intent
import numpy as np
haloScanAngle = 60
haloLower = True
class HaloScan(CampasJob):
need = ('vnir', 'swir', 'mount')
def run(self):
with intent('halo'):
self.vnir.closeShutter()
self.swir.closeShutter()
self.vnir.setFPS(40).setExposureTime(5)
self.swir.setFPS(40).setExposureTime(4)
self.mount.goto(coordinates.sun + (-haloScanAngle,28)).wait()
with self.vnir.capture(), self.swir.capture():
self.vnir.openShutter()
self.swir.openShutter()
#self.mount.goto(np.array((310,coordinates.sun[1]+28)), 2.).wait()
#self.mount.goto(np.array((310,coordinates.sun[1]+0))).wait()
self.mount.goto(coordinates.sun + (haloScanAngle,28), 2.).wait()
self.mount.goto(coordinates.sun + (haloScanAngle,0)).wait()
self.mount.goto(coordinates.sun + (-haloScanAngle,0), 2.)
self.mount.waitForPass(coordinates.sun + (10,0))
self.vnir.closeShutter()
self.swir.closeShutter()
self.mount.waitForPass(coordinates.sun + (-10,0))
self.vnir.openShutter()
self.swir.openShutter()
self.mount.wait()
if haloLower:
self.mount.goto(coordinates.sun + (-haloScanAngle,-28)).wait()
self.mount.goto(coordinates.sun + (haloScanAngle,-27), 2.).wait()
|
This example shows a job which performs a scan around the sun (2 or 3 horizontal movements from top to bottom),
with the shutters closed while passing the sun.
In Line 11, the needed devices have to be given, they are further presented as attributes of self
.
As shown e.g. in line 18, the coordinates
object gives access to dynamic coordinates, in this case, the
position of the sun in the instance in which the line is executed.
Note
As CAMPAS will perform a dummy run, before the actual run of the job (which is needed to ensure
that no invalid dimensions are given), all jobs have to be terminating.
Also in stead of using time.sleep()
, self.sleep
is prefered. It will skip the sleep during the dummy run.
If you want to define a non-terminating CAMPAS job, subclass from DumbCampasJob
, which
will not perform a dummy run.
Run CAMPAS¶
CAMPAS can be started unsing:
python -m runmacs.campas.master <jobname>
Where <jobname>
is the name of the CAMPAS job as defined in runmacs/campas/master.py
.