{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Basic Image Capture Sequence" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Setup Nightly Hardware Connections\n", "Run once per night or when restarted\n", "Manual flats should be taken at the start of the night and saved in D:\\scratch\\Manual Operation\\Flats" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from pyscope.observatory import Observatory\n", "from pyscope.telrun import mk_mosaic_schedule, schedtel\n", "from astropy import coordinates as coord\n", "import logging\n", "import time\n", "import numpy as np\n", "import pathlib\n", "import time\n", "from IPython.display import display, clear_output\n", "import requests\n", "import shutil\n", "\n", "# Set up logging\n", "logging.basicConfig(level=logging.DEBUG)\n", "\n", "# Set up after cell logging at debug level\n", "logger = logging.getLogger('pyscope')\n", "logger.setLevel(logging.DEBUG)" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "logger.setLevel(logging.INFO)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Connect all Hardware" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "INFO:pyscope.observatory.observatory:Using config file to initialize observatory: D:/RLMT/config/observatory.cfg\n", "INFO:pyscope.observatory.observatory:Using MaxIm DL as the camera driver\n", "INFO:pyscope.observatory.observatory:Using MaxIm DL as the filter wheel driver\n", "INFO:pyscope.observatory.observatory:Using MaxIm DL as the WCS driver\n", "INFO:pyscope.observatory.observatory:CCD Temp Set to -65.63\n", "INFO:pyscope.observatory.observatory:Checking passed kwargs and overriding config file values\n", "INFO:pyscope.observatory.observatory:CCD Temp Set to -65.63\n", "INFO:pyscope.observatory.observatory:Camera connected\n", "INFO:pyscope.observatory.observatory:Turning cooler on\n", "INFO:pyscope.observatory.observatory:Filter wheel connected\n", "INFO:pyscope.observatory.observatory:Focuser connected\n", "INFO:pyscope.observatory.observatory:Observing conditions connected\n", "INFO:pyscope.observatory.observatory:Telescope connected\n", "INFO:pyscope.observatory.observatory:Unparking telescope...\n", "INFO:pyscope.observatory.observatory:Telescope unparked\n" ] }, { "data": { "text/plain": [ "True" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "rlmt = Observatory(config_path=\"D:/RLMT/config/observatory.cfg\")\n", "rlmt.connect_all()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Setup Message for Focuser Failure Page" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "url = \"https://events.pagerduty.com/v2/enqueue\"\n", "headers = {\n", " \"Content-Type\": \"application/json\",\n", " \"Accept\": \"application/json\"\n", "}\n", "payload = {\n", " \"payload\": {\n", " \"summary\": \"PWI4 Focuser Failure\",\n", " \"severity\": \"critical\",\n", " \"source\": \"TCC1.PWI4\",\n", " \"component\": \"Series 5 Focuser\",\n", " \"custom_details\": {\n", " \"Current target\": \"Default\",\n", " \"focuser position\": \"Default\",\n", " \"focsuer go to\": \"Default\"\n", " }\n", " },\n", " \"routing_key\": \"3a8f2c64ae7a4808d02a9b26f3dc8684\",\n", " \"event_action\": \"trigger\",\n", " \"client\": \"MACRO Consortium\",\n", " }" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Setup filter positions" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "# define filter positions\n", "filter_positions = {\n", " \"lrg\": 0,\n", " \"hrg\": 4,\n", " \"g\": 2,\n", " \"r\": 3,\n", " \"i\": 5,\n", " \"ha\": 10,\n", " \"oiii\": 7,\n", " \"sii\": 9,\n", " \"z\": 6,\n", " \"u\": 1,\n", " \"y\": 8,\n", " \"lum\": 11,\n", " \"red\": 12,\n", " \"green\": 13,\n", " \"blue\": 14\n", "}" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Setup AutoFocus Intervals" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "# set autofocus interval\n", "last_autofocus_time = 0\n", "autofocus_interval = 60; # minutes" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Setup Image Directory and Define Image Capture\n", "Change save directory name\n", "Format as follows\n", "d:\\scratch\\Manual Operation\\[OPERATOR]_[YYYY-MM-DD]\\[CLASS]" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [], "source": [ "save_dir = r\"d:\\scratch\\Manual Operation\\AASPrep\\Grism_2024-05-09\" # Set the directory to save images to\n", "# Make the save directory if it doesn't exist\n", "pathlib.Path(save_dir).mkdir(parents=True, exist_ok=True)" ] }, { "cell_type": "code", "execution_count": 34, "metadata": {}, "outputs": [], "source": [ "def capture_image_seq(filter_name, object_name, exp_time=5, filename_prefix=\"focus\", binning=1):\n", " # # Set binning\n", " rlmt.camera.BinX = binning\n", " rlmt.camera.BinY = binning\n", "\n", " # # Start exposure\n", " print(f\"Starting {float(exp_time)}s exposure in {filter_name}...\")\n", " rlmt.camera.StartExposure(float(exp_time), True)\n", " \n", " # Set up image base filename\n", " exp_time_str = str(exp_time).replace(\".\", \"p\")\n", " filename_base = f\"{filename_prefix}_{object_name}_{exp_time_str}s_{filter_name}\"\n", " # Remove spaces from filename\n", " filename_base = filename_base.replace(\" \", \"_\")\n", " # Check if file exists in save_dir\n", " i = 0\n", " filename = pathlib.Path(save_dir) / f\"{filename_base}_{i}.fts\"\n", " # print(f\"Checking if {filename} exists...\")\n", " # print(f\"filename.exists() is {filename.exists()}\")\n", " while filename.exists():\n", " # If file exists, add a number to the end of the filename\n", " i += 1\n", " # print(f\"{filename} does exist\")\n", " filename = pathlib.Path(save_dir) / f\"{filename_base}_{i}.fts\"\n", " # print(f\"Checking if {filename} exists...\")\n", "\n", " # Save latest image\n", " while not rlmt.camera.ImageReady:\n", " time.sleep(0.1)\n", " time.sleep(0.1)\n", " rlmt.save_last_image(filename, \"Light\", overwrite=True)\n", " clear_output()\n", " print(f\"Saved {filename}\")\n", "\n", " return filename" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [], "source": [ "def recenter_on_current_object(src, exptime, filter='g'):\n", " # Get current object\n", " current_object = rlmt.get_current_object()\n", " print(f\"Recentering on {current_object}\")\n", "\n", " # Print alt az of source\n", " src_altaz = rlmt.get_object_altaz(src)\n", " print(f\"Elevation: {src_altaz.alt.deg:.2f}, Azimuth: {src_altaz.az.deg:.2f}\")\n", " print(f\"Elevation dms: {src_altaz.alt.dms}, \\nAzimuth dms: {src_altaz.az.dms}\")\n", " if src_altaz.alt.deg < 30:\n", " rlmt.telescope.Tracking = True\n", " raise Exception(\"Source is too low to observe.\")\n", " elif src_altaz.alt.deg < 35:\n", " # 31 for red text, 47 for white background\n", " print(\"\\033[1;31;47mWARNING: Source is low in the sky. Be cautious of seeing conditions.\\033[m\")\n", " \n", " # Set to specified filter\n", " rlmt.filter_wheel.Position = filter_positions[filter]\n", " time.sleep(1)\n", " while rlmt.focuser.IsMoving:\n", " time.sleep(0.5)\n", "\n", " recenter_success = rlmt.recenter(src, \n", " target_x_pixel=1024, # TODO: make default center of sensor in each axis\n", " target_y_pixel=1024,\n", " exposure=exptime, \n", " save_images=True,\n", " save_path=\"./recenter_images/\",\n", " settle_time=3,\n", " readout=2,\n", " do_initial_slew=False,\n", " )\n", "\n", " clear_output()\n", "\n", " src_altaz = rlmt.get_object_altaz(src)\n", " print(f\"Elevation: {src_altaz.alt.deg:.2f}, Azimuth: {src_altaz.az.deg:.2f}\")\n", " print(f\"Elevation dms: {src_altaz.alt.dms}, \\nAzimuth dms: {src_altaz.az.dms}\")\n", " if src_altaz.alt.deg < 30:\n", " rlmt.telescope.Tracking = True\n", " raise Exception(\"Source is too low to observe.\")\n", " elif src_altaz.alt.deg < 35:\n", " # 31 for red text, 47 for white background\n", " print(\"\\033[1;31;47mWARNING: Source is low in the sky. Be cautious of seeing conditions.\\033[m\")\n", "\n", " # Recenter success message\n", " print(f\"Recentering success: {recenter_success}\")" ] }, { "cell_type": "code", "execution_count": 29, "metadata": {}, "outputs": [], "source": [ "def check_and_run_autofocus(autofocus_interval=60):\n", "\n", " global last_autofocus_time\n", " # Start autofocus if it has been more than 30 minutes since last autofocus\n", " if time.time() - last_autofocus_time > autofocus_interval*60:\n", " # Set to g filter\n", " rlmt.filter_wheel.Position = 3\n", " time.sleep(3)\n", " print(\"Starting autofocus...\")\n", " while rlmt.focuser.IsMoving:\n", " time.sleep(0.5)\n", "\n", " # Ensure tracking is started\n", " rlmt.telescope.Tracking = True\n", " \n", " rlmt.run_autofocus()\n", " last_autofocus_time = time.time()\n", " print(f\"Ran Autofocus at {last_autofocus_time}\")\n", " else:\n", " print(f\"Last autofocus was at {last_autofocus_time}. Not running autofocus.\")\n", " #if focuser is disabled break\n", " if rlmt.focuser.Enabled == False:\n", " response = requests.post(url, json=payload, headers=headers)\n", " print(response.json())\n", " print(\"Focuser is disabled. Imaging Stopped.\")\n", " return False\n", " else:\n", " return True" ] }, { "cell_type": "code", "execution_count": 45, "metadata": {}, "outputs": [], "source": [ "def setup_image_capture(object_name, src, exptime=3, filter='g'):\n", " # Turn tracking on\n", " rlmt.telescope.Tracking = True\n", "\n", " # Set to specified filter\n", " rlmt.filter_wheel.Position = filter_positions[filter]\n", " time.sleep(1)\n", " while rlmt.focuser.IsMoving:\n", " time.sleep(0.5)\n", "\n", " # Print alt az of source\n", " src_altaz = rlmt.get_object_altaz(src)\n", " print(f\"Elevation: {src_altaz.alt.deg:.2f}, Azimuth: {src_altaz.az.deg:.2f}\")\n", " print(f\"Elevation dms: {src_altaz.alt.dms}, \\nAzimuth dms: {src_altaz.az.dms}\")\n", " if src_altaz.alt.deg < 30:\n", " rlmt.telescope.Tracking = True\n", " raise Exception(\"Source is too low to observe.\")\n", " elif src_altaz.alt.deg < 35:\n", " # 31 for red text, 47 for white background\n", " print(\"\\033[1;31;47mWARNING: Source is low in the sky. Be cautious of seeing conditions.\\033[m\")\n", "\n", " # Set to specified filter\n", " rlmt.filter_wheel.Position = filter_positions[filter]\n", " time.sleep(1)\n", " while rlmt.focuser.IsMoving:\n", " time.sleep(0.5)\n", " \n", " # Start autofocus if it has been more than autofocus_interval minutes since last autofocus\n", " autofocus_success = check_and_run_autofocus()\n", "\n", " clear_output()\n", "\n", " print(f\"Autofocus success: {autofocus_success}\")\n", "\n", " # Run recentering algorithm\n", " if src_altaz.alt.deg < 30:\n", " rlmt.telescope.Tracking = True\n", " raise Exception(\"Source is too low to observe.\")\n", " recenter_success = rlmt.recenter(src, \n", " target_x_pixel=1024, # TODO: make default center of sensor in each axis\n", " target_y_pixel=1024,\n", " exposure=exptime, \n", " save_images=True,\n", " save_path=\"./recenter_images/\",\n", " readout=2,\n", " )\n", "\n", " print(f\"Recentering success: {recenter_success}\")\n", "\n", " src_altaz = rlmt.get_object_altaz(src)\n", " if src_altaz.alt.deg < 35:\n", " # 31 for red text, 47 for white background\n", " print(\"\\033[1;31;47mWARNING: Source is low in the sky. Be cautious of seeing conditions.\\033[m\")\n", "\n", " if rlmt.focuser.Enabled == False:\n", " response = requests.post(url, json=payload, headers=headers)\n", " print(response.json())\n", " print(\"Focuser is disabled. Do Not Image.\")\n", " else:\n", " print(\"Ready for imaging\")" ] }, { "cell_type": "code", "execution_count": 51, "metadata": {}, "outputs": [], "source": [ "def run_image_capture(object_name, src, imgs_per_cycle=5, num_cycles=1, file_prefix=\"test\", hrg_exptime=120, r_exptime=120, lrg_exptime=60):\n", " for i in range(num_cycles):\n", " src_altaz = rlmt.get_object_altaz(src)\n", " if src_altaz.alt.deg < 30:\n", " # Stop tracking\n", " rlmt.telescope.Tracking = False\n", " print(\"Source is too low to observe.\")\n", " break\n", " if not check_and_run_autofocus(autofocus_interval=autofocus_interval):\n", " break\n", " \n", " for i in range(imgs_per_cycle):\n", " filter_name = \"hrg\"\n", " rlmt.filter_wheel.Position = filter_positions[filter_name]\n", " exp_time = 120 # in seconds\n", " capture_image_seq(filter_name, object_name, exp_time=hrg_exptime, filename_prefix=file_prefix)\n", "\n", " for i in range(imgs_per_cycle):\n", " filter_name = \"r\"\n", " rlmt.filter_wheel.Position = filter_positions[filter_name]\n", " exp_time = 120 # in seconds\n", " capture_image_seq(filter_name, object_name, exp_time=r_exptime, filename_prefix=file_prefix)\n", "\n", " for i in range(imgs_per_cycle):\n", " filter_name = \"lrg\"\n", " rlmt.filter_wheel.Position = filter_positions[filter_name]\n", " exp_time = 60 # in seconds\n", " capture_image_seq(filter_name, object_name, exp_time=lrg_exptime, filename_prefix=file_prefix)\n", "\n", "def run_image_capture_single_filter(object_name, src, num_images=5, filter='g', exptime=120, file_prefix=\"test\"):\n", " src_altaz = rlmt.get_object_altaz(src)\n", " if src_altaz.alt.deg < 30:\n", " # Stop tracking\n", " rlmt.telescope.Tracking = False\n", " print(\"Source is too low to observe.\")\n", " return\n", " if not check_and_run_autofocus(autofocus_interval=autofocus_interval):\n", " return\n", "\n", " for i in range(num_images):\n", " filter_name = filter\n", " rlmt.filter_wheel.Position = filter_positions[filter_name]\n", " time.sleep(1)\n", " while rlmt.focuser.IsMoving:\n", " time.sleep(0.5)\n", " if rlmt.focuser.Enabled == False:\n", " # response = requests.post(url, json=payload, headers=headers)\n", " # print(response.json())\n", " print(\"Focuser is disabled. Imaging Stopped.\")\n", " return\n", " exp_time = exptime # in seconds\n", " capture_image_seq(filter_name, object_name, exp_time=exp_time, filename_prefix=file_prefix)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Setup Image Capture" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# If desired to check autofocus on its own\n", "# check_and_run_autofocus(autofocus_interval=autofocus_interval)\n", "# ra 11h55m26.584s dec -16d52m06.34s exposure 60 filter i,g,r nexp 5 comment \"SNIa\" readout 2\n", "file_prefix = \"xwg_supernovae\"\n", "object_name = \"SN2024hze\"\n", "src = coord.SkyCoord(\"17h22m44.261s\", \"+60d36m45.07s\", frame='icrs')\n", "\n", "print(f\"RA: {src.ra.hms},\\nDec: {src.dec.dms}\")\n", "src_altaz = rlmt.get_object_altaz(src)\n", "print(f\"Elevation: {src_altaz.alt.deg:.2f}, Azimuth: {src_altaz.az.deg:.2f}\")\n", "print(f\"Elevation dms: {src_altaz.alt.dms}, \\nAzimuth dms: {src_altaz.az.dms}\")\n", "print(src)\n", "\n", "setup_image_capture(object_name, src)" ] }, { "cell_type": "code", "execution_count": 93, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "INFO:pyscope.observatory.observatory:Recentering called with , None, None, ('hr', 'deg'), icrs, 1024, 1024, 0, check and refine: True, 5, tol: 3, 3, 2, True, ./recenter_images/, False, 5, True\n", "INFO:pyscope.observatory.observatory:Attempting to put 17h07m08.2073208s -01d05m34.789632s on pixel (1024.00, 1024.00)\n", "INFO:pyscope.observatory.observatory:Attempt 1 of 5\n", "INFO:pyscope.observatory.observatory:Slewing to RA hms_tuple(h=17.0, m=7.0, s=8.207320800018465) and Dec dms_tuple(d=-1.0, m=-5.0, s=-34.789631999999756)\n", "INFO:pyscope.observatory.observatory:Turning on sidereal tracking...\n", "INFO:pyscope.observatory.observatory:Sidereal tracking is on.\n", "INFO:pyscope.observatory.observatory:Attempting to slew to coordinates...\n", "INFO:pyscope.observatory.observatory:Slewing to RA 17.14016 and Dec -1.12725\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Autofocus success: True\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "INFO:pyscope.observatory.observatory:Settling for 3.00 seconds...\n", "INFO:pyscope.observatory.observatory:Settling for 3.00 seconds\n", "INFO:pyscope.observatory.observatory:Taking 3.00 second exposure\n", "INFO:pyscope.observatory.observatory:Exposure complete\n", "INFO:pyscope.observatory.observatory:Using Maxim to save image\n", "INFO:pyscope.observatory.observatory:Overwrite allowed for header keys ['AIRMASS', 'OBJECT', 'TELESCOP', 'INSTRUME', 'OBSERVER']\n", "INFO:pyscope.observatory.observatory:Getting header from MaxIm image\n", "WARNING: NonRotationTransformationWarning: transforming other coordinates from to . Angular separation can depend on the direction of the transformation. [astropy.coordinates.baseframe]\n", "WARNING:astroquery:NonRotationTransformationWarning: transforming other coordinates from to . Angular separation can depend on the direction of the transformation.\n", "INFO:pyscope.observatory.observatory:Searching for a WCS solution...\n", "INFO:pyscope.observatory.observatory:Saving the centering image to ./recenter_images/\n", "INFO:pyscope.observatory.observatory:Using Maxim to save image\n", "INFO:pyscope.observatory.observatory:Overwrite allowed for header keys ['AIRMASS', 'OBJECT', 'TELESCOP', 'INSTRUME', 'OBSERVER']\n", "INFO:pyscope.observatory.observatory:Getting header from MaxIm image\n", "WARNING: NonRotationTransformationWarning: transforming other coordinates from to . Angular separation can depend on the direction of the transformation. [astropy.coordinates.baseframe]\n", "WARNING:astroquery:NonRotationTransformationWarning: transforming other coordinates from to . Angular separation can depend on the direction of the transformation.\n", "INFO:pyscope.observatory.observatory:Using Maxim to save image\n", "INFO:pyscope.observatory.observatory:Overwrite allowed for header keys ['AIRMASS', 'OBJECT', 'TELESCOP', 'INSTRUME', 'OBSERVER']\n", "INFO:pyscope.observatory.observatory:Getting header from MaxIm image\n", "WARNING: NonRotationTransformationWarning: transforming other coordinates from to . Angular separation can depend on the direction of the transformation. [astropy.coordinates.baseframe]\n", "WARNING:astroquery:NonRotationTransformationWarning: transforming other coordinates from to . Angular separation can depend on the direction of the transformation.\n", "INFO:pyscope.observatory.observatory:WCS solution found, solving for the pixel location of the target\n", "WARNING: FITSFixedWarning: RADECSYS= 'FK5 ' / Equatorial coordinate system \n", "the RADECSYS keyword is deprecated, use RADESYSa. [astropy.wcs.wcs]\n", "WARNING:astroquery:FITSFixedWarning: RADECSYS= 'FK5 ' / Equatorial coordinate system \n", "the RADECSYS keyword is deprecated, use RADESYSa.\n", "WARNING: FITSFixedWarning: 'datfix' made the change 'Set MJD-OBS to 60440.373185 from DATE-OBS'. [astropy.wcs.wcs]\n", "WARNING:astroquery:FITSFixedWarning: 'datfix' made the change 'Set MJD-OBS to 60440.373185 from DATE-OBS'.\n", "INFO:pyscope.observatory.observatory:Error in RA is -39.90 arcseconds\n", "INFO:pyscope.observatory.observatory:Error in Dec is -2.30 arcseconds\n", "INFO:pyscope.observatory.observatory:Error in x pixels is 49.10\n", "INFO:pyscope.observatory.observatory:Error in y pixels is 4.59\n", "INFO:pyscope.observatory.observatory:Offsetting next slew coordinates\n", "INFO:pyscope.observatory.observatory:\n", "INFO:pyscope.observatory.observatory:Attempt 2 of 5\n", "INFO:pyscope.observatory.observatory:Slewing to RA hms_tuple(h=17.0, m=7.0, s=5.547023952208292) and Dec dms_tuple(d=-1.0, m=-5.0, s=-37.08978187750365)\n", "INFO:pyscope.observatory.observatory:Turning on sidereal tracking...\n", "INFO:pyscope.observatory.observatory:Sidereal tracking is on.\n", "INFO:pyscope.observatory.observatory:Attempting to slew to coordinates...\n", "INFO:pyscope.observatory.observatory:Slewing to RA 17.13943 and Dec -1.12792\n", "INFO:pyscope.observatory.observatory:Settling for 3.00 seconds...\n", "INFO:pyscope.observatory.observatory:Settling for 3.00 seconds\n", "INFO:pyscope.observatory.observatory:Taking 3.00 second exposure\n", "INFO:pyscope.observatory.observatory:Exposure complete\n", "INFO:pyscope.observatory.observatory:Using Maxim to save image\n", "INFO:pyscope.observatory.observatory:Overwrite allowed for header keys ['AIRMASS', 'OBJECT', 'TELESCOP', 'INSTRUME', 'OBSERVER']\n", "INFO:pyscope.observatory.observatory:Getting header from MaxIm image\n", "WARNING: NonRotationTransformationWarning: transforming other coordinates from to . Angular separation can depend on the direction of the transformation. [astropy.coordinates.baseframe]\n", "WARNING:astroquery:NonRotationTransformationWarning: transforming other coordinates from to . Angular separation can depend on the direction of the transformation.\n", "INFO:pyscope.observatory.observatory:Searching for a WCS solution...\n", "INFO:pyscope.observatory.observatory:Saving the centering image to ./recenter_images/\n", "INFO:pyscope.observatory.observatory:Using Maxim to save image\n", "INFO:pyscope.observatory.observatory:Overwrite allowed for header keys ['AIRMASS', 'OBJECT', 'TELESCOP', 'INSTRUME', 'OBSERVER']\n", "INFO:pyscope.observatory.observatory:Getting header from MaxIm image\n", "WARNING: NonRotationTransformationWarning: transforming other coordinates from to . Angular separation can depend on the direction of the transformation. [astropy.coordinates.baseframe]\n", "WARNING:astroquery:NonRotationTransformationWarning: transforming other coordinates from to . Angular separation can depend on the direction of the transformation.\n", "INFO:pyscope.observatory.observatory:Using Maxim to save image\n", "INFO:pyscope.observatory.observatory:Overwrite allowed for header keys ['AIRMASS', 'OBJECT', 'TELESCOP', 'INSTRUME', 'OBSERVER']\n", "INFO:pyscope.observatory.observatory:Getting header from MaxIm image\n", "WARNING: NonRotationTransformationWarning: transforming other coordinates from to . Angular separation can depend on the direction of the transformation. [astropy.coordinates.baseframe]\n", "WARNING:astroquery:NonRotationTransformationWarning: transforming other coordinates from to . Angular separation can depend on the direction of the transformation.\n", "INFO:pyscope.observatory.observatory:WCS solution found, solving for the pixel location of the target\n", "WARNING: FITSFixedWarning: 'datfix' made the change 'Set MJD-OBS to 60440.373462 from DATE-OBS'. [astropy.wcs.wcs]\n", "WARNING:astroquery:FITSFixedWarning: 'datfix' made the change 'Set MJD-OBS to 60440.373462 from DATE-OBS'.\n", "INFO:pyscope.observatory.observatory:Error in RA is -0.11 arcseconds\n", "INFO:pyscope.observatory.observatory:Error in Dec is -0.24 arcseconds\n", "INFO:pyscope.observatory.observatory:Error in x pixels is 0.10\n", "INFO:pyscope.observatory.observatory:Error in y pixels is 0.28\n", "INFO:pyscope.observatory.observatory:Target is now in position after 2 attempts\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Recentering success: True\n", "Ready for imaging\n" ] } ], "source": [ "file_prefix = \"grismCalibration\"\n", "object_name = \"BD-00 3227\" # Change name here\n", "# src = coord.SkyCoord(ra=\"11h05m39.77s\", dec=\"+25d06m28.746s\", frame='icrs') # Use if name not found\n", "src = coord.SkyCoord.from_name(object_name)\n", "print(f\"RA: {src.ra.hms},\\nDec: {src.dec.dms}\")\n", "src_altaz = rlmt.get_object_altaz(src)\n", "print(f\"Elevation: {src_altaz.alt.deg:.2f}, Azimuth: {src_altaz.az.deg:.2f}\")\n", "print(f\"Elevation dms: {src_altaz.alt.dms}, \\nAzimuth dms: {src_altaz.az.dms}\")\n", "print(src)\n", "\n", "setup_image_capture(object_name, src)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Run Image Capture" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", " \"LowRes\": 0,\n", " \"HighRes\": 4,\n", " \"g\": 2,\n", " \"r\": 3,\n", " \"i\": 5,\n", " \"ha\": 10,\n", " \"oiii\": 7,\n", " \"sii\": 9,\n", " \"z\": 6,\n", " \"u\": 1,\n", " \"y\": 8,\n", " \"Lum\": 11,\n", " \"Red\": 12,\n", " \"Green\": 13,\n", " \"Blue\": 14" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Adjust number of images, filters and exposures" ] }, { "cell_type": "code", "execution_count": 84, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Saved d:\\scratch\\Manual Operation\\AASPrep\\Grism_2024-05-09\\xwg_supernovae_SN2024gml_90s_i_0.fts\n" ] } ], "source": [ "#Will's images\n", "\n", "r_exptime = 90\n", "g_exptime = 90\n", "i_exptime = 90\n", "\n", "num_images = 1\n", "\n", "run_image_capture_single_filter(object_name, src, num_images=num_images, filter='g', exptime=g_exptime, file_prefix=file_prefix)\n", "\n", "run_image_capture_single_filter(object_name, src, num_images=num_images, filter='r', exptime=r_exptime, file_prefix=file_prefix)\n", "\n", "run_image_capture_single_filter(object_name, src, num_images=num_images, filter='i', exptime=i_exptime, file_prefix=file_prefix)" ] }, { "cell_type": "code", "execution_count": 94, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Saved d:\\scratch\\Manual Operation\\AASPrep\\Grism_2024-05-09\\grismCalibration_BD-00_3227_90s_lrg_2.fts\n" ] } ], "source": [ "lrg_exptime = 90\n", "hrg_exptime = 180\n", "r_exptime = 5\n", "\n", "num_images = 3 # Images per filter\n", "\n", "# run_image_capture(object_name, src, imgs_per_cycle=num_images, num_cycles=1, file_prefix=file_prefix, hrg_exptime=hrg_exptime, r_exptime=r_exptime, lrg_exptime=lrg_exptime)\n", "\n", "#recenter_on_current_object(src, exptime=5, filter='g')\n", "\n", "run_image_capture_single_filter(object_name, src, num_images=num_images-1, filter='r', exptime=r_exptime, file_prefix=file_prefix)\n", "\n", "run_image_capture_single_filter(object_name, src, num_images=num_images, filter='hrg', exptime=hrg_exptime, file_prefix=file_prefix)\n", "\n", "recenter_on_current_object(src, exptime=5, filter='g')\n", "\n", "run_image_capture_single_filter(object_name, src, num_images=num_images, filter='lrg', exptime=lrg_exptime, file_prefix=file_prefix)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## End of night tasks" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ " # Stop tracking\n", "rlmt.telescope.Tracking = False" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Park telescope\n", "rlmt.telescope.Park()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Disconnect all devices\n", "rlmt.disconnect_all()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "pyscope-dev", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.2" } }, "nbformat": 4, "nbformat_minor": 2 }