From bab72a7a61589187317721e15ea4c8b6d27a260d Mon Sep 17 00:00:00 2001 From: Brian McLean Date: Fri, 17 May 2024 12:48:08 -0400 Subject: [PATCH] Updated to delete DS9 region file if it exists --- .../display_footprints/display_footprints.ipynb | 9 ++++++--- notebooks/multi_mission/display_footprints/selectSIAF.py | 5 +---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/notebooks/multi_mission/display_footprints/display_footprints.ipynb b/notebooks/multi_mission/display_footprints/display_footprints.ipynb index 9cdebe379..be54189b2 100644 --- a/notebooks/multi_mission/display_footprints/display_footprints.ipynb +++ b/notebooks/multi_mission/display_footprints/display_footprints.ipynb @@ -33,10 +33,11 @@ "source": [ "from astroquery.mast import Mast\n", "from ipyaladin import Aladin\n", - "from selectSIAF import defineApertures, getVertices, computeStcsFootprint, computeRegionFootprint\n", "from regions import Regions\n", + "from selectSIAF import defineApertures, getVertices, computeStcsFootprint, computeRegionFootprint\n", "\n", "import matplotlib.pyplot as plt\n", + "import os\n", "import pysiaf\n", "import time" ] @@ -296,7 +297,9 @@ " regionList.append(apertureRegion)\n", " \n", "# Provide a writeable file location on your system\n", - "regionFile = 'e:\\\\Projects\\\\Scratch\\\\regionTest.reg'\n", + "regionFile='e:\\\\Projects\\\\Scratch\\\\regionTest.reg'\n", + "if os.path.isfile(regionFile):\n", + " os.remove(regionFile)\n", "combinedRegion = Regions(regionList)\n", "combinedRegion.write(regionFile)" ] @@ -403,7 +406,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.3" + "version": "3.11.5" } }, "nbformat": 4, diff --git a/notebooks/multi_mission/display_footprints/selectSIAF.py b/notebooks/multi_mission/display_footprints/selectSIAF.py index 10cbe1b9e..a4abecc54 100644 --- a/notebooks/multi_mission/display_footprints/selectSIAF.py +++ b/notebooks/multi_mission/display_footprints/selectSIAF.py @@ -244,7 +244,7 @@ def getVertices(apertureSiaf): xVertices = apertureSiaf.V2Ref yVertices = apertureSiaf.V3Ref if (apertureSiaf.observatory == 'HST' and apertureSiaf.AperShape == 'PICK'): - print('Unsupported shape ',apertureSiaf.AperShape) + print('Unsupported shape ', apertureSiaf.AperShape) xVertices = None yVertices = None @@ -258,9 +258,6 @@ def computeStcsFootprint(apertureSiaf, skyRa, skyDec): elif apertureSiaf.AperShape == 'CIRC': radius = apertureSiaf.maj/3600.0 apertureSregion = 'CIRCLE ICRS {} {} {} '.format(skyRa, skyDec, radius) - #elif apertureSiaf.AperShape == 'PICK': - #radius = apertureSiaf.maj/3600.0 - #apertureSregion = 'POLYGON ICRS {} {} {} '.format(skyRa, skyDec, radius) else: print('Unsupported shape {}').format(apertureSiaf.AperShape)