Mosbot
Introduction
Mosbot is a python program that tries to adjust our observing scripts to adapt to changing conditions through the night.
Run it by logging in to the mzls@mayall-idl
machine and then running:
cd ~/obsbot python mosbot.py
You will need to keep that window open, because you want Mosbot to
keep running all night. By default, Mosbot will read the "plan" or "JSON" files pass1.json
, pass2.json
, and pass3.json
files that Arjun should have given you; they contain lists of
exposures we want to take depending on what the conditions are doing.
It is probably most convenient to run Mosbot from a Terminal window on
the mayall-2 display. You don't need to read any of the output it
produces, but you should check periodically that it is still running;
the code is under development and some bugs remain.
If Mosbot crashes, please report it! If you can copy-and-paste the last page or two of log output, or at the very least note the exposure number when the crash occurred, this will make finding and fixing the problem much easier. Thanks.
Mosbot Description
Mosbot does two things:
- On startup:
- reads the
pass{1,2,3}.json
files (or filenames given on the command line) - discards exposures that are meant to be taken before the current time
- writes an "overall" script for the night,
/mosaic3/exec/mosbot/tonight.sh
, which runs mini-scripts for each exposure - writes "default" mini scripts for each exposure
- reads the
- Then:
- waits for new images to appear in the
$MOS3_DATA
directory - when a new image appears:
- measures sky, seeing, and transparency from the image
- decides which pass number to observe in the upcoming exposures (by looking for 'forcepass*' files, or based on conditions)
- computes exposure times for the upcoming exposures
- overwrites the mini scripts for these upcoming exposures
- waits for new images to appear in the
The observers run the tonight.sh
script on the mosaic3
computer.
Throughout the night, Mosbot overwrites the mini-scripts for upcoming exposures to adapt to the conditions.
How to stop and restart
If you want to stop and restart observing (e.g., to take a focus
sequence), you need to stop both the tonight.sh
script, and Mosbot:
- to stop
tonight.sh
: On themosaic3
computer where you are running thetonight.sh
script:touch ~/exec/mosbot/quit
Thetonight.sh
script checks for thatquit
file after each exposure, so it can take a while before it actually exits, but you won't lose any data this way. Thetonight.sh
script deletes thatquit
file just before it exits, so you don't need to worry about deleting it. - to stop Mosbot, just ctrl-C it.
To start up again,
- FIRST restart mosbot. It will write out a new
tonight.sh
- THEN run the new
tonight.sh
script
During the night
Use The Force
By default, Mosbot will choose which pass to do (ie, which of the three plan files to select tiles from) based on the conditions. However, this can result in long slews as it switches between passes. Therefore, observers are encouraged to *use the force* -- to tell the Mosbot which pass it should be doing.
Do this by creating a file in the directory ~/exec/mosbot
. Files are checked in this order:
~/exec/mosbot/forcepass1
-- tiles from the first JSON file (pass1.json) will be scheduled~/exec/mosbot/forcepass2
-- tiles from the second JSON file (pass2.json) will be scheduled~/exec/mosbot/forcepass3
-- tiles from the third JSON file (pass3.json) will be scheduled~/exec/mosbot/nopass1
-- tiles from the second or third JSON files will be selected, based on conditions.
These files can be created using the touch
command:
touch ~/exec/mosbot/forcepass2
and be sure to rm
the other forcepass
files!
Note that Mosbot will *delete* the forcepass?
and nopass1
files every time it is started up, so if you have to restart it, be sure to re-create the forcepass
file for your chosen pass!
Note that the ~/exec/mosbot
directory in the mzls@mayall-idl
account is a symlink to the same directory (cross-mounted) on the observer@mosaic3
account, so these instructions to touch
these files can be run from either account.
Note that it is Mosbot that pays attention to these files (not
tonight.sh
); they affect what it chooses to schedule for upcoming
exposures.
Mosbot command-line options (not usually needed)
- --rawdata=RAWDATA Directory to monitor for new images; $MOS3_DATA by default
- --script=SCRIPTFN Write top-level shell script, default is ~/exec/mosbot/tonight.sh
- --no-write-script
- --ext=EXT Extension to read for computing observing conditions, default im4
- --tiles=TILES Observation status file, default obstatus/mosaic-tiles_obstatus.fits
- --pass=PASSNUM Set default pass number (1/2/3), default 2
- --exptime=EXPTIME Set default exposure time, default is to use whatever exposure time is in the JSON files, usually 80 sec
- --no-cut-past Do not cut tiles that were supposed to be observed in the past
- -h, --help - show this list
Comments
- Mosbot by default starts with PASS 2 observations. And by default, we set all the exposure times to our minimum exposure time of 80 seconds.
- THEREFORE, if you kill mosbot after it has written out the
tonight.sh
script and run the defaulttonight.sh
script, you will observe pass 2 with short exposures all night long. This is almost certainly not what we want to happen!! - You can change the default pass number with
--pass
, and the default exposure time with--exptime
. For example, if you are restarting in the middle of the night and you know the conditions are pass 3, you might want to do this. These default exposures are what will run ONLY until the first image is taken and appears on disk. After that, Mosbot will be choosing the pass and exposure time. - The
tonight.sh
script is not smart. If you kill and re-starttonight.sh
, you will start from the beginning of the night (or the last time Mosbot was run). If you have to stop thetonight.sh
script, PLEASE re-run Mosbot to regenerate an appropriatetonight.sh
script. - The
tonight.sh
script writes to a file~/exec/mosbot/seqnum.txt
to indicate which exposure it is currently running. Themosbot.py
script reads that file to figure out which upcoming exposures it should update. Mosbot by default writes exposures 1 through 10 ahead of the current sequence number. - Each exposure is split into two scripts. For example, exposure 3
happens in
expose-3.sh
, which takes the exposure, and thenslewread-4.sh
slews to exposure number 4 while reading out exposure 3.
About git
- the
~/obsbot
directory is a git checkout of the repository: https://github.com/legacysurvey/obsbot - There is a "MzLS Observer" GitHub account set up to log in with an
ssh key, so you should be able to
git commit
andgit push
any code changes without having to know any passwords.
Pages linking to PublicPages/MayallZbandLegacy/NotesforObservers/MosBot: