= MosBot = 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. "pass[123].json" are the 'plan' or '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. = MosBot Options = * --rawdata=RAWDATA Directory to monitor for new images * --script=SCRIPTFN Write top-level shell script, default is /mosaic3/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 whatever 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 = MosBot Description = Mosbot does two things: - On startup, it reads the `pass[123].json` files, drops exposures that are meant to be taken before the current time, for each exposure writes two little shell scripts in `/mosaic3/exec/mosbot/`, and also writes a top-level script `/mosaic3/exec/mosbot/tonight.sh` - It then starts waiting for new images to appear in the $MOS3_DATA directory. Whenever an image appears, it analyzes it and, based on the measured conditions (seeing, sky brightness, transparency), it decides which pass we should be running, and what our exposure times should be, and it overwrites the little shell scripts in `/mosaic3/exec/mosbot/` to adjust the next few exposures. '''To Stop mosbot'''[[BR]] On the mosaic3 computer where you are running the NOCS script: {{{ touch ~/exec/mosbot/quit }}} After each exposure, the `tonight.sh` script checks for the existence of the file `/mosaic3/exec/mosbot/quit`. If that file exists, the script will quit after a readout (without slewing). This should ensure that we don't lose any data, and is the way the `tonight.sh` script should be stopped. (It will delete the `quit` file just before it quits.) '''To Restrict to Pass 2 and/or 3'''[[BR]] If you have started mosbot in all three passes (i.e., using python mosbot.py pass1.json pass2.json pass3.json as above) and now want to restrict the choice of passes because, say, the weather has worsened, ''''without terminating the tonight.sh script'''', then {{{ touch ~/exec/mosbot/nopass1 touch ~/exec/mosbot/nopass2 }}} After each exposure, the `tonight.sh` script checks for the existence of the files `/mosaic3/exec/mosbot/nopass1`, etc. If any of these files exist, the pass is dropped from the tonight.sh. == 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, you will run pass 2 with short exposures all night long. This is almost certainly not what we want to happen!! - On the other hand, if you need to run a focus sequence, restart the MOSAIC control software, or otherwise stop observing, you can just ctrl-C the mosbot.py script. HOWEVER, you should re-run the mosbot.py script to generate a new `tonight.sh` script before you re-start observing. - **The `tonight.sh` script is not smart. Each exposure is written to a script, and the scripts are numbered. If you kill and re-start `tonight.sh`, you will start from the beginning of the night (or the last time mosbot was run). If you have to stop the `tonight.sh` script, PLEASE re-run mosbot to regenerate an appropriate `tonight.sh` script.** - The `tonight.sh` script writes to a file `/mosaic3/exec/mosbot/seqnum.txt` to indicate which exposure it is currently running. The `mosbot.py` script reads that file to figure out which upcoming exposures it should update. Mosbot by default writes 1, 2, and 3 exposures 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 then `slewread-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* and *git push* any code changes without having to know any passwords.