From cfc2ba6c4f1b416b1636f80150065ebab3777cf6 Mon Sep 17 00:00:00 2001 From: "Adam Ginsburg (keflavich)" Date: Tue, 22 Mar 2016 14:10:22 -0700 Subject: [PATCH 01/30] add a minimal ds9 region language specification (that fails) --- regions/io/ds9_language.py | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 regions/io/ds9_language.py diff --git a/regions/io/ds9_language.py b/regions/io/ds9_language.py new file mode 100644 index 00000000..3ecd68a3 --- /dev/null +++ b/regions/io/ds9_language.py @@ -0,0 +1,4 @@ +{'point': (coordinate, coordinate), + 'circle': (coordinate, coordinate, radius), + 'box': (coordinate, coordinate, width, height), +} From eb9a322911d8b562173c48d83130c5b15a0e52c5 Mon Sep 17 00:00:00 2001 From: "Adam Ginsburg (keflavich)" Date: Tue, 22 Mar 2016 14:17:39 -0700 Subject: [PATCH 02/30] pseudocode parser --- regions/io/ds9_language.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/regions/io/ds9_language.py b/regions/io/ds9_language.py index 3ecd68a3..138f6508 100644 --- a/regions/io/ds9_language.py +++ b/regions/io/ds9_language.py @@ -1,4 +1,17 @@ -{'point': (coordinate, coordinate), +language = {'point': (coordinate, coordinate), 'circle': (coordinate, coordinate, radius), - 'box': (coordinate, coordinate, width, height), + 'box': (coordinate, coordinate, width, height, angle), } + +circle(1.5, 3.6, 1.2) + +def line_parser(line): + region_type = 'circle' if 'circle' in line + + typer_parser(coordinate_string, language[region_type]) + +def type_parser(string, specfication): + coord_list = [] + splitter = re.compile("[, ]") + for element, element_parser in zip(splitter.split(string, specification): + coord_list.append(element_parser(element)) From 3b5fb0e1aa3a44af907b3660dcd52fe99b8861c8 Mon Sep 17 00:00:00 2001 From: "Adam Ginsburg (keflavich)" Date: Tue, 22 Mar 2016 15:06:11 -0700 Subject: [PATCH 03/30] first successful parser! --- regions/io/ds9_language.py | 98 +++++++++++++++++++++++++++++++++----- 1 file changed, 87 insertions(+), 11 deletions(-) diff --git a/regions/io/ds9_language.py b/regions/io/ds9_language.py index 138f6508..23ab1712 100644 --- a/regions/io/ds9_language.py +++ b/regions/io/ds9_language.py @@ -1,17 +1,93 @@ -language = {'point': (coordinate, coordinate), - 'circle': (coordinate, coordinate, radius), - 'box': (coordinate, coordinate, width, height, angle), -} +import string +import re +from astropy import units as u +from astropy import coordinates -circle(1.5, 3.6, 1.2) +def coordinate(string_rep, unit): + return coordinates.Angle(string_rep, unit=unit) -def line_parser(line): - region_type = 'circle' if 'circle' in line +unit_mapping = {'"': u.arcsec, + "'": u.arcmin} - typer_parser(coordinate_string, language[region_type]) +def radius(string_rep): + has_unit = string_rep[-1] not in string.digits + if has_unit: + unit = unit_mapping[string_rep[-1]] + return u.Quantity(float(string_rep[:-1]), unit=unit) + else: + return u.Quantity(float(string_rep), unit=u.deg) -def type_parser(string, specfication): +# these are the same function, just different names +width = radius +height = radius +angle = radius + +language_spec = {'point': (coordinate, coordinate), + 'circle': (coordinate, coordinate, radius), + 'box': (coordinate, coordinate, width, height, angle), + } + +coordinate_systems = ['fk5', 'fk4', 'icrs', 'galactic', 'wcs', 'physical', 'image'] +coordinate_systems += ['wcs{0}'.format(letter) for letter in string.ascii_lowercase] + +coordinate_units = {'fk5': (u.hour, u.deg), + 'fk4': (u.hour, u.deg), + 'icrs': (u.hour, u.deg), + 'galactic': (u.deg, u.deg), + 'physical': (u.dimensionless_unscaled, u.dimensionless_unscaled), + 'image': (u.dimensionless_unscaled, u.dimensionless_unscaled), + 'wcs': (u.dimensionless_unscaled, u.dimensionless_unscaled), + } +for letter in string.ascii_lowercase: + coordinate_units['wcs{0}'.format(letter)] = (u.dimensionless_unscaled, u.dimensionless_unscaled) + +# circle(1.5, 3.6, 1.2) + +region_type_or_coordsys_re = re.compile("#? *([a-zA-Z0-9]+)") + +paren = re.compile("[()]") + +def strip_paren(string_rep): + return paren.sub("", string_rep) + +def ds9_parser(filename): + coordsys = None + regions = [] + + with open(filename,'r') as fh: + for line in fh: + parsed = line_parser(line, coordsys) + if parsed in coordinate_systems: + coordsys = parsed + elif parsed: + region_type, coordlist = parsed + regions.append((region_type, coordlist)) + + return regions + +def line_parser(line, coordsys=None): + region_type_search = region_type_or_coordsys_re.search(line) + if region_type_search: + region_type = region_type_search.groups()[0] + else: + return + + if region_type in coordinate_systems: + return region_type # outer loop has to do something with the coordinate system information + elif region_type in language_spec: + if coordsys is None: + raise ValueError("No coordinate system specified and a region has been found.") + return region_type, type_parser(strip_paren(line[region_type_search.span()[1]:]), + language_spec[region_type], coordsys) + +def type_parser(string_rep, specification, coordsys): coord_list = [] splitter = re.compile("[, ]") - for element, element_parser in zip(splitter.split(string, specification): - coord_list.append(element_parser(element)) + for ii, (element, element_parser) in enumerate(zip(splitter.split(string_rep), specification)): + if element_parser is coordinate: + unit = coordinate_units[coordsys][ii] + coord_list.append(element_parser(element, unit)) + else: + coord_list.append(element_parser(element)) + + return coord_list From 0412154578c03102bb6597d0ce36d3f34c0f7b9c Mon Sep 17 00:00:00 2001 From: "Adam Ginsburg (keflavich)" Date: Tue, 22 Mar 2016 15:18:13 -0700 Subject: [PATCH 04/30] minor refactor and commenting --- regions/io/ds9_language.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/regions/io/ds9_language.py b/regions/io/ds9_language.py index 23ab1712..583a8235 100644 --- a/regions/io/ds9_language.py +++ b/regions/io/ds9_language.py @@ -4,12 +4,13 @@ from astropy import coordinates def coordinate(string_rep, unit): + # Any ds9 coordinate representation (sexagesimal or degrees) return coordinates.Angle(string_rep, unit=unit) unit_mapping = {'"': u.arcsec, "'": u.arcmin} -def radius(string_rep): +def angular_length_quantity(string_rep): has_unit = string_rep[-1] not in string.digits if has_unit: unit = unit_mapping[string_rep[-1]] @@ -18,9 +19,10 @@ def radius(string_rep): return u.Quantity(float(string_rep), unit=u.deg) # these are the same function, just different names -width = radius -height = radius -angle = radius +radius = angular_length_quantity +width = angular_length_quantity +height = angular_length_quantity +angle = angular_length_quantity language_spec = {'point': (coordinate, coordinate), 'circle': (coordinate, coordinate, radius), From d6c4eb0fb779e82816340cebc9343131945880d4 Mon Sep 17 00:00:00 2001 From: "Adam Ginsburg (keflavich)" Date: Tue, 22 Mar 2016 15:30:25 -0700 Subject: [PATCH 05/30] split on semicolons --- regions/io/ds9_language.py | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/regions/io/ds9_language.py b/regions/io/ds9_language.py index 583a8235..cee61783 100644 --- a/regions/io/ds9_language.py +++ b/regions/io/ds9_language.py @@ -53,17 +53,26 @@ def strip_paren(string_rep): return paren.sub("", string_rep) def ds9_parser(filename): + """ + Parse a complete ds9 .reg file + + Returns + ------- + list of (region type, coord_list) tuples + """ coordsys = None regions = [] with open(filename,'r') as fh: - for line in fh: - parsed = line_parser(line, coordsys) - if parsed in coordinate_systems: - coordsys = parsed - elif parsed: - region_type, coordlist = parsed - regions.append((region_type, coordlist)) + for line_ in fh: + # ds9 regions can be split on \n or ; + for line in line_.split(";"): + parsed = line_parser(line, coordsys) + if parsed in coordinate_systems: + coordsys = parsed + elif parsed: + region_type, coordlist = parsed + regions.append((region_type, coordlist)) return regions @@ -79,8 +88,9 @@ def line_parser(line, coordsys=None): elif region_type in language_spec: if coordsys is None: raise ValueError("No coordinate system specified and a region has been found.") - return region_type, type_parser(strip_paren(line[region_type_search.span()[1]:]), - language_spec[region_type], coordsys) + coords_etc = strip_paren(line[region_type_search.span()[1]:]) + return region_type, type_parser(coords_etc, language_spec[region_type], + coordsys) def type_parser(string_rep, specification, coordsys): coord_list = [] From 2bda12c34fee8a4afda52912dc605245a0af353d Mon Sep 17 00:00:00 2001 From: "Adam Ginsburg (keflavich)" Date: Tue, 22 Mar 2016 15:37:24 -0700 Subject: [PATCH 06/30] parse polygons! --- regions/io/ds9_language.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/regions/io/ds9_language.py b/regions/io/ds9_language.py index cee61783..bcc56c9a 100644 --- a/regions/io/ds9_language.py +++ b/regions/io/ds9_language.py @@ -1,4 +1,5 @@ import string +import itertools import re from astropy import units as u from astropy import coordinates @@ -27,6 +28,7 @@ def angular_length_quantity(string_rep): language_spec = {'point': (coordinate, coordinate), 'circle': (coordinate, coordinate, radius), 'box': (coordinate, coordinate, width, height, angle), + 'polygon': itertools.cycle((coordinate, )), } coordinate_systems = ['fk5', 'fk4', 'icrs', 'galactic', 'wcs', 'physical', 'image'] @@ -88,7 +90,7 @@ def line_parser(line, coordsys=None): elif region_type in language_spec: if coordsys is None: raise ValueError("No coordinate system specified and a region has been found.") - coords_etc = strip_paren(line[region_type_search.span()[1]:]) + coords_etc = strip_paren(line[region_type_search.span()[1]:line.find("#")].strip()) return region_type, type_parser(coords_etc, language_spec[region_type], coordsys) @@ -97,7 +99,7 @@ def type_parser(string_rep, specification, coordsys): splitter = re.compile("[, ]") for ii, (element, element_parser) in enumerate(zip(splitter.split(string_rep), specification)): if element_parser is coordinate: - unit = coordinate_units[coordsys][ii] + unit = coordinate_units[coordsys][ii % 2] coord_list.append(element_parser(element, unit)) else: coord_list.append(element_parser(element)) From e979dae89e10bdff89213a70a8e207062655a6de Mon Sep 17 00:00:00 2001 From: "Adam Ginsburg (keflavich)" Date: Tue, 22 Mar 2016 15:50:53 -0700 Subject: [PATCH 07/30] parse coordinates as coordinate objects --- regions/io/ds9_language.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/regions/io/ds9_language.py b/regions/io/ds9_language.py index bcc56c9a..45976bdb 100644 --- a/regions/io/ds9_language.py +++ b/regions/io/ds9_language.py @@ -90,9 +90,23 @@ def line_parser(line, coordsys=None): elif region_type in language_spec: if coordsys is None: raise ValueError("No coordinate system specified and a region has been found.") - coords_etc = strip_paren(line[region_type_search.span()[1]:line.find("#")].strip()) - return region_type, type_parser(coords_etc, language_spec[region_type], - coordsys) + # end_of_region_name is the coordinate of the end of the region's name, e.g.: + # circle would be 6 because circle is 6 characters + end_of_region_name = region_type_search.span()[1] + # coordinate of the # symbol or end of the line (-1) if not found + hash_or_end = line.find("#") + coords_etc = strip_paren(line[end_of_region_name:hash_or_end].strip()) + if coordsys in coordinates.frame_transform_graph.get_names(): + parsed = type_parser(coords_etc, language_spec[region_type], + coordsys) + coords = coordinates.SkyCoord([(x, y) + for x, y in zip(parsed[:-1:2], parsed[1::2]) + if isinstance(x, coordinates.Angle) and + isinstance(x, coordinates.Angle)], frame=coordsys) + return region_type, [coords] + parsed[len(coords)*2:] + else: + return region_type, type_parser(coords_etc, language_spec[region_type], + coordsys) def type_parser(string_rep, specification, coordsys): coord_list = [] From 342fe4e0c995a5f48cfb98c342cf4bcbda5fa2d9 Mon Sep 17 00:00:00 2001 From: "Adam Ginsburg (keflavich)" Date: Tue, 22 Mar 2016 16:12:50 -0700 Subject: [PATCH 08/30] failed to crash! --- regions/io/ds9_language.py | 72 ++++++++++++++++++++++++++++++-------- 1 file changed, 58 insertions(+), 14 deletions(-) diff --git a/regions/io/ds9_language.py b/regions/io/ds9_language.py index 45976bdb..6b406a83 100644 --- a/regions/io/ds9_language.py +++ b/regions/io/ds9_language.py @@ -6,10 +6,25 @@ def coordinate(string_rep, unit): # Any ds9 coordinate representation (sexagesimal or degrees) - return coordinates.Angle(string_rep, unit=unit) + try: + return coordinates.Angle(string_rep) + except u.UnitsError: + if unit == 'hour_or_deg': + if ':' in string_rep: + return coordinates.Angle(string_rep, unit=u.hour) + else: + return coordinates.Angle(string_rep, unit=u.deg) + elif unit.is_equivalent(u.deg): + return coordinates.Angle(string_rep, unit=unit) + else: + return u.Quantity(float(string_rep), unit) unit_mapping = {'"': u.arcsec, - "'": u.arcmin} + "'": u.arcmin, + 'r': u.rad, + 'i': u.dimensionless_unscaled, + + } def angular_length_quantity(string_rep): has_unit = string_rep[-1] not in string.digits @@ -31,12 +46,18 @@ def angular_length_quantity(string_rep): 'polygon': itertools.cycle((coordinate, )), } -coordinate_systems = ['fk5', 'fk4', 'icrs', 'galactic', 'wcs', 'physical', 'image'] +coordinate_systems = ['fk5', 'fk4', 'icrs', 'galactic', 'wcs', 'physical', 'image', 'ecliptic'] coordinate_systems += ['wcs{0}'.format(letter) for letter in string.ascii_lowercase] -coordinate_units = {'fk5': (u.hour, u.deg), - 'fk4': (u.hour, u.deg), - 'icrs': (u.hour, u.deg), +coordsys_name_mapping = dict(zip(coordinates.frame_transform_graph.get_names(), + coordinates.frame_transform_graph.get_names())) +coordsys_name_mapping['ecliptic'] = 'geocentrictrueecliptic' # needs expert attention TODO + +hour_or_deg = 'hour_or_deg' +coordinate_units = {'fk5': (hour_or_deg, u.deg), + 'fk4': (hour_or_deg, u.deg), + 'icrs': (hour_or_deg, u.deg), + 'geocentrictrueecliptic': (u.deg, u.deg), 'galactic': (u.deg, u.deg), 'physical': (u.dimensionless_unscaled, u.dimensionless_unscaled), 'image': (u.dimensionless_unscaled, u.dimensionless_unscaled), @@ -64,6 +85,7 @@ def ds9_parser(filename): """ coordsys = None regions = [] + composite_region = None with open(filename,'r') as fh: for line_ in fh: @@ -73,8 +95,17 @@ def ds9_parser(filename): if parsed in coordinate_systems: coordsys = parsed elif parsed: - region_type, coordlist = parsed - regions.append((region_type, coordlist)) + region_type, coordlist, composite = parsed + if composite and composite_region is None: + composite_region = [(region_type, coordlist)] + elif composite: + composite_region.append((region_type, coordlist)) + elif composite_region is not None: + composite_region.append((region_type, coordlist)) + regions.append(composite_region) + composite_region = None + else: + regions.append((region_type, coordlist)) return regions @@ -90,23 +121,29 @@ def line_parser(line, coordsys=None): elif region_type in language_spec: if coordsys is None: raise ValueError("No coordinate system specified and a region has been found.") + + if "||" in line: + composite = True + else: + composite = False + # end_of_region_name is the coordinate of the end of the region's name, e.g.: # circle would be 6 because circle is 6 characters end_of_region_name = region_type_search.span()[1] # coordinate of the # symbol or end of the line (-1) if not found hash_or_end = line.find("#") - coords_etc = strip_paren(line[end_of_region_name:hash_or_end].strip()) - if coordsys in coordinates.frame_transform_graph.get_names(): + coords_etc = strip_paren(line[end_of_region_name:hash_or_end].strip(" |")) + if coordsys in coordsys_name_mapping: parsed = type_parser(coords_etc, language_spec[region_type], - coordsys) + coordsys_name_mapping[coordsys]) coords = coordinates.SkyCoord([(x, y) for x, y in zip(parsed[:-1:2], parsed[1::2]) if isinstance(x, coordinates.Angle) and - isinstance(x, coordinates.Angle)], frame=coordsys) - return region_type, [coords] + parsed[len(coords)*2:] + isinstance(x, coordinates.Angle)], frame=coordsys_name_mapping[coordsys]) + return region_type, [coords] + parsed[len(coords)*2:], composite else: return region_type, type_parser(coords_etc, language_spec[region_type], - coordsys) + coordsys), composite def type_parser(string_rep, specification, coordsys): coord_list = [] @@ -119,3 +156,10 @@ def type_parser(string_rep, specification, coordsys): coord_list.append(element_parser(element)) return coord_list + +if __name__ == "__main__": + # simple tests for now... + import glob + for fn in glob.glob('/Users/adam/Downloads/tests/regions/*.reg'): + print(fn) + ds9_parser(fn) From de72fab6af5087756f5ea67a72bcaf1a32470781 Mon Sep 17 00:00:00 2001 From: "Adam Ginsburg (keflavich)" Date: Tue, 22 Mar 2016 16:20:28 -0700 Subject: [PATCH 09/30] 10-100x speed boost --- regions/io/ds9_language.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/regions/io/ds9_language.py b/regions/io/ds9_language.py index 6b406a83..5ee806b7 100644 --- a/regions/io/ds9_language.py +++ b/regions/io/ds9_language.py @@ -6,18 +6,17 @@ def coordinate(string_rep, unit): # Any ds9 coordinate representation (sexagesimal or degrees) - try: + if 'd' in string_rep or 'h' in string_rep: return coordinates.Angle(string_rep) - except u.UnitsError: - if unit == 'hour_or_deg': - if ':' in string_rep: - return coordinates.Angle(string_rep, unit=u.hour) - else: - return coordinates.Angle(string_rep, unit=u.deg) - elif unit.is_equivalent(u.deg): - return coordinates.Angle(string_rep, unit=unit) + elif unit is 'hour_or_deg': + if ':' in string_rep: + return coordinates.Angle(string_rep, unit=u.hour) else: - return u.Quantity(float(string_rep), unit) + return coordinates.Angle(string_rep, unit=u.deg) + elif unit.is_equivalent(u.deg): + return coordinates.Angle(string_rep, unit=unit) + else: + return u.Quantity(float(string_rep), unit) unit_mapping = {'"': u.arcsec, "'": u.arcmin, From 81c13512249cf1492deb72246752db44ed76c675 Mon Sep 17 00:00:00 2001 From: "Adam Ginsburg (keflavich)" Date: Tue, 22 Mar 2016 17:15:15 -0700 Subject: [PATCH 10/30] parse the meta too --- regions/io/ds9_language.py | 39 ++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/regions/io/ds9_language.py b/regions/io/ds9_language.py index 5ee806b7..4b89f159 100644 --- a/regions/io/ds9_language.py +++ b/regions/io/ds9_language.py @@ -22,7 +22,6 @@ def coordinate(string_rep, unit): "'": u.arcmin, 'r': u.rad, 'i': u.dimensionless_unscaled, - } def angular_length_quantity(string_rep): @@ -65,8 +64,6 @@ def angular_length_quantity(string_rep): for letter in string.ascii_lowercase: coordinate_units['wcs{0}'.format(letter)] = (u.dimensionless_unscaled, u.dimensionless_unscaled) -# circle(1.5, 3.6, 1.2) - region_type_or_coordsys_re = re.compile("#? *([a-zA-Z0-9]+)") paren = re.compile("[()]") @@ -94,7 +91,7 @@ def ds9_parser(filename): if parsed in coordinate_systems: coordsys = parsed elif parsed: - region_type, coordlist, composite = parsed + region_type, coordlist, meta, composite = parsed if composite and composite_region is None: composite_region = [(region_type, coordlist)] elif composite: @@ -104,7 +101,7 @@ def ds9_parser(filename): regions.append(composite_region) composite_region = None else: - regions.append((region_type, coordlist)) + regions.append((region_type, coordlist, meta)) return regions @@ -132,6 +129,10 @@ def line_parser(line, coordsys=None): # coordinate of the # symbol or end of the line (-1) if not found hash_or_end = line.find("#") coords_etc = strip_paren(line[end_of_region_name:hash_or_end].strip(" |")) + meta_str = line[hash_or_end:] + + parsed_meta = meta_parser(meta_str) + if coordsys in coordsys_name_mapping: parsed = type_parser(coords_etc, language_spec[region_type], coordsys_name_mapping[coordsys]) @@ -139,10 +140,10 @@ def line_parser(line, coordsys=None): for x, y in zip(parsed[:-1:2], parsed[1::2]) if isinstance(x, coordinates.Angle) and isinstance(x, coordinates.Angle)], frame=coordsys_name_mapping[coordsys]) - return region_type, [coords] + parsed[len(coords)*2:], composite + return region_type, [coords] + parsed[len(coords)*2:], parsed_meta, composite else: return region_type, type_parser(coords_etc, language_spec[region_type], - coordsys), composite + coordsys), parsed_meta, composite def type_parser(string_rep, specification, coordsys): coord_list = [] @@ -156,9 +157,31 @@ def type_parser(string_rep, specification, coordsys): return coord_list + +# match an x=y pair (where y can be any set of characters) that may or may not +# be followed by another one +meta_token = re.compile("([a-zA-Z]+)(=)([^= ]+) ?") + +#meta_spec = {'color': color, +# } +# global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1 +# ruler(+175:07:14.900,+50:56:21.236,+175:06:52.643,+50:56:11.190) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} + + + +def meta_parser(meta_str): + meta_token_split = [x for x in meta_token.split(meta_str.strip()) if x] + equals_inds = [i for i, x in enumerate(meta_token_split) if x is '='] + result = {meta_token_split[ii-1]: + " ".join(meta_token_split[ii+1:jj-1 if jj is not None else None]) + for ii,jj in zip(equals_inds, equals_inds[1:]+[None])} + + return result + if __name__ == "__main__": # simple tests for now... import glob + results = {} for fn in glob.glob('/Users/adam/Downloads/tests/regions/*.reg'): print(fn) - ds9_parser(fn) + results[fn] = ds9_parser(fn) From 66ae9b9d0527173ceab76215dc557fab86f9f45a Mon Sep 17 00:00:00 2001 From: "Adam Ginsburg (keflavich)" Date: Tue, 22 Mar 2016 17:35:34 -0700 Subject: [PATCH 11/30] start turning parsed things into objects --- regions/io/ds9_language.py | 28 ++++++++++++++++++++++++++-- regions/shapes/circle.py | 8 ++++++-- regions/shapes/ellipse.py | 9 +++++++-- regions/shapes/polygon.py | 8 ++++++-- regions/shapes/rectangle.py | 10 +++++++--- 5 files changed, 52 insertions(+), 11 deletions(-) diff --git a/regions/io/ds9_language.py b/regions/io/ds9_language.py index 4b89f159..9984942f 100644 --- a/regions/io/ds9_language.py +++ b/regions/io/ds9_language.py @@ -3,6 +3,8 @@ import re from astropy import units as u from astropy import coordinates +from ..shapes import circle, rectangle, polygon, ellipse +from ..core import PixCoord def coordinate(string_rep, unit): # Any ds9 coordinate representation (sexagesimal or degrees) @@ -40,6 +42,7 @@ def angular_length_quantity(string_rep): language_spec = {'point': (coordinate, coordinate), 'circle': (coordinate, coordinate, radius), + 'ellipse': (coordinate, coordinate, width, height, angle), 'box': (coordinate, coordinate, width, height, angle), 'polygon': itertools.cycle((coordinate, )), } @@ -71,6 +74,20 @@ def angular_length_quantity(string_rep): def strip_paren(string_rep): return paren.sub("", string_rep) + +viz_keywords = ['color', 'dashed', 'width', 'point', 'font'] +def region_list_to_objects(region_list): + output_list = [] + for region_type, coord_list, meta in region_list: + if region_type is circle: + if isinstance(coord_list[0], coordinates.SkyCoord): + output_list.append(circle.SkyCircleRegion(coord_list[0], coord_list[1])) + elif isinstance(coord_list[0], PixCoord): + output_list.append(circle.PixelCircleRegion(coord_list[0], coord_list[1])) + else: + raise ValueError("No central coordinate") + + def ds9_parser(filename): """ Parse a complete ds9 .reg file @@ -142,8 +159,15 @@ def line_parser(line, coordsys=None): isinstance(x, coordinates.Angle)], frame=coordsys_name_mapping[coordsys]) return region_type, [coords] + parsed[len(coords)*2:], parsed_meta, composite else: - return region_type, type_parser(coords_etc, language_spec[region_type], - coordsys), parsed_meta, composite + parsed = type_parser(coords_etc, language_spec[region_type], + coordsys) + if region_type == 'polygon': + coord = PixCoord(parsed[0::2], parsed[1::2]) + parsed_return = [coord] + else: + coord = PixCoord(parsed[0], parsed[1]) + parsed_return = [coord]+parsed[2:] + return region_type, parsed_return, parsed_meta, composite def type_parser(string_rep, specification, coordsys): coord_list = [] diff --git a/regions/shapes/circle.py b/regions/shapes/circle.py index 8e3953f2..470d47b9 100644 --- a/regions/shapes/circle.py +++ b/regions/shapes/circle.py @@ -18,10 +18,12 @@ class CirclePixelRegion(PixelRegion): The radius of the circle """ - def __init__(self, center, radius): + def __init__(self, center, radius, meta=None, visual=None): # TODO: test that center is a 0D PixCoord self.center = center self.radius = radius + self.meta = meta or {} + self.visual = visual or {} @property def area(self): @@ -55,10 +57,12 @@ class CircleSkyRegion(SkyRegion): The radius of the circle in angular units """ - def __init__(self, center, radius): + def __init__(self, center, radius, meta=None, visual=None): # TODO: test that center is a 0D SkyCoord self.center = center self.radius = radius + self.meta = meta or {} + self.visual = visual or {} @property def area(self): diff --git a/regions/shapes/ellipse.py b/regions/shapes/ellipse.py index 38637691..01c5548f 100644 --- a/regions/shapes/ellipse.py +++ b/regions/shapes/ellipse.py @@ -20,12 +20,15 @@ class EllipsePixelRegion(PixelRegion): axis is lined up with the x axis. """ - def __init__(self, center, minor, major, angle=0. * u.deg): + def __init__(self, center, minor, major, angle=0. * u.deg, meta=None, + visual=None): # TODO: use quantity_input to check that angle is an angle self.center = center self.minor = minor self.major = major self.angle = angle + self.meta = meta or {} + self.visual = visual or {} @property def area(self): @@ -67,12 +70,14 @@ class EllipseSkyRegion(SkyRegion): axis is lined up with the longitude axis of the celestial coordinates. """ - def __init__(self, center, minor, major, angle=0. * u.deg): + def __init__(self, center, minor, major, angle=0. * u.deg, meta=None, visual=None): # TODO: use quantity_input to check that height, width, and angle are angles self.center = center self.minor = minor self.major = major self.angle = angle + self.meta = meta or {} + self.visual = visual or {} @property def area(self): diff --git a/regions/shapes/polygon.py b/regions/shapes/polygon.py index dd8dbec1..b2c76683 100644 --- a/regions/shapes/polygon.py +++ b/regions/shapes/polygon.py @@ -11,9 +11,11 @@ class PolygonPixelRegion(PixelRegion): The vertices of the polygon """ - def __init__(self, vertices): + def __init__(self, vertices, meta=None, visual=None): # TODO: test that vertices is a 1D PixCoord self.vertices = vertices + self.meta = meta or {} + self.visual = visual or {} @property def area(self): @@ -48,9 +50,11 @@ class PolygonSkyRegion(SkyRegion): The vertices of the polygon """ - def __init__(self, vertices): + def __init__(self, vertices, meta=None, visual=None): # TODO: test that vertices is a 1D SkyCoord self.vertices = vertices + self.meta = meta or {} + self.visual = visual or {} @property def area(self): diff --git a/regions/shapes/rectangle.py b/regions/shapes/rectangle.py index f52e90ca..2f421149 100644 --- a/regions/shapes/rectangle.py +++ b/regions/shapes/rectangle.py @@ -20,12 +20,14 @@ class RectanglePixelRegion(PixelRegion): is lined up with the x axis. """ - def __init__(self, center, height, width, angle=0 * u.deg): + def __init__(self, center, height, width, angle=0 * u.deg, meta=None, visual=None): # TODO: use quantity_input to check that angle is an angle self.center = center - self.height = minor + self.height = height self.width = width self.angle = angle + self.meta = meta or {} + self.visual = visual or {} @property def area(self): @@ -67,12 +69,14 @@ class RectangleSkyRegion(SkyRegion): is lined up with the longitude axis of the celestial coordinates. """ - def __init__(self, center, height, width, angle=0 * u.deg): + def __init__(self, center, height, width, angle=0 * u.deg, meta=None, visual=None): # TODO: use quantity_input to check that height, width, and angle are angles self.center = center self.height = minor self.width = width self.angle = angle + self.meta = meta or {} + self.visual = visual or {} @property def area(self): From e07b04fc84b8f702734c474054ee1be72592696c Mon Sep 17 00:00:00 2001 From: "Adam Ginsburg (keflavich)" Date: Tue, 22 Mar 2016 17:56:21 -0700 Subject: [PATCH 12/30] now can make objects! --- regions/io/ds9_language.py | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/regions/io/ds9_language.py b/regions/io/ds9_language.py index 9984942f..8a7d061a 100644 --- a/regions/io/ds9_language.py +++ b/regions/io/ds9_language.py @@ -79,13 +79,37 @@ def strip_paren(string_rep): def region_list_to_objects(region_list): output_list = [] for region_type, coord_list, meta in region_list: - if region_type is circle: + #print("region_type, region_type is 'circle', type(region_type), type('circle'), id(region_type), id('circle'), id(str(region_type))") + #print(region_type, region_type is 'circle', type(region_type), type('circle'), id(region_type), id('circle'), id(str(region_type))) + if region_type == 'circle': if isinstance(coord_list[0], coordinates.SkyCoord): - output_list.append(circle.SkyCircleRegion(coord_list[0], coord_list[1])) + output_list.append(circle.CircleSkyRegion(coord_list[0], coord_list[1])) elif isinstance(coord_list[0], PixCoord): - output_list.append(circle.PixelCircleRegion(coord_list[0], coord_list[1])) + output_list.append(circle.CirclePixelRegion(coord_list[0], coord_list[1])) else: raise ValueError("No central coordinate") + elif region_type == 'ellipse': + if isinstance(coord_list[0], coordinates.SkyCoord): + output_list.append(ellipse.EllipseSkyRegion(coord_list[0], coord_list[1], coord_list[2], coord_list[3])) + elif isinstance(coord_list[0], PixCoord): + output_list.append(ellipse.EllipsePixelRegion(coord_list[0], coord_list[1], coord_list[2], coord_list[3])) + else: + raise ValueError("No central coordinate") + elif region_type == 'polygon': + if isinstance(coord_list[0], coordinates.SkyCoord): + output_list.append(polygon.PolygonSkyRegion(coord_list[0])) + elif isinstance(coord_list[0], PixCoord): + output_list.append(polygon.PolygonPixelRegion(coord_list[0])) + else: + raise ValueError("No central coordinate") + elif region_type == 'rectangle': + if isinstance(coord_list[0], coordinates.SkyCoord): + output_list.append(rectangle.RectangleSkyRegion(coord_list[0], coord_list[1], coord_list[2], coord_list[3])) + elif isinstance(coord_list[0], PixCoord): + output_list.append(rectangle.RectanglePixelRegion(coord_list[0], coord_list[1], coord_list[2], coord_list[3])) + else: + raise ValueError("No central coordinate") + return output_list def ds9_parser(filename): From edcdf6bda08766322560835545a6afffd6a00e9f Mon Sep 17 00:00:00 2001 From: Johannes King Date: Wed, 23 Mar 2016 23:39:34 +0100 Subject: [PATCH 13/30] add __init__.py --- regions/io/__init__.py | 5 +++++ regions/shapes/__init__.py | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/regions/io/__init__.py b/regions/io/__init__.py index e69de29b..10b6e7a4 100644 --- a/regions/io/__init__.py +++ b/regions/io/__init__.py @@ -0,0 +1,5 @@ +# Licensed under a 3-clause BSD style license - see LICENSE.rst +"""I/O +""" +from .ds9_language import * + diff --git a/regions/shapes/__init__.py b/regions/shapes/__init__.py index e69de29b..fb62204c 100644 --- a/regions/shapes/__init__.py +++ b/regions/shapes/__init__.py @@ -0,0 +1,7 @@ +# Licensed under a 3-clause BSD style license - see LICENSE.rst +"""Region shapes +""" +from .circle import * +from .ellipse import * +from .polygon import * +from .rectangle import * From 3874972ee4cd6c42ad0b6bbf6b9aa4b2cdc771d9 Mon Sep 17 00:00:00 2001 From: Johannes King Date: Wed, 23 Mar 2016 23:40:31 +0100 Subject: [PATCH 14/30] add test skeleton --- regions/io/setup_package.py | 6 +++++ regions/io/tests/__init__.py | 4 +++ regions/io/tests/data/ds9.fk5.reg | 39 +++++++++++++++++++++++++++ regions/io/tests/test_ds9_language.py | 8 ++++++ 4 files changed, 57 insertions(+) create mode 100644 regions/io/setup_package.py create mode 100644 regions/io/tests/__init__.py create mode 100644 regions/io/tests/data/ds9.fk5.reg create mode 100644 regions/io/tests/test_ds9_language.py diff --git a/regions/io/setup_package.py b/regions/io/setup_package.py new file mode 100644 index 00000000..9babccf5 --- /dev/null +++ b/regions/io/setup_package.py @@ -0,0 +1,6 @@ +# Licensed under a 3-clause BSD style license - see LICENSE.rst +import os + +def get_package_data(): + parser_test = [os.path.join('data', 'ds9.fk5.reg')] + return {'regions.io.tests': parser_test} diff --git a/regions/io/tests/__init__.py b/regions/io/tests/__init__.py new file mode 100644 index 00000000..2ff7e2a6 --- /dev/null +++ b/regions/io/tests/__init__.py @@ -0,0 +1,4 @@ +# Licensed under a 3-clause BSD style license - see LICENSE.rst +""" +This packages contains affiliated package tests. +""" diff --git a/regions/io/tests/data/ds9.fk5.reg b/regions/io/tests/data/ds9.fk5.reg new file mode 100644 index 00000000..6a8152a3 --- /dev/null +++ b/regions/io/tests/data/ds9.fk5.reg @@ -0,0 +1,39 @@ +# Region file format: DS9 version 4.1 +global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1 +fk5 +circle(202.48643,47.208449,3.9640007") # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +-ellipse(202.48247,47.204704,7.9280014",3.9640007",2.3983109) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +-box(202.47721,47.201269,15.856003",7.9280014",2.3983109) # color=yellow font="helvetica 10 bold roman" text={Box} +polygon(202.47248,47.199134,202.46815,47.199257,202.46797,47.19632,202.4723,47.196197) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +-line(202.46778,47.194329,202.4614,47.194158) # line=1 1 color=cyan text={Line} +# vector(202.46097,47.191716,7.9280014",2.3983109) vector=1 color=red text={Vector} +# text(202.45846,47.189099) color=magenta font="helvetica 14 bold roman" text={Region} +# ruler(202.48114,47.194378,202.47409,47.194383) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +annulus(202.49257,47.20391,1.9820003",3.9640007",5.946001") # color=magenta font="helvetica 10 bold roman" text={Annulus} +ellipse(202.48772,47.20058,2.9730005",1.4865003",5.946001",2.9730005",2.3983109) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +box(202.48258,47.197298,7.9280014",3.9640007",11.892002",5.946001",2.3983109) # font="helvetica 10 bold roman" text={Box Annulus} +point(202.49809,47.200401) # point=circle text={Circle Point} +point(202.49289,47.197004) # point=box color=red width=3 text={Box Point} +point(202.48795,47.194067) # point=diamond text={Diamond Point} +point(202.49988,47.197856) # point=cross color=blue text={Cross Point} +point(202.49529,47.195065) # point=x text={X Point} +point(202.49086,47.192074) # point=arrow color=magenta text={Arrow Point} +point(202.49802,47.192883) # point=boxcircle text={BoxCircle Point} +# projection(202.47549,47.190096,202.46632,47.189304,3.9640007") text={Projection} +panda(202.48204,47.190378,317.39831,587.39831,3,0",5.946001",2) # text={Panda} +panda(202.48691,47.186615,8.9802109,47.398311,1,0",2.9730005",1) # panda=(8.9802109 47.398311 137.39831 227.39831)(0" 2.9730005" 5.946001") text={Panda 2} +panda(202.48691,47.186615,8.9802109,47.398311,1,2.9730005",5.946001",1) # panda=ignore +panda(202.48691,47.186615,47.398311,137.39831,1,0",2.9730005",1) # panda=ignore +panda(202.48691,47.186615,47.398311,137.39831,1,2.9730005",5.946001",1) # panda=ignore +panda(202.48691,47.186615,137.39831,227.39831,1,0",2.9730005",1) # panda=ignore +panda(202.48691,47.186615,137.39831,227.39831,1,2.9730005",5.946001",1) # panda=ignore +# compass(202.46706,47.1864,7.9280014") compass=physical {N} {E} 1 1 text={Compass} +epanda(202.47759,47.186997,317.39831,587.39831,3,2.9730005",1.4865003",5.946001",2.9730005",1,2.3983109) # text={Epanda} +epanda(202.48229,47.183279,2.3983109,47.398311,1,2.9730005",1.4865003",5.946001",2.9730005",1,2.3983109) # epanda=(2.3983109 47.398311 137.39831 227.39831)(2.9730005" 1.4865003" 5.946001" 2.9730005")(2.3983109) text={Epanda 2} +epanda(202.48229,47.183279,47.398311,137.39831,1,2.9730005",1.4865003",5.946001",2.9730005",1,2.3983109) # epanda=ignore +epanda(202.48229,47.183279,137.39831,227.39831,1,2.9730005",1.4865003",5.946001",2.9730005",1,2.3983109) # epanda=ignore +bpanda(202.47241,47.183755,317.39831,587.39831,3,7.9280014",3.9640007",11.892002",5.946001",1,2.3983109) # text={Bpanda} +bpanda(202.47747,47.180338,2.3983109,47.398311,1,7.9280014",3.9640007",11.892002",5.946001",1,2.3983109) # bpanda=(2.3983109 47.398311 137.39831 227.39831)(7.9280014" 3.9640007" 11.892002" 5.946001")(2.3983109) text={Bpanda 2} +bpanda(202.47747,47.180338,47.398311,137.39831,1,7.9280014",3.9640007",11.892002",5.946001",1,2.3983109) # bpanda=ignore +bpanda(202.47747,47.180338,137.39831,227.39831,1,7.9280014",3.9640007",11.892002",5.946001",1,2.3983109) # bpanda=ignore +# segment(202.45467,47.190998,202.45603,47.188855,202.45448,47.187886) text={Segment} diff --git a/regions/io/tests/test_ds9_language.py b/regions/io/tests/test_ds9_language.py new file mode 100644 index 00000000..8e13ca0c --- /dev/null +++ b/regions/io/tests/test_ds9_language.py @@ -0,0 +1,8 @@ +from __future__ import absolute_import, division, print_function, unicode_literals +from ..ds9_language import ds9_parser +from astropy.utils.data import get_pkg_data_filename + +def test_fk5(): + filename = get_pkg_data_filename('data/ds9.fk5.reg') + regs = ds9_parser(filename) + From 464c33ba562c2ee271d97fd1f4df9038f40ba77b Mon Sep 17 00:00:00 2001 From: Johannes King Date: Thu, 24 Mar 2016 02:20:34 +0100 Subject: [PATCH 15/30] add ds9 writer --- regions/io/ds9_language.py | 56 +++++++++++++++++++++++++-- regions/io/tests/test_ds9_language.py | 15 +++++-- 2 files changed, 65 insertions(+), 6 deletions(-) diff --git a/regions/io/ds9_language.py b/regions/io/ds9_language.py index 8a7d061a..f421527c 100644 --- a/regions/io/ds9_language.py +++ b/regions/io/ds9_language.py @@ -67,7 +67,7 @@ def angular_length_quantity(string_rep): for letter in string.ascii_lowercase: coordinate_units['wcs{0}'.format(letter)] = (u.dimensionless_unscaled, u.dimensionless_unscaled) -region_type_or_coordsys_re = re.compile("#? *([a-zA-Z0-9]+)") +region_type_or_coordsys_re = re.compile("^#? *(-?)([a-zA-Z0-9]+)") paren = re.compile("[()]") @@ -112,13 +112,60 @@ def region_list_to_objects(region_list): return output_list +def objects_to_ds9_string(obj_list, coordsys='fk5'): + """Take a list of regions and generate ds9 region strings""" + + ids = {"": 'circle', + "": 'ellipse', + "": 'polygone'} + + ds9_strings = {'circle': 'circle ({x:.4f},{y:.4f},{r:.4f})\n', + 'ellipse': 'ellipse ({x:.4f},{y:.4f},{r1:.4f},{r2:.4f},{ang:.4f})\n', + 'polygone': 'polygon ({c})\n'} + + output = '# Region file format: DS9 astropy/regions\n' + output += '{}\n'.format(coordsys) + + for reg in obj_list: + temp = str(reg.__class__) + if temp in ids.keys(): + t = ids[temp] + if t == 'circle': + # TODO: Why is circle.center a list of SkyCoords? + x = reg.center.ra.to('deg').value[0] + y = reg.center.dec.to('deg').value[0] + r = reg.radius.to('deg').value + elif t == 'ellipse': + x = reg.center.ra.to('deg').value[0] + y = reg.center.dec.to('deg').value[0] + r1 = reg.major.to('deg').value + r2 = reg.minor.to('deg').value + ang = reg.angle.to('deg').value + elif t == 'polygone': + v = reg.vertices + coords = [(x.to('deg').value, y.to('deg').value) for x in v.ra for y in v.dec] + temp = ["{:.4f}".format(x) for _ in coords for x in _] + c = ", ".join(temp) + + output += ds9_strings[t].format(**locals()) + + return output + + +def write_ds9(obj_list, filename='ds9.reg', coordsys='fk5'): + """Write ds9 region file""" + output = objects_to_ds9_string(obj_list, coordsys) + with open(filename, 'w') as fh: + fh.write(output) + + def ds9_parser(filename): """ Parse a complete ds9 .reg file Returns ------- - list of (region type, coord_list) tuples + list of (region type, coord_list, meta) tuples """ coordsys = None regions = [] @@ -146,10 +193,12 @@ def ds9_parser(filename): return regions + def line_parser(line, coordsys=None): region_type_search = region_type_or_coordsys_re.search(line) if region_type_search: - region_type = region_type_search.groups()[0] + include = region_type_search.groups()[0] + region_type = region_type_search.groups()[1] else: return @@ -193,6 +242,7 @@ def line_parser(line, coordsys=None): parsed_return = [coord]+parsed[2:] return region_type, parsed_return, parsed_meta, composite + def type_parser(string_rep, specification, coordsys): coord_list = [] splitter = re.compile("[, ]") diff --git a/regions/io/tests/test_ds9_language.py b/regions/io/tests/test_ds9_language.py index 8e13ca0c..fa2585a4 100644 --- a/regions/io/tests/test_ds9_language.py +++ b/regions/io/tests/test_ds9_language.py @@ -1,8 +1,17 @@ from __future__ import absolute_import, division, print_function, unicode_literals -from ..ds9_language import ds9_parser + +from numpy.testing import assert_allclose + +from ..ds9_language import ds9_parser, region_list_to_objects, objects_to_ds9_string from astropy.utils.data import get_pkg_data_filename -def test_fk5(): + +def test_fk5(tmpdir): filename = get_pkg_data_filename('data/ds9.fk5.reg') - regs = ds9_parser(filename) + temp = ds9_parser(filename) + regs = region_list_to_objects(temp) + + output = objects_to_ds9_string(regs, coordsys='fk5') + print(output) + From d6c9ebc0216b59dfd03c6dfbc6ec42d63d4e2b76 Mon Sep 17 00:00:00 2001 From: Johannes King Date: Thu, 24 Mar 2016 02:33:19 +0100 Subject: [PATCH 16/30] add test --- regions/io/ds9_language.py | 6 +++--- regions/io/setup_package.py | 3 ++- regions/io/tests/data/fk5_reference.reg | 6 ++++++ regions/io/tests/test_ds9_language.py | 8 +++++--- 4 files changed, 16 insertions(+), 7 deletions(-) create mode 100644 regions/io/tests/data/fk5_reference.reg diff --git a/regions/io/ds9_language.py b/regions/io/ds9_language.py index f421527c..5bc6814d 100644 --- a/regions/io/ds9_language.py +++ b/regions/io/ds9_language.py @@ -119,9 +119,9 @@ def objects_to_ds9_string(obj_list, coordsys='fk5'): "": 'ellipse', "": 'polygone'} - ds9_strings = {'circle': 'circle ({x:.4f},{y:.4f},{r:.4f})\n', - 'ellipse': 'ellipse ({x:.4f},{y:.4f},{r1:.4f},{r2:.4f},{ang:.4f})\n', - 'polygone': 'polygon ({c})\n'} + ds9_strings = {'circle': 'circle({x:.4f},{y:.4f},{r:.4f})\n', + 'ellipse': 'ellipse({x:.4f},{y:.4f},{r1:.4f},{r2:.4f},{ang:.4f})\n', + 'polygone': 'polygon({c})\n'} output = '# Region file format: DS9 astropy/regions\n' output += '{}\n'.format(coordsys) diff --git a/regions/io/setup_package.py b/regions/io/setup_package.py index 9babccf5..b337189f 100644 --- a/regions/io/setup_package.py +++ b/regions/io/setup_package.py @@ -2,5 +2,6 @@ import os def get_package_data(): - parser_test = [os.path.join('data', 'ds9.fk5.reg')] + parser_test = [os.path.join('data', 'ds9.fk5.reg'), + os.path.join('data', 'fk5_reference.reg')] return {'regions.io.tests': parser_test} diff --git a/regions/io/tests/data/fk5_reference.reg b/regions/io/tests/data/fk5_reference.reg new file mode 100644 index 00000000..0154504c --- /dev/null +++ b/regions/io/tests/data/fk5_reference.reg @@ -0,0 +1,6 @@ +# Region file format: DS9 astropy/regions +fk5 +circle(202.4864,47.2084,0.0011) +ellipse(202.4825,47.2047,0.0011,0.0022,2.3983) +polygon(202.4725, 47.1991, 202.4725, 47.1993, 202.4725, 47.1963, 202.4725, 47.1962, 202.4682, 47.1991, 202.4682, 47.1993, 202.4682, 47.1963, 202.4682, 47.1962, 202.4680, 47.1991, 202.4680, 47.1993, 202.4680, 47.1963, 202.4680, 47.1962, 202.4723, 47.1991, 202.4723, 47.1993, 202.4723, 47.1963, 202.4723, 47.1962) +ellipse(202.4877,47.2006,0.0004,0.0008,0.0017) diff --git a/regions/io/tests/test_ds9_language.py b/regions/io/tests/test_ds9_language.py index fa2585a4..f6f3bd26 100644 --- a/regions/io/tests/test_ds9_language.py +++ b/regions/io/tests/test_ds9_language.py @@ -11,7 +11,9 @@ def test_fk5(tmpdir): temp = ds9_parser(filename) regs = region_list_to_objects(temp) - output = objects_to_ds9_string(regs, coordsys='fk5') - print(output) - + actual = objects_to_ds9_string(regs, coordsys='fk5') + reference_file = get_pkg_data_filename('data/fk5_reference.reg') + with open(reference_file, 'r') as fh: + desired = fh.read() + assert actual == desired From 24b34bc1f959c08e0ae21bce55c88675afc0d818 Mon Sep 17 00:00:00 2001 From: Johannes King Date: Thu, 24 Mar 2016 07:40:22 +0100 Subject: [PATCH 17/30] add more tests --- regions/io/ds9_language.py | 17 ++++----- regions/io/setup_package.py | 3 ++ regions/io/tests/data/ds9.fk5.hms.reg | 39 +++++++++++++++++++++ regions/io/tests/data/ds9.fk5.hms.strip.reg | 1 + regions/io/tests/data/ds9.fk5.strip.reg | 1 + regions/io/tests/data/fk5_reference.reg | 8 ++--- regions/io/tests/test_ds9_language.py | 18 ++++++++-- 7 files changed, 72 insertions(+), 15 deletions(-) create mode 100644 regions/io/tests/data/ds9.fk5.hms.reg create mode 100644 regions/io/tests/data/ds9.fk5.hms.strip.reg create mode 100644 regions/io/tests/data/ds9.fk5.strip.reg diff --git a/regions/io/ds9_language.py b/regions/io/ds9_language.py index 5bc6814d..62d33c50 100644 --- a/regions/io/ds9_language.py +++ b/regions/io/ds9_language.py @@ -112,15 +112,15 @@ def region_list_to_objects(region_list): return output_list -def objects_to_ds9_string(obj_list, coordsys='fk5'): +def objects_to_ds9_string(obj_list, coordsys='fk5', fmt='.4f', radunit='arcsec'): """Take a list of regions and generate ds9 region strings""" ids = {"": 'circle', "": 'ellipse', "": 'polygone'} - ds9_strings = {'circle': 'circle({x:.4f},{y:.4f},{r:.4f})\n', - 'ellipse': 'ellipse({x:.4f},{y:.4f},{r1:.4f},{r2:.4f},{ang:.4f})\n', + ds9_strings = {'circle': 'circle({x:'+fmt+'},{y:'+fmt+'},{r:'+fmt+'}")\n', + 'ellipse': 'ellipse({x:'+fmt+'},{y:'+fmt+'},{r1:'+fmt+'}",{r2:'+fmt+'}",{ang:'+fmt+'})\n', 'polygone': 'polygon({c})\n'} output = '# Region file format: DS9 astropy/regions\n' @@ -134,17 +134,18 @@ def objects_to_ds9_string(obj_list, coordsys='fk5'): # TODO: Why is circle.center a list of SkyCoords? x = reg.center.ra.to('deg').value[0] y = reg.center.dec.to('deg').value[0] - r = reg.radius.to('deg').value + r = reg.radius.to(radunit).value elif t == 'ellipse': x = reg.center.ra.to('deg').value[0] y = reg.center.dec.to('deg').value[0] - r1 = reg.major.to('deg').value - r2 = reg.minor.to('deg').value + r1 = reg.major.to(radunit).value + r2 = reg.minor.to(radunit).value ang = reg.angle.to('deg').value elif t == 'polygone': v = reg.vertices - coords = [(x.to('deg').value, y.to('deg').value) for x in v.ra for y in v.dec] - temp = ["{:.4f}".format(x) for _ in coords for x in _] + coords = [(x.to('deg').value, y.to('deg').value) for x,y in zip(v.ra, v.dec)] + val = "{:"+fmt+"}" + temp = [val.format(x) for _ in coords for x in _] c = ", ".join(temp) output += ds9_strings[t].format(**locals()) diff --git a/regions/io/setup_package.py b/regions/io/setup_package.py index b337189f..f9825e03 100644 --- a/regions/io/setup_package.py +++ b/regions/io/setup_package.py @@ -3,5 +3,8 @@ def get_package_data(): parser_test = [os.path.join('data', 'ds9.fk5.reg'), + os.path.join('data', 'ds9.fk5.strip.reg'), + os.path.join('data', 'ds9.fk5.hms.reg'), + os.path.join('data', 'ds9.fk5.hms.strip.reg'), os.path.join('data', 'fk5_reference.reg')] return {'regions.io.tests': parser_test} diff --git a/regions/io/tests/data/ds9.fk5.hms.reg b/regions/io/tests/data/ds9.fk5.hms.reg new file mode 100644 index 00000000..302443fa --- /dev/null +++ b/regions/io/tests/data/ds9.fk5.hms.reg @@ -0,0 +1,39 @@ +# Region file format: DS9 version 4.1 +global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1 +fk5 +circle(13:29:56.743,+47:12:30.42,3.964") # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +-ellipse(13:29:55.792,+47:12:16.94,7.928",3.964",2.39831) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +-box(13:29:54.530,+47:12:04.57,15.856",7.928",2.39831) # color=yellow font="helvetica 10 bold roman" text={Box} +polygon(13:29:53.394,+47:11:56.88,13:29:52.357,+47:11:57.32,13:29:52.314,+47:11:46.75,13:29:53.351,+47:11:46.31) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +-line(13:29:52.267,+47:11:39.58,13:29:50.737,+47:11:38.97) # line=1 1 color=cyan text={Line} +# vector(13:29:50.632,+47:11:30.18,7.928",2.39831) vector=1 color=red text={Vector} +# text(13:29:50.030,+47:11:20.75) color=magenta font="helvetica 14 bold roman" text={Region} +# ruler(13:29:55.474,+47:11:39.76,13:29:53.782,+47:11:39.78) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +annulus(13:29:58.217,+47:12:14.07,1.982",3.964",5.946") # color=magenta font="helvetica 10 bold roman" text={Annulus} +ellipse(13:29:57.053,+47:12:02.09,2.973",1.4865",5.946",2.973",2.39831) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +box(13:29:55.820,+47:11:50.27,7.928",3.964",11.892",5.946",2.39831) # font="helvetica 10 bold roman" text={Box Annulus} +point(13:29:59.541,+47:12:01.44) # point=circle text={Circle Point} +point(13:29:58.293,+47:11:49.21) # point=box color=red width=3 text={Box Point} +point(13:29:57.107,+47:11:38.64) # point=diamond text={Diamond Point} +point(13:29:59.971,+47:11:52.28) # point=cross color=blue text={Cross Point} +point(13:29:58.870,+47:11:42.23) # point=x text={X Point} +point(13:29:57.807,+47:11:31.47) # point=arrow color=magenta text={Arrow Point} +point(13:29:59.526,+47:11:34.38) # point=boxcircle text={BoxCircle Point} +# projection(13:29:54.118,+47:11:24.35,13:29:51.918,+47:11:21.50,3.964") text={Projection} +panda(13:29:55.690,+47:11:25.36,317.398,587.398,3,0",5.946",2) # text={Panda} +panda(13:29:56.859,+47:11:11.81,8.98021,47.3983,1,0",2.973",1) # panda=(8.98021 47.3983 137.398 227.398)(0" 2.973" 5.946") text={Panda 2} +panda(13:29:56.859,+47:11:11.81,8.98021,47.3983,1,2.973",5.946",1) # panda=ignore +panda(13:29:56.859,+47:11:11.81,47.3983,137.398,1,0",2.973",1) # panda=ignore +panda(13:29:56.859,+47:11:11.81,47.3983,137.398,1,2.973",5.946",1) # panda=ignore +panda(13:29:56.859,+47:11:11.81,137.398,227.398,1,0",2.973",1) # panda=ignore +panda(13:29:56.859,+47:11:11.81,137.398,227.398,1,2.973",5.946",1) # panda=ignore +# compass(13:29:52.095,+47:11:11.04,7.928") compass=physical {N} {E} 1 1 text={Compass} +epanda(13:29:54.622,+47:11:13.19,317.398,587.398,3,2.973",1.4865",5.946",2.973",1,2.39831) # text={Epanda} +epanda(13:29:55.750,+47:10:59.80,2.39831,47.3983,1,2.973",1.4865",5.946",2.973",1,2.39831) # epanda=(2.39831 47.3983 137.398 227.398)(2.973" 1.4865" 5.946" 2.973")(2.39831) text={Epanda 2} +epanda(13:29:55.750,+47:10:59.80,47.3983,137.398,1,2.973",1.4865",5.946",2.973",1,2.39831) # epanda=ignore +epanda(13:29:55.750,+47:10:59.80,137.398,227.398,1,2.973",1.4865",5.946",2.973",1,2.39831) # epanda=ignore +bpanda(13:29:53.377,+47:11:01.52,317.398,587.398,3,7.928",3.964",11.892",5.946",1,2.39831) # text={Bpanda} +bpanda(13:29:54.593,+47:10:49.22,2.39831,47.3983,1,7.928",3.964",11.892",5.946",1,2.39831) # bpanda=(2.39831 47.3983 137.398 227.398)(7.928" 3.964" 11.892" 5.946")(2.39831) text={Bpanda 2} +bpanda(13:29:54.593,+47:10:49.22,47.3983,137.398,1,7.928",3.964",11.892",5.946",1,2.39831) # bpanda=ignore +bpanda(13:29:54.593,+47:10:49.22,137.398,227.398,1,7.928",3.964",11.892",5.946",1,2.39831) # bpanda=ignore +# segment(13:29:49.122,+47:11:27.59,13:29:49.448,+47:11:19.88,13:29:49.076,+47:11:16.39) text={Segment} diff --git a/regions/io/tests/data/ds9.fk5.hms.strip.reg b/regions/io/tests/data/ds9.fk5.hms.strip.reg new file mode 100644 index 00000000..1c97a4b6 --- /dev/null +++ b/regions/io/tests/data/ds9.fk5.hms.strip.reg @@ -0,0 +1 @@ +fk5;circle(13:29:56.743,+47:12:30.42,3.964");-ellipse(13:29:55.792,+47:12:16.94,7.928",3.964",2.39831);-box(13:29:54.530,+47:12:04.57,15.856",7.928",2.39831);polygon(13:29:53.394,+47:11:56.88,13:29:52.357,+47:11:57.32,13:29:52.314,+47:11:46.75,13:29:53.351,+47:11:46.31);-line(13:29:52.267,+47:11:39.58,13:29:50.737,+47:11:38.97);annulus(13:29:58.217,+47:12:14.07,1.982",3.964",5.946");ellipse(13:29:57.053,+47:12:02.09,2.973",1.4865",5.946",2.973",2.39831);box(13:29:55.820,+47:11:50.27,7.928",3.964",11.892",5.946",2.39831);point(13:29:59.541,+47:12:01.44);point(13:29:58.293,+47:11:49.21);point(13:29:57.107,+47:11:38.64);point(13:29:59.971,+47:11:52.28);point(13:29:58.870,+47:11:42.23);point(13:29:57.807,+47:11:31.47);point(13:29:59.526,+47:11:34.38);panda(13:29:55.690,+47:11:25.36,317.398,587.398,3,0",5.946",2);panda(13:29:56.859,+47:11:11.81,8.98021,47.3983,1,0",2.973",1);panda(13:29:56.859,+47:11:11.81,8.98021,47.3983,1,2.973",5.946",1);panda(13:29:56.859,+47:11:11.81,47.3983,137.398,1,0",2.973",1);panda(13:29:56.859,+47:11:11.81,47.3983,137.398,1,2.973",5.946",1);panda(13:29:56.859,+47:11:11.81,137.398,227.398,1,0",2.973",1);panda(13:29:56.859,+47:11:11.81,137.398,227.398,1,2.973",5.946",1);epanda(13:29:54.622,+47:11:13.19,317.398,587.398,3,2.973",1.4865",5.946",2.973",1,2.39831);epanda(13:29:55.750,+47:10:59.80,2.39831,47.3983,1,2.973",1.4865",5.946",2.973",1,2.39831);epanda(13:29:55.750,+47:10:59.80,47.3983,137.398,1,2.973",1.4865",5.946",2.973",1,2.39831);epanda(13:29:55.750,+47:10:59.80,137.398,227.398,1,2.973",1.4865",5.946",2.973",1,2.39831);bpanda(13:29:53.377,+47:11:01.52,317.398,587.398,3,7.928",3.964",11.892",5.946",1,2.39831);bpanda(13:29:54.593,+47:10:49.22,2.39831,47.3983,1,7.928",3.964",11.892",5.946",1,2.39831);bpanda(13:29:54.593,+47:10:49.22,47.3983,137.398,1,7.928",3.964",11.892",5.946",1,2.39831);bpanda(13:29:54.593,+47:10:49.22,137.398,227.398,1,7.928",3.964",11.892",5.946",1,2.39831); \ No newline at end of file diff --git a/regions/io/tests/data/ds9.fk5.strip.reg b/regions/io/tests/data/ds9.fk5.strip.reg new file mode 100644 index 00000000..78afd15b --- /dev/null +++ b/regions/io/tests/data/ds9.fk5.strip.reg @@ -0,0 +1 @@ +fk5;circle(202.48643,47.208449,3.9640007");-ellipse(202.48247,47.204704,7.9280014",3.9640007",2.3983109);-box(202.47721,47.201269,15.856003",7.9280014",2.3983109);polygon(202.47248,47.199134,202.46815,47.199257,202.46797,47.19632,202.4723,47.196197);-line(202.46778,47.194329,202.4614,47.194158);annulus(202.49257,47.20391,1.9820003",3.9640007",5.946001");ellipse(202.48772,47.20058,2.9730005",1.4865003",5.946001",2.9730005",2.3983109);box(202.48258,47.197298,7.9280014",3.9640007",11.892002",5.946001",2.3983109);point(202.49809,47.200401);point(202.49289,47.197004);point(202.48795,47.194067);point(202.49988,47.197856);point(202.49529,47.195065);point(202.49086,47.192074);point(202.49802,47.192883);panda(202.48204,47.190378,317.39831,587.39831,3,0",5.946001",2);panda(202.48691,47.186615,8.9802109,47.398311,1,0",2.9730005",1);panda(202.48691,47.186615,8.9802109,47.398311,1,2.9730005",5.946001",1);panda(202.48691,47.186615,47.398311,137.39831,1,0",2.9730005",1);panda(202.48691,47.186615,47.398311,137.39831,1,2.9730005",5.946001",1);panda(202.48691,47.186615,137.39831,227.39831,1,0",2.9730005",1);panda(202.48691,47.186615,137.39831,227.39831,1,2.9730005",5.946001",1);epanda(202.47759,47.186997,317.39831,587.39831,3,2.9730005",1.4865003",5.946001",2.9730005",1,2.3983109);epanda(202.48229,47.183279,2.3983109,47.398311,1,2.9730005",1.4865003",5.946001",2.9730005",1,2.3983109);epanda(202.48229,47.183279,47.398311,137.39831,1,2.9730005",1.4865003",5.946001",2.9730005",1,2.3983109);epanda(202.48229,47.183279,137.39831,227.39831,1,2.9730005",1.4865003",5.946001",2.9730005",1,2.3983109);bpanda(202.47241,47.183755,317.39831,587.39831,3,7.9280014",3.9640007",11.892002",5.946001",1,2.3983109);bpanda(202.47747,47.180338,2.3983109,47.398311,1,7.9280014",3.9640007",11.892002",5.946001",1,2.3983109);bpanda(202.47747,47.180338,47.398311,137.39831,1,7.9280014",3.9640007",11.892002",5.946001",1,2.3983109);bpanda(202.47747,47.180338,137.39831,227.39831,1,7.9280014",3.9640007",11.892002",5.946001",1,2.3983109); \ No newline at end of file diff --git a/regions/io/tests/data/fk5_reference.reg b/regions/io/tests/data/fk5_reference.reg index 0154504c..3123a0e2 100644 --- a/regions/io/tests/data/fk5_reference.reg +++ b/regions/io/tests/data/fk5_reference.reg @@ -1,6 +1,6 @@ # Region file format: DS9 astropy/regions fk5 -circle(202.4864,47.2084,0.0011) -ellipse(202.4825,47.2047,0.0011,0.0022,2.3983) -polygon(202.4725, 47.1991, 202.4725, 47.1993, 202.4725, 47.1963, 202.4725, 47.1962, 202.4682, 47.1991, 202.4682, 47.1993, 202.4682, 47.1963, 202.4682, 47.1962, 202.4680, 47.1991, 202.4680, 47.1993, 202.4680, 47.1963, 202.4680, 47.1962, 202.4723, 47.1991, 202.4723, 47.1993, 202.4723, 47.1963, 202.4723, 47.1962) -ellipse(202.4877,47.2006,0.0004,0.0008,0.0017) +circle(202.49,47.21,3.96") +ellipse(202.48,47.20,3.96",7.93",2.40) +polygon(202.47, 47.20, 202.47, 47.20, 202.47, 47.20, 202.47, 47.20) +ellipse(202.49,47.20,1.49",2.97",0.00) diff --git a/regions/io/tests/test_ds9_language.py b/regions/io/tests/test_ds9_language.py index f6f3bd26..fd6ec533 100644 --- a/regions/io/tests/test_ds9_language.py +++ b/regions/io/tests/test_ds9_language.py @@ -4,14 +4,26 @@ from ..ds9_language import ds9_parser, region_list_to_objects, objects_to_ds9_string from astropy.utils.data import get_pkg_data_filename +from astropy.tests.helper import pytest -def test_fk5(tmpdir): - filename = get_pkg_data_filename('data/ds9.fk5.reg') +@pytest.mark.parametrize('filename', + ['data/ds9.fk5.reg', + 'data/ds9.fk5.hms.reg', + 'data/ds9.fk5.hms.strip.reg', + 'data/ds9.fk5.strip.reg']) + +def test_fk5(filename): + filename = get_pkg_data_filename(filename) temp = ds9_parser(filename) regs = region_list_to_objects(temp) - actual = objects_to_ds9_string(regs, coordsys='fk5') + actual = objects_to_ds9_string(regs, coordsys='fk5', fmt='.2f') + + # Use this to produce reference file for now + # print(actual) + # 1/0 + reference_file = get_pkg_data_filename('data/fk5_reference.reg') with open(reference_file, 'r') as fh: desired = fh.read() From 76b597ac4707140a3ae640eb9a58beaad9a33940 Mon Sep 17 00:00:00 2001 From: Johannes King Date: Thu, 24 Mar 2016 19:36:05 +0100 Subject: [PATCH 18/30] handle elliptical annulus correctly and test galactic coords inputs --- regions/io/ds9_language.py | 36 +++++++++-------- regions/io/setup_package.py | 8 +++- regions/io/tests/data/ds9.galactic.hms.reg | 39 +++++++++++++++++++ .../io/tests/data/ds9.galactic.hms.strip.reg | 1 + regions/io/tests/data/ds9.galactic.reg | 39 +++++++++++++++++++ regions/io/tests/data/ds9.galactic.strip.reg | 1 + regions/io/tests/data/fk5_reference.reg | 3 +- regions/io/tests/data/galactic_reference.reg | 5 +++ regions/io/tests/test_ds9_language.py | 36 +++++++++++++---- 9 files changed, 142 insertions(+), 26 deletions(-) create mode 100644 regions/io/tests/data/ds9.galactic.hms.reg create mode 100644 regions/io/tests/data/ds9.galactic.hms.strip.reg create mode 100644 regions/io/tests/data/ds9.galactic.reg create mode 100644 regions/io/tests/data/ds9.galactic.strip.reg create mode 100644 regions/io/tests/data/galactic_reference.reg diff --git a/regions/io/ds9_language.py b/regions/io/ds9_language.py index 62d33c50..fa004c69 100644 --- a/regions/io/ds9_language.py +++ b/regions/io/ds9_language.py @@ -42,7 +42,8 @@ def angular_length_quantity(string_rep): language_spec = {'point': (coordinate, coordinate), 'circle': (coordinate, coordinate, radius), - 'ellipse': (coordinate, coordinate, width, height, angle), + # This is a special case to deal with n elliptical annuli + 'ellipse': itertools.chain((coordinate, coordinate), itertools.cycle((radius, ))), 'box': (coordinate, coordinate, width, height, angle), 'polygon': itertools.cycle((coordinate, )), } @@ -90,6 +91,9 @@ def region_list_to_objects(region_list): raise ValueError("No central coordinate") elif region_type == 'ellipse': if isinstance(coord_list[0], coordinates.SkyCoord): + # Do not read elliptical annuli for now + if len(coord_list) > 4: + continue output_list.append(ellipse.EllipseSkyRegion(coord_list[0], coord_list[1], coord_list[2], coord_list[3])) elif isinstance(coord_list[0], PixCoord): output_list.append(ellipse.EllipsePixelRegion(coord_list[0], coord_list[1], coord_list[2], coord_list[3])) @@ -132,18 +136,19 @@ def objects_to_ds9_string(obj_list, coordsys='fk5', fmt='.4f', radunit='arcsec') t = ids[temp] if t == 'circle': # TODO: Why is circle.center a list of SkyCoords? - x = reg.center.ra.to('deg').value[0] - y = reg.center.dec.to('deg').value[0] + x = reg.center.transform_to(coordsys).spherical.lon.to('deg').value[0] + y = reg.center.transform_to(coordsys).spherical.lat.to('deg').value[0] r = reg.radius.to(radunit).value elif t == 'ellipse': - x = reg.center.ra.to('deg').value[0] - y = reg.center.dec.to('deg').value[0] - r1 = reg.major.to(radunit).value - r2 = reg.minor.to(radunit).value + x = reg.center.transform_to(coordsys).spherical.lon.to('deg').value[0] + y = reg.center.transform_to(coordsys).spherical.lat.to('deg').value[0] + r2 = reg.major.to(radunit).value + r1 = reg.minor.to(radunit).value ang = reg.angle.to('deg').value elif t == 'polygone': - v = reg.vertices - coords = [(x.to('deg').value, y.to('deg').value) for x,y in zip(v.ra, v.dec)] + v = reg.vertices.transform_to(coordsys) + coords = [(x.to('deg').value, y.to('deg').value) for x, y in + zip(v.spherical.lon, v.spherical.lat)] val = "{:"+fmt+"}" temp = [val.format(x) for _ in coords for x in _] c = ", ".join(temp) @@ -227,10 +232,16 @@ def line_parser(line, coordsys=None): if coordsys in coordsys_name_mapping: parsed = type_parser(coords_etc, language_spec[region_type], coordsys_name_mapping[coordsys]) + + # Reset iterator for ellipse annulus + if region_type == 'ellipse': + language_spec[region_type] = itertools.chain((coordinate, coordinate), itertools.cycle((radius, ))) + coords = coordinates.SkyCoord([(x, y) for x, y in zip(parsed[:-1:2], parsed[1::2]) if isinstance(x, coordinates.Angle) and isinstance(x, coordinates.Angle)], frame=coordsys_name_mapping[coordsys]) + return region_type, [coords] + parsed[len(coords)*2:], parsed_meta, composite else: parsed = type_parser(coords_etc, language_spec[region_type], @@ -277,10 +288,3 @@ def meta_parser(meta_str): return result -if __name__ == "__main__": - # simple tests for now... - import glob - results = {} - for fn in glob.glob('/Users/adam/Downloads/tests/regions/*.reg'): - print(fn) - results[fn] = ds9_parser(fn) diff --git a/regions/io/setup_package.py b/regions/io/setup_package.py index f9825e03..7e18d9ab 100644 --- a/regions/io/setup_package.py +++ b/regions/io/setup_package.py @@ -6,5 +6,11 @@ def get_package_data(): os.path.join('data', 'ds9.fk5.strip.reg'), os.path.join('data', 'ds9.fk5.hms.reg'), os.path.join('data', 'ds9.fk5.hms.strip.reg'), - os.path.join('data', 'fk5_reference.reg')] + os.path.join('data', 'fk5_reference.reg'), + os.path.join('data', 'ds9.galactic.reg'), + os.path.join('data', 'ds9.galactic.strip.reg'), + os.path.join('data', 'ds9.galactic.hms.reg'), + os.path.join('data', 'ds9.galactic.hms.strip.reg'), + os.path.join('data', 'galactic_reference.reg')] + return {'regions.io.tests': parser_test} diff --git a/regions/io/tests/data/ds9.galactic.hms.reg b/regions/io/tests/data/ds9.galactic.hms.reg new file mode 100644 index 00000000..1c8dc3f8 --- /dev/null +++ b/regions/io/tests/data/ds9.galactic.hms.reg @@ -0,0 +1,39 @@ +# Region file format: DS9 version 4.1 +global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1 +galactic +circle(+104:50:15.532,+68:32:38.380,3.964") # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +-ellipse(+104:50:24.720,+68:32:54.634,7.928",3.964",158.389) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +-box(+104:50:43.097,+68:33:11.163,15.856",7.928",158.389) # color=yellow font="helvetica 10 bold roman" text={Box} +polygon(+104:51:03.480,+68:33:22.893,+104:51:30.395,+68:33:26.787,+104:51:19.743,+68:33:36.626,+104:50:52.826,+68:33:32.732) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +-line(+104:51:12.957,+68:33:43.369,+104:51:51.267,+68:33:50.265) # line=1 1 color=cyan text={Line} +# vector(+104:51:44.162,+68:33:58.733,7.928",158.389) vector=1 color=red text={Vector} +# text(+104:51:49.050,+68:34:09.839) color=magenta font="helvetica 14 bold roman" text={Region} +# ruler(+104:49:51.449,+68:33:29.913,+104:50:34.587,+68:33:36.913) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +annulus(+104:49:19.827,+68:32:47.191,1.982",3.964",5.946") # color=magenta font="helvetica 10 bold roman" text={Annulus} +ellipse(+104:49:36.118,+68:33:02.969,2.973",1.4865",5.946",2.973",158.389) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +box(+104:49:54.339,+68:33:18.875,7.928",3.964",11.892",5.946",158.389) # font="helvetica 10 bold roman" text={Box Annulus} +point(+104:48:32.059,+68:32:53.230) # point=circle text={Circle Point} +point(+104:48:50.197,+68:33:09.580) # point=box color=red width=3 text={Box Point} +point(+104:49:08.613,+68:33:24.159) # point=diamond text={Diamond Point} +point(+104:48:10.904,+68:32:59.810) # point=cross color=blue text={Cross Point} +point(+104:48:27.737,+68:33:13.560) # point=x text={X Point} +point(+104:48:42.801,+68:33:27.806) # point=arrow color=magenta text={Arrow Point} +point(+104:48:02.289,+68:33:18.011) # point=boxcircle text={BoxCircle Point} +# projection(+104:50:08.859,+68:33:49.619,+104:51:01.742,+68:34:01.341,3.964") text={Projection} +panda(+104:49:29.913,+68:33:42.170,113.389,383.389,3,0",5.946",2) # text={Panda} +panda(+104:48:45.044,+68:33:49.690,164.971,203.389,1,0",2.973",1) # panda=(164.971 203.389 293.389 23.3893)(0" 2.973" 5.946") text={Panda 2} +panda(+104:48:45.044,+68:33:49.690,164.971,203.389,1,2.973",5.946",1) # panda=ignore +panda(+104:48:45.044,+68:33:49.690,203.389,293.389,1,0",2.973",1) # panda=ignore +panda(+104:48:45.044,+68:33:49.690,203.389,293.389,1,2.973",5.946",1) # panda=ignore +panda(+104:48:45.044,+68:33:49.690,293.389,383.389,1,0",2.973",1) # panda=ignore +panda(+104:48:45.044,+68:33:49.690,293.389,383.389,1,2.973",5.946",1) # panda=ignore +# compass(+104:50:45.588,+68:34:10.159,7.928") compass=physical {N} {E} 1 1 text={Compass} +epanda(+104:49:43.580,+68:33:57.717,113.389,383.389,3,2.973",1.4865",5.946",2.973",1,158.389) # text={Epanda} +epanda(+104:48:59.915,+68:34:05.263,158.389,203.389,1,2.973",1.4865",5.946",2.973",1,158.389) # epanda=(158.389 203.389 293.389 23.3893)(2.973" 1.4865" 5.946" 2.973")(158.389) text={Epanda 2} +epanda(+104:48:59.915,+68:34:05.263,203.389,293.389,1,2.973",1.4865",5.946",2.973",1,158.389) # epanda=ignore +epanda(+104:48:59.915,+68:34:05.263,293.389,383.389,1,2.973",1.4865",5.946",2.973",1,158.389) # epanda=ignore +bpanda(+104:50:02.312,+68:34:13.544,113.389,383.389,3,7.928",3.964",11.892",5.946",1,158.389) # text={Bpanda} +bpanda(+104:49:17.632,+68:34:19.739,158.389,203.389,1,7.928",3.964",11.892",5.946",1,158.389) # bpanda=(158.389 203.389 293.389 23.3893)(7.928" 3.964" 11.892" 5.946")(158.389) text={Bpanda 2} +bpanda(+104:49:17.632,+68:34:19.739,203.389,293.389,1,7.928",3.964",11.892",5.946",1,158.389) # bpanda=ignore +bpanda(+104:49:17.632,+68:34:19.739,293.389,383.389,1,7.928",3.964",11.892",5.946",1,158.389) # bpanda=ignore +# segment(+104:52:19.792,+68:34:07.349,+104:52:02.900,+68:34:13.047,+104:52:08.507,+68:34:17.775) text={Segment} diff --git a/regions/io/tests/data/ds9.galactic.hms.strip.reg b/regions/io/tests/data/ds9.galactic.hms.strip.reg new file mode 100644 index 00000000..af30ccbe --- /dev/null +++ b/regions/io/tests/data/ds9.galactic.hms.strip.reg @@ -0,0 +1 @@ +galactic;circle(+104:50:15.532,+68:32:38.380,3.964");-ellipse(+104:50:24.720,+68:32:54.634,7.928",3.964",158.389);-box(+104:50:43.097,+68:33:11.163,15.856",7.928",158.389);polygon(+104:51:03.480,+68:33:22.893,+104:51:30.395,+68:33:26.787,+104:51:19.743,+68:33:36.626,+104:50:52.826,+68:33:32.732);-line(+104:51:12.957,+68:33:43.369,+104:51:51.267,+68:33:50.265);annulus(+104:49:19.827,+68:32:47.191,1.982",3.964",5.946");ellipse(+104:49:36.118,+68:33:02.969,2.973",1.4865",5.946",2.973",158.389);box(+104:49:54.339,+68:33:18.875,7.928",3.964",11.892",5.946",158.389);point(+104:48:32.059,+68:32:53.230);point(+104:48:50.197,+68:33:09.580);point(+104:49:08.613,+68:33:24.159);point(+104:48:10.904,+68:32:59.810);point(+104:48:27.737,+68:33:13.560);point(+104:48:42.801,+68:33:27.806);point(+104:48:02.289,+68:33:18.011);panda(+104:49:29.913,+68:33:42.170,113.389,383.389,3,0",5.946",2);panda(+104:48:45.044,+68:33:49.690,164.971,203.389,1,0",2.973",1);panda(+104:48:45.044,+68:33:49.690,164.971,203.389,1,2.973",5.946",1);panda(+104:48:45.044,+68:33:49.690,203.389,293.389,1,0",2.973",1);panda(+104:48:45.044,+68:33:49.690,203.389,293.389,1,2.973",5.946",1);panda(+104:48:45.044,+68:33:49.690,293.389,383.389,1,0",2.973",1);panda(+104:48:45.044,+68:33:49.690,293.389,383.389,1,2.973",5.946",1);epanda(+104:49:43.580,+68:33:57.717,113.389,383.389,3,2.973",1.4865",5.946",2.973",1,158.389);epanda(+104:48:59.915,+68:34:05.263,158.389,203.389,1,2.973",1.4865",5.946",2.973",1,158.389);epanda(+104:48:59.915,+68:34:05.263,203.389,293.389,1,2.973",1.4865",5.946",2.973",1,158.389);epanda(+104:48:59.915,+68:34:05.263,293.389,383.389,1,2.973",1.4865",5.946",2.973",1,158.389);bpanda(+104:50:02.312,+68:34:13.544,113.389,383.389,3,7.928",3.964",11.892",5.946",1,158.389);bpanda(+104:49:17.632,+68:34:19.739,158.389,203.389,1,7.928",3.964",11.892",5.946",1,158.389);bpanda(+104:49:17.632,+68:34:19.739,203.389,293.389,1,7.928",3.964",11.892",5.946",1,158.389);bpanda(+104:49:17.632,+68:34:19.739,293.389,383.389,1,7.928",3.964",11.892",5.946",1,158.389); \ No newline at end of file diff --git a/regions/io/tests/data/ds9.galactic.reg b/regions/io/tests/data/ds9.galactic.reg new file mode 100644 index 00000000..6c42f8d0 --- /dev/null +++ b/regions/io/tests/data/ds9.galactic.reg @@ -0,0 +1,39 @@ +# Region file format: DS9 version 4.1 +global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1 +galactic +circle(104.83765,68.543994,3.9640007") # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +-ellipse(104.8402,68.54851,7.9280014",3.9640007",158.38935) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +-box(104.8453,68.553101,15.856003",7.9280014",158.38935) # color=yellow font="helvetica 10 bold roman" text={Box} +polygon(104.85097,68.556359,104.85844,68.557441,104.85548,68.560174,104.84801,68.559092) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +-line(104.8536,68.562047,104.86424,68.563963) # line=1 1 color=cyan text={Line} +# vector(104.86227,68.566315,7.9280014",158.38935) vector=1 color=red text={Vector} +# text(104.86363,68.5694) color=magenta font="helvetica 14 bold roman" text={Region} +# ruler(104.83096,68.558309,104.84294,68.560253) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +annulus(104.82217,68.546442,1.9820003",3.9640007",5.946001") # color=magenta font="helvetica 10 bold roman" text={Annulus} +ellipse(104.8267,68.550825,2.9730005",1.4865003",5.946001",2.9730005",158.38935) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +box(104.83176,68.555243,7.9280014",3.9640007",11.892002",5.946001",158.38935) # font="helvetica 10 bold roman" text={Box Annulus} +point(104.80891,68.548119) # point=circle text={Circle Point} +point(104.81394,68.552661) # point=box color=red width=3 text={Box Point} +point(104.81906,68.556711) # point=diamond text={Diamond Point} +point(104.80303,68.549947) # point=cross color=blue text={Cross Point} +point(104.8077,68.553767) # point=x text={X Point} +point(104.81189,68.557724) # point=arrow color=magenta text={Arrow Point} +point(104.80064,68.555003) # point=boxcircle text={BoxCircle Point} +# projection(104.83579,68.563783,104.85048,68.567039,3.9640007") text={Projection} +panda(104.82498,68.561714,113.38935,383.38935,3,0",5.946001",2) # text={Panda} +panda(104.81251,68.563803,164.97125,203.38935,1,0",2.9730005",1) # panda=(164.97125 203.38935 293.38935 23.389346)(0" 2.9730005" 5.946001") text={Panda 2} +panda(104.81251,68.563803,164.97125,203.38935,1,2.9730005",5.946001",1) # panda=ignore +panda(104.81251,68.563803,203.38935,293.38935,1,0",2.9730005",1) # panda=ignore +panda(104.81251,68.563803,203.38935,293.38935,1,2.9730005",5.946001",1) # panda=ignore +panda(104.81251,68.563803,293.38935,383.38935,1,0",2.9730005",1) # panda=ignore +panda(104.81251,68.563803,293.38935,383.38935,1,2.9730005",5.946001",1) # panda=ignore +# compass(104.846,68.569488,7.9280014") compass=physical {N} {E} 1 1 text={Compass} +epanda(104.82877,68.566033,113.38935,383.38935,3,2.9730005",1.4865003",5.946001",2.9730005",1,158.38935) # text={Epanda} +epanda(104.81664,68.568129,158.38935,203.38935,1,2.9730005",1.4865003",5.946001",2.9730005",1,158.38935) # epanda=(158.38935 203.38935 293.38935 23.389346)(2.9730005" 1.4865003" 5.946001" 2.9730005")(158.38935) text={Epanda 2} +epanda(104.81664,68.568129,203.38935,293.38935,1,2.9730005",1.4865003",5.946001",2.9730005",1,158.38935) # epanda=ignore +epanda(104.81664,68.568129,293.38935,383.38935,1,2.9730005",1.4865003",5.946001",2.9730005",1,158.38935) # epanda=ignore +bpanda(104.83398,68.570429,113.38935,383.38935,3,7.9280014",3.9640007",11.892002",5.946001",1,158.38935) # text={Bpanda} +bpanda(104.82156,68.57215,158.38935,203.38935,1,7.9280014",3.9640007",11.892002",5.946001",1,158.38935) # bpanda=(158.38935 203.38935 293.38935 23.389346)(7.9280014" 3.9640007" 11.892002" 5.946001")(158.38935) text={Bpanda 2} +bpanda(104.82156,68.57215,203.38935,293.38935,1,7.9280014",3.9640007",11.892002",5.946001",1,158.38935) # bpanda=ignore +bpanda(104.82156,68.57215,293.38935,383.38935,1,7.9280014",3.9640007",11.892002",5.946001",1,158.38935) # bpanda=ignore +# segment(104.87216,68.568708,104.86747,68.570291,104.86903,68.571604) text={Segment} diff --git a/regions/io/tests/data/ds9.galactic.strip.reg b/regions/io/tests/data/ds9.galactic.strip.reg new file mode 100644 index 00000000..5ea05f73 --- /dev/null +++ b/regions/io/tests/data/ds9.galactic.strip.reg @@ -0,0 +1 @@ +galactic;circle(104.83765,68.543994,3.9640007");-ellipse(104.8402,68.54851,7.9280014",3.9640007",158.38935);-box(104.8453,68.553101,15.856003",7.9280014",158.38935);polygon(104.85097,68.556359,104.85844,68.557441,104.85548,68.560174,104.84801,68.559092);-line(104.8536,68.562047,104.86424,68.563963);annulus(104.82217,68.546442,1.9820003",3.9640007",5.946001");ellipse(104.8267,68.550825,2.9730005",1.4865003",5.946001",2.9730005",158.38935);box(104.83176,68.555243,7.9280014",3.9640007",11.892002",5.946001",158.38935);point(104.80891,68.548119);point(104.81394,68.552661);point(104.81906,68.556711);point(104.80303,68.549947);point(104.8077,68.553767);point(104.81189,68.557724);point(104.80064,68.555003);panda(104.82498,68.561714,113.38935,383.38935,3,0",5.946001",2);panda(104.81251,68.563803,164.97125,203.38935,1,0",2.9730005",1);panda(104.81251,68.563803,164.97125,203.38935,1,2.9730005",5.946001",1);panda(104.81251,68.563803,203.38935,293.38935,1,0",2.9730005",1);panda(104.81251,68.563803,203.38935,293.38935,1,2.9730005",5.946001",1);panda(104.81251,68.563803,293.38935,383.38935,1,0",2.9730005",1);panda(104.81251,68.563803,293.38935,383.38935,1,2.9730005",5.946001",1);epanda(104.82877,68.566033,113.38935,383.38935,3,2.9730005",1.4865003",5.946001",2.9730005",1,158.38935);epanda(104.81664,68.568129,158.38935,203.38935,1,2.9730005",1.4865003",5.946001",2.9730005",1,158.38935);epanda(104.81664,68.568129,203.38935,293.38935,1,2.9730005",1.4865003",5.946001",2.9730005",1,158.38935);epanda(104.81664,68.568129,293.38935,383.38935,1,2.9730005",1.4865003",5.946001",2.9730005",1,158.38935);bpanda(104.83398,68.570429,113.38935,383.38935,3,7.9280014",3.9640007",11.892002",5.946001",1,158.38935);bpanda(104.82156,68.57215,158.38935,203.38935,1,7.9280014",3.9640007",11.892002",5.946001",1,158.38935);bpanda(104.82156,68.57215,203.38935,293.38935,1,7.9280014",3.9640007",11.892002",5.946001",1,158.38935);bpanda(104.82156,68.57215,293.38935,383.38935,1,7.9280014",3.9640007",11.892002",5.946001",1,158.38935); \ No newline at end of file diff --git a/regions/io/tests/data/fk5_reference.reg b/regions/io/tests/data/fk5_reference.reg index 3123a0e2..8806f857 100644 --- a/regions/io/tests/data/fk5_reference.reg +++ b/regions/io/tests/data/fk5_reference.reg @@ -1,6 +1,5 @@ # Region file format: DS9 astropy/regions fk5 circle(202.49,47.21,3.96") -ellipse(202.48,47.20,3.96",7.93",2.40) +ellipse(202.48,47.20,7.93",3.96",2.40) polygon(202.47, 47.20, 202.47, 47.20, 202.47, 47.20, 202.47, 47.20) -ellipse(202.49,47.20,1.49",2.97",0.00) diff --git a/regions/io/tests/data/galactic_reference.reg b/regions/io/tests/data/galactic_reference.reg new file mode 100644 index 00000000..59ef8362 --- /dev/null +++ b/regions/io/tests/data/galactic_reference.reg @@ -0,0 +1,5 @@ +# Region file format: DS9 astropy/regions +galactic +circle(104.84,68.54,3.96") +ellipse(104.84,68.55,7.93",3.96",158.39) +polygon(104.85, 68.56, 104.86, 68.56, 104.86, 68.56, 104.85, 68.56) diff --git a/regions/io/tests/test_ds9_language.py b/regions/io/tests/test_ds9_language.py index fd6ec533..19671e0a 100644 --- a/regions/io/tests/test_ds9_language.py +++ b/regions/io/tests/test_ds9_language.py @@ -1,8 +1,8 @@ -from __future__ import absolute_import, division, print_function, unicode_literals - +from __future__ import absolute_import, division, print_function, \ + unicode_literals from numpy.testing import assert_allclose - -from ..ds9_language import ds9_parser, region_list_to_objects, objects_to_ds9_string +from ..ds9_language import ds9_parser, region_list_to_objects, \ + objects_to_ds9_string from astropy.utils.data import get_pkg_data_filename from astropy.tests.helper import pytest @@ -12,7 +12,6 @@ 'data/ds9.fk5.hms.reg', 'data/ds9.fk5.hms.strip.reg', 'data/ds9.fk5.strip.reg']) - def test_fk5(filename): filename = get_pkg_data_filename(filename) temp = ds9_parser(filename) @@ -21,11 +20,34 @@ def test_fk5(filename): actual = objects_to_ds9_string(regs, coordsys='fk5', fmt='.2f') # Use this to produce reference file for now - # print(actual) - # 1/0 + #print(actual) + #1/0 reference_file = get_pkg_data_filename('data/fk5_reference.reg') with open(reference_file, 'r') as fh: desired = fh.read() assert actual == desired + + +@pytest.mark.parametrize('filename', + ['data/ds9.galactic.reg', + 'data/ds9.galactic.hms.reg', + 'data/ds9.galactic.hms.strip.reg', + 'data/ds9.galactic.strip.reg']) +def test_galactic(filename): + filename = get_pkg_data_filename(filename) + temp = ds9_parser(filename) + regs = region_list_to_objects(temp) + + actual = objects_to_ds9_string(regs, coordsys='galactic', fmt='.2f') + + # Use this to produce reference file for now + #print(actual) + #1 / 0 + + reference_file = get_pkg_data_filename('data/galactic_reference.reg') + with open(reference_file, 'r') as fh: + desired = fh.read() + + assert actual == desired From 455fa465f2e074c194c4debf7f16265c66a161fe Mon Sep 17 00:00:00 2001 From: Johannes King Date: Thu, 24 Mar 2016 20:57:11 +0100 Subject: [PATCH 19/30] add test for physical --- regions/io/ds9_language.py | 63 ++++++++++++++----- regions/io/setup_package.py | 6 +- regions/io/tests/data/ds9.physical.reg | 39 ++++++++++++ regions/io/tests/data/ds9.physical.strip.reg | 1 + .../io/tests/data/ds9.physical.windows.reg | 38 +++++++++++ regions/io/tests/data/physical_reference.reg | 5 ++ regions/io/tests/test_ds9_language.py | 28 ++++++++- 7 files changed, 162 insertions(+), 18 deletions(-) create mode 100644 regions/io/tests/data/ds9.physical.reg create mode 100644 regions/io/tests/data/ds9.physical.strip.reg create mode 100644 regions/io/tests/data/ds9.physical.windows.reg create mode 100644 regions/io/tests/data/physical_reference.reg diff --git a/regions/io/ds9_language.py b/regions/io/ds9_language.py index fa004c69..aa2d26f4 100644 --- a/regions/io/ds9_language.py +++ b/regions/io/ds9_language.py @@ -90,10 +90,10 @@ def region_list_to_objects(region_list): else: raise ValueError("No central coordinate") elif region_type == 'ellipse': + # Do not read elliptical annuli for now + if len(coord_list) > 4: + continue if isinstance(coord_list[0], coordinates.SkyCoord): - # Do not read elliptical annuli for now - if len(coord_list) > 4: - continue output_list.append(ellipse.EllipseSkyRegion(coord_list[0], coord_list[1], coord_list[2], coord_list[3])) elif isinstance(coord_list[0], PixCoord): output_list.append(ellipse.EllipsePixelRegion(coord_list[0], coord_list[1], coord_list[2], coord_list[3])) @@ -116,16 +116,27 @@ def region_list_to_objects(region_list): return output_list -def objects_to_ds9_string(obj_list, coordsys='fk5', fmt='.4f', radunit='arcsec'): +def objects_to_ds9_string(obj_list, coordsys='fk5', fmt='.4f', radunit='deg'): """Take a list of regions and generate ds9 region strings""" - ids = {"": 'circle', - "": 'ellipse', - "": 'polygone'} + ids = {"": 'skycircle', + "": 'pixcircle', + "": 'skyellipse', + "": 'pixellipse', + "": 'skypolygon', + "": 'pixpolygon'} - ds9_strings = {'circle': 'circle({x:'+fmt+'},{y:'+fmt+'},{r:'+fmt+'}")\n', - 'ellipse': 'ellipse({x:'+fmt+'},{y:'+fmt+'},{r1:'+fmt+'}",{r2:'+fmt+'}",{ang:'+fmt+'})\n', - 'polygone': 'polygon({c})\n'} + if radunit == 'arcsec': + if coordsys in coordsys_name_mapping.keys(): + radunitstr = '"' + else: + raise ValueError('Radius unit arcsec not valid for coordsys {}'.format(coordsys)) + else: + radunitstr = '' + + ds9_strings = {'circle': 'circle({x:'+fmt+'},{y:'+fmt+'},{r:'+fmt+'}'+radunitstr+')\n', + 'ellipse': 'ellipse({x:'+fmt+'},{y:'+fmt+'},{r1:'+fmt+'}'+radunitstr+',{r2:'+fmt+'}'+radunitstr+',{ang:'+fmt+'})\n', + 'polygon': 'polygon({c})\n'} output = '# Region file format: DS9 astropy/regions\n' output += '{}\n'.format(coordsys) @@ -134,26 +145,47 @@ def objects_to_ds9_string(obj_list, coordsys='fk5', fmt='.4f', radunit='arcsec') temp = str(reg.__class__) if temp in ids.keys(): t = ids[temp] - if t == 'circle': + if t == 'skycircle': # TODO: Why is circle.center a list of SkyCoords? x = reg.center.transform_to(coordsys).spherical.lon.to('deg').value[0] y = reg.center.transform_to(coordsys).spherical.lat.to('deg').value[0] r = reg.radius.to(radunit).value - elif t == 'ellipse': + output += ds9_strings['circle'].format(**locals()) + elif t == 'pixcircle': + # TODO: Why is circle.center a list of SkyCoords? + x = reg.center.x + y = reg.center.y + r = reg.radius + output += ds9_strings['circle'].format(**locals()) + elif t == 'skyellipse': x = reg.center.transform_to(coordsys).spherical.lon.to('deg').value[0] y = reg.center.transform_to(coordsys).spherical.lat.to('deg').value[0] r2 = reg.major.to(radunit).value r1 = reg.minor.to(radunit).value ang = reg.angle.to('deg').value - elif t == 'polygone': + output += ds9_strings['ellipse'].format(**locals()) + elif t == 'pixellipse': + x = reg.center.x + y = reg.center.y + r2 = reg.major + r1 = reg.minor + ang = reg.angle + output += ds9_strings['ellipse'].format(**locals()) + elif t == 'skypolygon': v = reg.vertices.transform_to(coordsys) coords = [(x.to('deg').value, y.to('deg').value) for x, y in zip(v.spherical.lon, v.spherical.lat)] val = "{:"+fmt+"}" temp = [val.format(x) for _ in coords for x in _] c = ", ".join(temp) - - output += ds9_strings[t].format(**locals()) + output += ds9_strings['polygon'].format(**locals()) + elif t == 'pixpolygon': + v = reg.vertices + coords = [(x, y) for x, y in zip(v.x, v.y)] + val = "{:"+fmt+"}" + temp = [val.format(x) for _ in coords for x in _] + c = ", ".join(temp) + output += ds9_strings['polygon'].format(**locals()) return output @@ -250,6 +282,7 @@ def line_parser(line, coordsys=None): coord = PixCoord(parsed[0::2], parsed[1::2]) parsed_return = [coord] else: + parsed = [_.value for _ in parsed] coord = PixCoord(parsed[0], parsed[1]) parsed_return = [coord]+parsed[2:] return region_type, parsed_return, parsed_meta, composite diff --git a/regions/io/setup_package.py b/regions/io/setup_package.py index 7e18d9ab..ef4d9d3f 100644 --- a/regions/io/setup_package.py +++ b/regions/io/setup_package.py @@ -11,6 +11,10 @@ def get_package_data(): os.path.join('data', 'ds9.galactic.strip.reg'), os.path.join('data', 'ds9.galactic.hms.reg'), os.path.join('data', 'ds9.galactic.hms.strip.reg'), - os.path.join('data', 'galactic_reference.reg')] + os.path.join('data', 'galactic_reference.reg'), + os.path.join('data', 'ds9.physical.reg'), + os.path.join('data', 'ds9.physical.strip.reg'), + os.path.join('data', 'ds9.physical.windows.reg'), + os.path.join('data', 'physical_reference.reg')] return {'regions.io.tests': parser_test} diff --git a/regions/io/tests/data/ds9.physical.reg b/regions/io/tests/data/ds9.physical.reg new file mode 100644 index 00000000..91324d23 --- /dev/null +++ b/regions/io/tests/data/ds9.physical.reg @@ -0,0 +1,39 @@ +# Region file format: DS9 version 4.1 +global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1 +physical +circle(331,1091,40) # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +-ellipse(495,1057,80,40,45) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +-box(675,1053,160,80,45) # color=yellow font="helvetica 10 bold roman" text={Box} +polygon(813.49446,1075,889,1150.5055,964.50554,1075,889,999.49446) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +-line(1017,1025,1137,1127) # line=1 1 color=cyan text={Line} +# vector(1205,1069,80,45) vector=1 color=red text={Vector} +# text(1315,1041) color=magenta font="helvetica 14 bold roman" text={Region} +# ruler(773,803,901,921) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +annulus(331,867,20,40,60) # color=magenta font="helvetica 10 bold roman" text={Annulus} +ellipse(501,859,30,15,60,30,45) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +box(675,857,80,40,120,60,45) # font="helvetica 10 bold roman" text={Box Annulus} +point(317,681) # point=circle text={Circle Point} +point(495,677) # point=box color=red width=3 text={Box Point} +point(657,681) # point=diamond text={Diamond Point} +point(347,583) # point=cross color=blue text={Cross Point} +point(499,585) # point=x text={X Point} +point(653,579) # point=arrow color=magenta text={Arrow Point} +point(503,481) # point=boxcircle text={BoxCircle Point} +# projection(981,783,1167,915,40) text={Projection} +panda(855,681,0,270,3,0,60,2) # text={Panda} +panda(859,499,51.5819,90,1,0,30,1) # panda=(51.5819 90 180 270)(0 30 60) text={Panda 2} +panda(859,499,51.5819,90,1,30,60,1) # panda=ignore +panda(859,499,90,180,1,0,30,1) # panda=ignore +panda(859,499,90,180,1,30,60,1) # panda=ignore +panda(859,499,180,270,1,0,30,1) # panda=ignore +panda(859,499,180,270,1,30,60,1) # panda=ignore +# compass(1225,825,80) compass=physical {N} {E} 1 1 text={Compass} +epanda(1019,665,0,270,3,30,15,60,30,1,45) # text={Epanda} +epanda(1025,487,45,90,1,30,15,60,30,1,45) # epanda=(45 90 180 270)(30 15 60 30)(45) text={Epanda 2} +epanda(1025,487,90,180,1,30,15,60,30,1,45) # epanda=ignore +epanda(1025,487,180,270,1,30,15,60,30,1,45) # epanda=ignore +bpanda(1193,665,0,270,3,80,40,120,60,1,45) # text={Bpanda} +bpanda(1185,489,45,90,1,80,40,120,60,1,45) # bpanda=(45 90 180 270)(80 40 120 60)(45) text={Bpanda 2} +bpanda(1185,489,90,180,1,80,40,120,60,1,45) # bpanda=ignore +bpanda(1185,489,180,270,1,80,40,120,60,1,45) # bpanda=ignore +# segment(1336.9946,1154.9931,1364.9942,1074.9929,1416.9942,1074.9927) text={Segment} diff --git a/regions/io/tests/data/ds9.physical.strip.reg b/regions/io/tests/data/ds9.physical.strip.reg new file mode 100644 index 00000000..96274400 --- /dev/null +++ b/regions/io/tests/data/ds9.physical.strip.reg @@ -0,0 +1 @@ +physical;circle(331,1091,40);-ellipse(495,1057,80,40,45);-box(675,1053,160,80,45);polygon(813.49446,1075,889,1150.5055,964.50554,1075,889,999.49446);-line(1017,1025,1137,1127);annulus(331,867,20,40,60);ellipse(501,859,30,15,60,30,45);box(675,857,80,40,120,60,45);point(317,681);point(495,677);point(657,681);point(347,583);point(499,585);point(653,579);point(503,481);panda(855,681,0,270,3,0,60,2);panda(859,499,51.5819,90,1,0,30,1);panda(859,499,51.5819,90,1,30,60,1);panda(859,499,90,180,1,0,30,1);panda(859,499,90,180,1,30,60,1);panda(859,499,180,270,1,0,30,1);panda(859,499,180,270,1,30,60,1);epanda(1019,665,0,270,3,30,15,60,30,1,45);epanda(1025,487,45,90,1,30,15,60,30,1,45);epanda(1025,487,90,180,1,30,15,60,30,1,45);epanda(1025,487,180,270,1,30,15,60,30,1,45);bpanda(1193,665,0,270,3,80,40,120,60,1,45);bpanda(1185,489,45,90,1,80,40,120,60,1,45);bpanda(1185,489,90,180,1,80,40,120,60,1,45);bpanda(1185,489,180,270,1,80,40,120,60,1,45); \ No newline at end of file diff --git a/regions/io/tests/data/ds9.physical.windows.reg b/regions/io/tests/data/ds9.physical.windows.reg new file mode 100644 index 00000000..52603c93 --- /dev/null +++ b/regions/io/tests/data/ds9.physical.windows.reg @@ -0,0 +1,38 @@ +# Region file format: DS9 version 4.0 +global color=green font="helvetica 10 normal roman" select=1 highlite=1 edit=1 move=1 delete=1 include=1 fixed=0 source +physical +circle(325,1075,40) # color=red width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +-ellipse(489,1041,80,40,45) # color=cyan font="helvetica 10 normal italic" text={Ellipse} background +-box(669,1037,160,80,45) # color=yellow font="helvetica 10 bold roman" text={Box} +polygon(807.49446,1059,883,1134.5055,958.50554,1059,883,983.49446) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +-line(1011,1009,1131,1111) # line=1 1 color=cyan text={Line} +# vector(1199,1053,80,45) vector=1 color=red text={Vector} +# text(1309,1025) color=magenta font="helvetica 14 bold roman" text={Region} +# ruler(767,787,895,905) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +annulus(325,851,20,40,60) # color=magenta font="helvetica 10 bold roman" text={Annulus} +ellipse(495,843,30,15,60,30,45) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +box(669,841,80,40,120,60,45) # font="helvetica 10 bold roman" text={Box Annulus} +point(311,665) # point=circle text={Circle Point} +point(489,661) # point=box color=red width=3 text={Box Point} +point(651,665) # point=diamond text={Diamond Point} +point(341,567) # point=cross color=blue text={Cross Point} +point(493,569) # point=x text={X Point} +point(647,563) # point=arrow color=magenta text={Arrow Point} +point(497,465) # point=boxcircle text={BoxCircle Point} +# projection(975,767,1161,899,40) text={Projection} +panda(849,665,0,270,3,0,60,2) # text={Panda} +panda(853,483,51.5819,90,1,0,30,1) || # panda=(51.5819 90 180 270)(0 30 60) text={Panda 2} +panda(853,483,51.5819,90,1,30,60,1) || # panda=ignore +panda(853,483,90,180,1,0,30,1) || # panda=ignore +panda(853,483,90,180,1,30,60,1) || # panda=ignore +panda(853,483,180,270,1,0,30,1) || # panda=ignore +panda(853,483,180,270,1,30,60,1) # panda=ignore +# compass(1219,809,80) compass=physical {N} {E} 1 1 text={Compass} +epanda(1013,649,0,270,3,30,15,60,30,1,45) # text={Epanda} +epanda(1019,471,45,90,1,30,15,60,30,1,45) || # epanda=(45 90 180 270)(30 15 60 30)(45) text={Epanda 2} +epanda(1019,471,90,180,1,30,15,60,30,1,45) || # epanda=ignore +epanda(1019,471,180,270,1,30,15,60,30,1,45) # epanda=ignore +bpanda(1187,649,0,270,3,80,40,120,60,1,45) # text={Bpanda} +bpanda(1179,473,45,90,1,80,40,120,60,1,45) || # bpanda=(45 90 180 270)(80 40 120 60)(45) text={Bpanda 2} +bpanda(1179,473,90,180,1,80,40,120,60,1,45) || # bpanda=ignore +bpanda(1179,473,180,270,1,80,40,120,60,1,45) # bpanda=ignore diff --git a/regions/io/tests/data/physical_reference.reg b/regions/io/tests/data/physical_reference.reg new file mode 100644 index 00000000..f77cdff1 --- /dev/null +++ b/regions/io/tests/data/physical_reference.reg @@ -0,0 +1,5 @@ +# Region file format: DS9 astropy/regions +physical +circle(331.00,1091.00,40.00) +ellipse(495.00,1057.00,80.00,40.00,45.00) +polygon(813.49, 1075.00, 889.00, 1150.51, 964.51, 1075.00, 889.00, 999.49) diff --git a/regions/io/tests/test_ds9_language.py b/regions/io/tests/test_ds9_language.py index 19671e0a..c20137e7 100644 --- a/regions/io/tests/test_ds9_language.py +++ b/regions/io/tests/test_ds9_language.py @@ -17,7 +17,7 @@ def test_fk5(filename): temp = ds9_parser(filename) regs = region_list_to_objects(temp) - actual = objects_to_ds9_string(regs, coordsys='fk5', fmt='.2f') + actual = objects_to_ds9_string(regs, coordsys='fk5', fmt='.2f', radunit='arcsec') # Use this to produce reference file for now #print(actual) @@ -40,7 +40,7 @@ def test_galactic(filename): temp = ds9_parser(filename) regs = region_list_to_objects(temp) - actual = objects_to_ds9_string(regs, coordsys='galactic', fmt='.2f') + actual = objects_to_ds9_string(regs, coordsys='galactic', fmt='.2f', radunit='arcsec') # Use this to produce reference file for now #print(actual) @@ -51,3 +51,27 @@ def test_galactic(filename): desired = fh.read() assert actual == desired + + +# Todo : data/ds9.physical.windows.reg contains different values -> Why? +@pytest.mark.parametrize('filename', + ['data/ds9.physical.reg', + 'data/ds9.physical.strip.reg']) + +def test_physical(filename): + filename = get_pkg_data_filename(filename) + temp = ds9_parser(filename) + regs = region_list_to_objects(temp) + + actual = objects_to_ds9_string(regs, coordsys='physical', fmt='.2f') + + # Use this to produce reference file for now + # print(actual) + # 1 / 0 + + reference_file = get_pkg_data_filename('data/physical_reference.reg') + with open(reference_file, 'r') as fh: + desired = fh.read() + + assert actual == desired + From f0730ba4fb2c60dd6329cbb5176c47d710164834 Mon Sep 17 00:00:00 2001 From: Johannes King Date: Thu, 24 Mar 2016 22:15:27 +0100 Subject: [PATCH 20/30] add coveragerc --- regions/io/ds9_language.py | 2 ++ regions/tests/__init__.py | 4 ++++ regions/tests/coveragerc | 26 ++++++++++++++++++++++++++ regions/tests/setup_package.py | 3 +++ 4 files changed, 35 insertions(+) create mode 100644 regions/tests/__init__.py create mode 100644 regions/tests/coveragerc create mode 100644 regions/tests/setup_package.py diff --git a/regions/io/ds9_language.py b/regions/io/ds9_language.py index aa2d26f4..9eaf3e6b 100644 --- a/regions/io/ds9_language.py +++ b/regions/io/ds9_language.py @@ -266,6 +266,7 @@ def line_parser(line, coordsys=None): coordsys_name_mapping[coordsys]) # Reset iterator for ellipse annulus + # (not needed for physical regions b/c coordinate = radius in that case) if region_type == 'ellipse': language_spec[region_type] = itertools.chain((coordinate, coordinate), itertools.cycle((radius, ))) @@ -279,6 +280,7 @@ def line_parser(line, coordsys=None): parsed = type_parser(coords_etc, language_spec[region_type], coordsys) if region_type == 'polygon': + # have to special-case polygon in the phys coord case b/c can't typecheck when iterating as in sky coord case coord = PixCoord(parsed[0::2], parsed[1::2]) parsed_return = [coord] else: diff --git a/regions/tests/__init__.py b/regions/tests/__init__.py new file mode 100644 index 00000000..2ff7e2a6 --- /dev/null +++ b/regions/tests/__init__.py @@ -0,0 +1,4 @@ +# Licensed under a 3-clause BSD style license - see LICENSE.rst +""" +This packages contains affiliated package tests. +""" diff --git a/regions/tests/coveragerc b/regions/tests/coveragerc new file mode 100644 index 00000000..c502e1c9 --- /dev/null +++ b/regions/tests/coveragerc @@ -0,0 +1,26 @@ +[run] +source = regions +omit = + *tests* + *setup_package* + regions/version* + regions/_astropy_init.py + +[report] +exclude_lines = + # Have to re-enable the standard pragma + pragma: no cover + + # Don't complain about packages we have installed + except ImportError + + # Don't complain if tests don't hit assertions + raise AssertionError + raise NotImplementedError + + # Don't complain about script hooks + def main\(.*\): + + # Ignore branches that don't pertain to this version of Python + pragma: py{ignore_python_version} + six.PY{ignore_python_version} \ No newline at end of file diff --git a/regions/tests/setup_package.py b/regions/tests/setup_package.py new file mode 100644 index 00000000..665f8533 --- /dev/null +++ b/regions/tests/setup_package.py @@ -0,0 +1,3 @@ +def get_package_data(): + files = ['coveragerc'] + return {'regions.tests': files} From 66e7865737eaf23a8a1a91461138bf2c9ff07758 Mon Sep 17 00:00:00 2001 From: Johannes King Date: Thu, 24 Mar 2016 22:34:48 +0100 Subject: [PATCH 21/30] change file names/structure --- regions/io/__init__.py | 3 +- regions/io/{ds9_language.py => read_ds9.py} | 88 +++------------------ regions/io/tests/test_ds9_language.py | 14 ++-- regions/io/write_ds9.py | 88 +++++++++++++++++++++ 4 files changed, 104 insertions(+), 89 deletions(-) rename regions/io/{ds9_language.py => read_ds9.py} (74%) create mode 100644 regions/io/write_ds9.py diff --git a/regions/io/__init__.py b/regions/io/__init__.py index 10b6e7a4..49875eb0 100644 --- a/regions/io/__init__.py +++ b/regions/io/__init__.py @@ -1,5 +1,6 @@ # Licensed under a 3-clause BSD style license - see LICENSE.rst """I/O """ -from .ds9_language import * +from .read_ds9 import * +from .write_ds9 import * diff --git a/regions/io/ds9_language.py b/regions/io/read_ds9.py similarity index 74% rename from regions/io/ds9_language.py rename to regions/io/read_ds9.py index 9eaf3e6b..7907f5da 100644 --- a/regions/io/ds9_language.py +++ b/regions/io/read_ds9.py @@ -1,3 +1,5 @@ +# Licensed under a 3-clause BSD style license - see LICENSE.rst + import string import itertools import re @@ -6,6 +8,12 @@ from ..shapes import circle, rectangle, polygon, ellipse from ..core import PixCoord + +def read_ds9(filename): + region_list = ds9_parser(filename) + return region_list_to_objects(region_list) + + def coordinate(string_rep, unit): # Any ds9 coordinate representation (sexagesimal or degrees) if 'd' in string_rep or 'h' in string_rep: @@ -26,6 +34,7 @@ def coordinate(string_rep, unit): 'i': u.dimensionless_unscaled, } + def angular_length_quantity(string_rep): has_unit = string_rep[-1] not in string.digits if has_unit: @@ -116,85 +125,6 @@ def region_list_to_objects(region_list): return output_list -def objects_to_ds9_string(obj_list, coordsys='fk5', fmt='.4f', radunit='deg'): - """Take a list of regions and generate ds9 region strings""" - - ids = {"": 'skycircle', - "": 'pixcircle', - "": 'skyellipse', - "": 'pixellipse', - "": 'skypolygon', - "": 'pixpolygon'} - - if radunit == 'arcsec': - if coordsys in coordsys_name_mapping.keys(): - radunitstr = '"' - else: - raise ValueError('Radius unit arcsec not valid for coordsys {}'.format(coordsys)) - else: - radunitstr = '' - - ds9_strings = {'circle': 'circle({x:'+fmt+'},{y:'+fmt+'},{r:'+fmt+'}'+radunitstr+')\n', - 'ellipse': 'ellipse({x:'+fmt+'},{y:'+fmt+'},{r1:'+fmt+'}'+radunitstr+',{r2:'+fmt+'}'+radunitstr+',{ang:'+fmt+'})\n', - 'polygon': 'polygon({c})\n'} - - output = '# Region file format: DS9 astropy/regions\n' - output += '{}\n'.format(coordsys) - - for reg in obj_list: - temp = str(reg.__class__) - if temp in ids.keys(): - t = ids[temp] - if t == 'skycircle': - # TODO: Why is circle.center a list of SkyCoords? - x = reg.center.transform_to(coordsys).spherical.lon.to('deg').value[0] - y = reg.center.transform_to(coordsys).spherical.lat.to('deg').value[0] - r = reg.radius.to(radunit).value - output += ds9_strings['circle'].format(**locals()) - elif t == 'pixcircle': - # TODO: Why is circle.center a list of SkyCoords? - x = reg.center.x - y = reg.center.y - r = reg.radius - output += ds9_strings['circle'].format(**locals()) - elif t == 'skyellipse': - x = reg.center.transform_to(coordsys).spherical.lon.to('deg').value[0] - y = reg.center.transform_to(coordsys).spherical.lat.to('deg').value[0] - r2 = reg.major.to(radunit).value - r1 = reg.minor.to(radunit).value - ang = reg.angle.to('deg').value - output += ds9_strings['ellipse'].format(**locals()) - elif t == 'pixellipse': - x = reg.center.x - y = reg.center.y - r2 = reg.major - r1 = reg.minor - ang = reg.angle - output += ds9_strings['ellipse'].format(**locals()) - elif t == 'skypolygon': - v = reg.vertices.transform_to(coordsys) - coords = [(x.to('deg').value, y.to('deg').value) for x, y in - zip(v.spherical.lon, v.spherical.lat)] - val = "{:"+fmt+"}" - temp = [val.format(x) for _ in coords for x in _] - c = ", ".join(temp) - output += ds9_strings['polygon'].format(**locals()) - elif t == 'pixpolygon': - v = reg.vertices - coords = [(x, y) for x, y in zip(v.x, v.y)] - val = "{:"+fmt+"}" - temp = [val.format(x) for _ in coords for x in _] - c = ", ".join(temp) - output += ds9_strings['polygon'].format(**locals()) - - return output - - -def write_ds9(obj_list, filename='ds9.reg', coordsys='fk5'): - """Write ds9 region file""" - output = objects_to_ds9_string(obj_list, coordsys) - with open(filename, 'w') as fh: - fh.write(output) def ds9_parser(filename): diff --git a/regions/io/tests/test_ds9_language.py b/regions/io/tests/test_ds9_language.py index c20137e7..7c9f612d 100644 --- a/regions/io/tests/test_ds9_language.py +++ b/regions/io/tests/test_ds9_language.py @@ -1,8 +1,7 @@ from __future__ import absolute_import, division, print_function, \ unicode_literals -from numpy.testing import assert_allclose -from ..ds9_language import ds9_parser, region_list_to_objects, \ - objects_to_ds9_string +from ..read_ds9 import read_ds9 +from ..write_ds9 import objects_to_ds9_string from astropy.utils.data import get_pkg_data_filename from astropy.tests.helper import pytest @@ -14,8 +13,7 @@ 'data/ds9.fk5.strip.reg']) def test_fk5(filename): filename = get_pkg_data_filename(filename) - temp = ds9_parser(filename) - regs = region_list_to_objects(temp) + regs = read_ds9(filename) actual = objects_to_ds9_string(regs, coordsys='fk5', fmt='.2f', radunit='arcsec') @@ -37,8 +35,7 @@ def test_fk5(filename): 'data/ds9.galactic.strip.reg']) def test_galactic(filename): filename = get_pkg_data_filename(filename) - temp = ds9_parser(filename) - regs = region_list_to_objects(temp) + regs = read_ds9(filename) actual = objects_to_ds9_string(regs, coordsys='galactic', fmt='.2f', radunit='arcsec') @@ -60,8 +57,7 @@ def test_galactic(filename): def test_physical(filename): filename = get_pkg_data_filename(filename) - temp = ds9_parser(filename) - regs = region_list_to_objects(temp) + regs = read_ds9(filename) actual = objects_to_ds9_string(regs, coordsys='physical', fmt='.2f') diff --git a/regions/io/write_ds9.py b/regions/io/write_ds9.py new file mode 100644 index 00000000..3b697a3c --- /dev/null +++ b/regions/io/write_ds9.py @@ -0,0 +1,88 @@ +# Licensed under a 3-clause BSD style license - see LICENSE.rst + +from astropy import coordinates + +coordsys_name_mapping = dict(zip(coordinates.frame_transform_graph.get_names(), + coordinates.frame_transform_graph.get_names())) +coordsys_name_mapping['ecliptic'] = 'geocentrictrueecliptic' # needs expert attention TODO + + +def objects_to_ds9_string(obj_list, coordsys='fk5', fmt='.4f', radunit='deg'): + """Take a list of regions and generate ds9 region strings""" + + ids = {"": 'skycircle', + "": 'pixcircle', + "": 'skyellipse', + "": 'pixellipse', + "": 'skypolygon', + "": 'pixpolygon'} + + if radunit == 'arcsec': + if coordsys in coordsys_name_mapping.keys(): + radunitstr = '"' + else: + raise ValueError('Radius unit arcsec not valid for coordsys {}'.format(coordsys)) + else: + radunitstr = '' + + ds9_strings = {'circle': 'circle({x:'+fmt+'},{y:'+fmt+'},{r:'+fmt+'}'+radunitstr+')\n', + 'ellipse': 'ellipse({x:'+fmt+'},{y:'+fmt+'},{r1:'+fmt+'}'+radunitstr+',{r2:'+fmt+'}'+radunitstr+',{ang:'+fmt+'})\n', + 'polygon': 'polygon({c})\n'} + + output = '# Region file format: DS9 astropy/regions\n' + output += '{}\n'.format(coordsys) + + for reg in obj_list: + temp = str(reg.__class__) + if temp in ids.keys(): + t = ids[temp] + if t == 'skycircle': + # TODO: Why is circle.center a list of SkyCoords? + x = reg.center.transform_to(coordsys).spherical.lon.to('deg').value[0] + y = reg.center.transform_to(coordsys).spherical.lat.to('deg').value[0] + r = reg.radius.to(radunit).value + output += ds9_strings['circle'].format(**locals()) + elif t == 'pixcircle': + # TODO: Why is circle.center a list of SkyCoords? + x = reg.center.x + y = reg.center.y + r = reg.radius + output += ds9_strings['circle'].format(**locals()) + elif t == 'skyellipse': + x = reg.center.transform_to(coordsys).spherical.lon.to('deg').value[0] + y = reg.center.transform_to(coordsys).spherical.lat.to('deg').value[0] + r2 = reg.major.to(radunit).value + r1 = reg.minor.to(radunit).value + ang = reg.angle.to('deg').value + output += ds9_strings['ellipse'].format(**locals()) + elif t == 'pixellipse': + x = reg.center.x + y = reg.center.y + r2 = reg.major + r1 = reg.minor + ang = reg.angle + output += ds9_strings['ellipse'].format(**locals()) + elif t == 'skypolygon': + v = reg.vertices.transform_to(coordsys) + coords = [(x.to('deg').value, y.to('deg').value) for x, y in + zip(v.spherical.lon, v.spherical.lat)] + val = "{:"+fmt+"}" + temp = [val.format(x) for _ in coords for x in _] + c = ", ".join(temp) + output += ds9_strings['polygon'].format(**locals()) + elif t == 'pixpolygon': + v = reg.vertices + coords = [(x, y) for x, y in zip(v.x, v.y)] + val = "{:"+fmt+"}" + temp = [val.format(x) for _ in coords for x in _] + c = ", ".join(temp) + output += ds9_strings['polygon'].format(**locals()) + + return output + + +def write_ds9(obj_list, filename='ds9.reg', coordsys='fk5'): + """Write ds9 region file""" + output = objects_to_ds9_string(obj_list, coordsys) + with open(filename, 'w') as fh: + fh.write(output) From d27dae612315ae4a384d75f043c1fe73c255487b Mon Sep 17 00:00:00 2001 From: "Adam Ginsburg (keflavich)" Date: Thu, 24 Mar 2016 16:18:19 -0700 Subject: [PATCH 22/30] try changing travis grid --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b17639e5..4afd628c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,7 +20,7 @@ env: # The following versions are the 'default' for tests, unless # overidden underneath. They are defined here in order to save having # to repeat them for all configurations. - - NUMPY_VERSION=1.9 + - NUMPY_VERSION=1.10 - ASTROPY_VERSION=stable - SETUP_CMD='test' - PIP_DEPENDENCIES='' @@ -54,6 +54,8 @@ matrix: env: ASTROPY_VERSION=development # Try older numpy versions + - python: 2.7 + env: NUMPY_VERSION=1.9 - python: 2.7 env: NUMPY_VERSION=1.8 - python: 2.7 From d148a4ff21ead45e3e759d21f6d902d613eca9ed Mon Sep 17 00:00:00 2001 From: "Adam Ginsburg (keflavich)" Date: Thu, 24 Mar 2016 16:38:25 -0700 Subject: [PATCH 23/30] disable deprecation->exception --- regions/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/regions/conftest.py b/regions/conftest.py index 310e9be3..fb33e09b 100644 --- a/regions/conftest.py +++ b/regions/conftest.py @@ -6,7 +6,7 @@ ## Uncomment the following line to treat all DeprecationWarnings as ## exceptions -enable_deprecations_as_exceptions() +#enable_deprecations_as_exceptions() ## Uncomment and customize the following lines to add/remove entries ## from the list of packages for which version numbers are displayed From de602a9afc7c365a5e6a5928b033af32f6d84050 Mon Sep 17 00:00:00 2001 From: Johannes King Date: Fri, 25 Mar 2016 01:15:28 +0100 Subject: [PATCH 24/30] bugfixes --- regions/io/read_ds9.py | 8 +++++--- regions/io/tests/data/fk5_reference.reg | 2 +- regions/io/tests/data/galactic_reference.reg | 2 +- regions/io/tests/data/physical_reference.reg | 2 +- regions/io/write_ds9.py | 4 ++-- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/regions/io/read_ds9.py b/regions/io/read_ds9.py index 7907f5da..83efa966 100644 --- a/regions/io/read_ds9.py +++ b/regions/io/read_ds9.py @@ -125,8 +125,6 @@ def region_list_to_objects(region_list): return output_list - - def ds9_parser(filename): """ Parse a complete ds9 .reg file @@ -196,7 +194,6 @@ def line_parser(line, coordsys=None): coordsys_name_mapping[coordsys]) # Reset iterator for ellipse annulus - # (not needed for physical regions b/c coordinate = radius in that case) if region_type == 'ellipse': language_spec[region_type] = itertools.chain((coordinate, coordinate), itertools.cycle((radius, ))) @@ -217,6 +214,11 @@ def line_parser(line, coordsys=None): parsed = [_.value for _ in parsed] coord = PixCoord(parsed[0], parsed[1]) parsed_return = [coord]+parsed[2:] + + # Reset iterator for ellipse annulus + if region_type == 'ellipse': + language_spec[region_type] = itertools.chain((coordinate, coordinate), itertools.cycle((radius, ))) + return region_type, parsed_return, parsed_meta, composite diff --git a/regions/io/tests/data/fk5_reference.reg b/regions/io/tests/data/fk5_reference.reg index 8806f857..d909f959 100644 --- a/regions/io/tests/data/fk5_reference.reg +++ b/regions/io/tests/data/fk5_reference.reg @@ -2,4 +2,4 @@ fk5 circle(202.49,47.21,3.96") ellipse(202.48,47.20,7.93",3.96",2.40) -polygon(202.47, 47.20, 202.47, 47.20, 202.47, 47.20, 202.47, 47.20) +polygon(202.47,47.20,202.47,47.20,202.47,47.20,202.47,47.20) diff --git a/regions/io/tests/data/galactic_reference.reg b/regions/io/tests/data/galactic_reference.reg index 59ef8362..8fb52761 100644 --- a/regions/io/tests/data/galactic_reference.reg +++ b/regions/io/tests/data/galactic_reference.reg @@ -2,4 +2,4 @@ galactic circle(104.84,68.54,3.96") ellipse(104.84,68.55,7.93",3.96",158.39) -polygon(104.85, 68.56, 104.86, 68.56, 104.86, 68.56, 104.85, 68.56) +polygon(104.85,68.56,104.86,68.56,104.86,68.56,104.85,68.56) diff --git a/regions/io/tests/data/physical_reference.reg b/regions/io/tests/data/physical_reference.reg index f77cdff1..5a83338c 100644 --- a/regions/io/tests/data/physical_reference.reg +++ b/regions/io/tests/data/physical_reference.reg @@ -2,4 +2,4 @@ physical circle(331.00,1091.00,40.00) ellipse(495.00,1057.00,80.00,40.00,45.00) -polygon(813.49, 1075.00, 889.00, 1150.51, 964.51, 1075.00, 889.00, 999.49) +polygon(813.49,1075.00,889.00,1150.51,964.51,1075.00,889.00,999.49) diff --git a/regions/io/write_ds9.py b/regions/io/write_ds9.py index 3b697a3c..6e29708e 100644 --- a/regions/io/write_ds9.py +++ b/regions/io/write_ds9.py @@ -68,14 +68,14 @@ def objects_to_ds9_string(obj_list, coordsys='fk5', fmt='.4f', radunit='deg'): zip(v.spherical.lon, v.spherical.lat)] val = "{:"+fmt+"}" temp = [val.format(x) for _ in coords for x in _] - c = ", ".join(temp) + c = ",".join(temp) output += ds9_strings['polygon'].format(**locals()) elif t == 'pixpolygon': v = reg.vertices coords = [(x, y) for x, y in zip(v.x, v.y)] val = "{:"+fmt+"}" temp = [val.format(x) for _ in coords for x in _] - c = ", ".join(temp) + c = ",".join(temp) output += ds9_strings['polygon'].format(**locals()) return output From 6c01e4494781d5c5d492b841138e051a2e3571de Mon Sep 17 00:00:00 2001 From: Johannes King Date: Fri, 25 Mar 2016 01:30:25 +0100 Subject: [PATCH 25/30] add test reading all files also reference files --- regions/io/setup_package.py | 16 +- regions/io/tests/data/ds9.color.reg | 10 ++ regions/io/tests/data/ds9.comment.reg | 10 ++ regions/io/tests/data/ds9.composite.reg | 39 +++++ regions/io/tests/data/ds9.ecliptic.hms.reg | 39 +++++ .../io/tests/data/ds9.ecliptic.hms.strip.reg | 1 + regions/io/tests/data/ds9.ecliptic.reg | 39 +++++ regions/io/tests/data/ds9.ecliptic.strip.reg | 1 + regions/io/tests/data/ds9.fits.reg | 12 ++ regions/io/tests/data/ds9.fk4.hms.reg | 39 +++++ regions/io/tests/data/ds9.fk4.hms.strip.reg | 1 + regions/io/tests/data/ds9.fk4.reg | 39 +++++ regions/io/tests/data/ds9.fk4.strip.reg | 1 + regions/io/tests/data/ds9.icrs.hms.reg | 39 +++++ regions/io/tests/data/ds9.icrs.hms.strip.reg | 1 + regions/io/tests/data/ds9.icrs.reg | 39 +++++ regions/io/tests/data/ds9.icrs.strip.reg | 1 + regions/io/tests/data/ds9.image.reg | 39 +++++ regions/io/tests/data/ds9.image.strip.reg | 1 + regions/io/tests/data/ds9.linear.wcs.reg | 143 ++++++++++++++++++ regions/io/tests/data/ds9.linear.wcsa.reg | 143 ++++++++++++++++++ regions/io/tests/data/ds9.linear.wcsc.reg | 143 ++++++++++++++++++ regions/io/tests/data/ds9.linear.wcsd.reg | 143 ++++++++++++++++++ regions/io/tests/data/ds9.linear.wcsi.reg | 143 ++++++++++++++++++ regions/io/tests/data/ds9.linear.wcsp.reg | 143 ++++++++++++++++++ .../io/tests/data/ds9.mosaic.ecliptic.hms.reg | 73 +++++++++ regions/io/tests/data/ds9.mosaic.ecliptic.reg | 73 +++++++++ regions/io/tests/data/ds9.mosaic.fk4.hms.reg | 73 +++++++++ regions/io/tests/data/ds9.mosaic.fk4.reg | 73 +++++++++ regions/io/tests/data/ds9.mosaic.fk5.hms.reg | 73 +++++++++ regions/io/tests/data/ds9.mosaic.fk5.reg | 73 +++++++++ .../io/tests/data/ds9.mosaic.galactic.hms.reg | 73 +++++++++ regions/io/tests/data/ds9.mosaic.galactic.reg | 73 +++++++++ regions/io/tests/data/ds9.mosaic.icrs.hms.reg | 73 +++++++++ regions/io/tests/data/ds9.mosaic.icrs.reg | 73 +++++++++ regions/io/tests/data/ds9.mosaic.image.reg | 143 ++++++++++++++++++ regions/io/tests/data/ds9.mosaic.physical.reg | 143 ++++++++++++++++++ regions/io/tests/test_ds9_language.py | 8 +- 38 files changed, 2233 insertions(+), 16 deletions(-) create mode 100644 regions/io/tests/data/ds9.color.reg create mode 100644 regions/io/tests/data/ds9.comment.reg create mode 100644 regions/io/tests/data/ds9.composite.reg create mode 100644 regions/io/tests/data/ds9.ecliptic.hms.reg create mode 100644 regions/io/tests/data/ds9.ecliptic.hms.strip.reg create mode 100644 regions/io/tests/data/ds9.ecliptic.reg create mode 100644 regions/io/tests/data/ds9.ecliptic.strip.reg create mode 100644 regions/io/tests/data/ds9.fits.reg create mode 100644 regions/io/tests/data/ds9.fk4.hms.reg create mode 100644 regions/io/tests/data/ds9.fk4.hms.strip.reg create mode 100644 regions/io/tests/data/ds9.fk4.reg create mode 100644 regions/io/tests/data/ds9.fk4.strip.reg create mode 100644 regions/io/tests/data/ds9.icrs.hms.reg create mode 100644 regions/io/tests/data/ds9.icrs.hms.strip.reg create mode 100644 regions/io/tests/data/ds9.icrs.reg create mode 100644 regions/io/tests/data/ds9.icrs.strip.reg create mode 100644 regions/io/tests/data/ds9.image.reg create mode 100644 regions/io/tests/data/ds9.image.strip.reg create mode 100644 regions/io/tests/data/ds9.linear.wcs.reg create mode 100644 regions/io/tests/data/ds9.linear.wcsa.reg create mode 100644 regions/io/tests/data/ds9.linear.wcsc.reg create mode 100644 regions/io/tests/data/ds9.linear.wcsd.reg create mode 100644 regions/io/tests/data/ds9.linear.wcsi.reg create mode 100644 regions/io/tests/data/ds9.linear.wcsp.reg create mode 100644 regions/io/tests/data/ds9.mosaic.ecliptic.hms.reg create mode 100644 regions/io/tests/data/ds9.mosaic.ecliptic.reg create mode 100644 regions/io/tests/data/ds9.mosaic.fk4.hms.reg create mode 100644 regions/io/tests/data/ds9.mosaic.fk4.reg create mode 100644 regions/io/tests/data/ds9.mosaic.fk5.hms.reg create mode 100644 regions/io/tests/data/ds9.mosaic.fk5.reg create mode 100644 regions/io/tests/data/ds9.mosaic.galactic.hms.reg create mode 100644 regions/io/tests/data/ds9.mosaic.galactic.reg create mode 100644 regions/io/tests/data/ds9.mosaic.icrs.hms.reg create mode 100644 regions/io/tests/data/ds9.mosaic.icrs.reg create mode 100644 regions/io/tests/data/ds9.mosaic.image.reg create mode 100644 regions/io/tests/data/ds9.mosaic.physical.reg diff --git a/regions/io/setup_package.py b/regions/io/setup_package.py index ef4d9d3f..ead74a6d 100644 --- a/regions/io/setup_package.py +++ b/regions/io/setup_package.py @@ -2,19 +2,5 @@ import os def get_package_data(): - parser_test = [os.path.join('data', 'ds9.fk5.reg'), - os.path.join('data', 'ds9.fk5.strip.reg'), - os.path.join('data', 'ds9.fk5.hms.reg'), - os.path.join('data', 'ds9.fk5.hms.strip.reg'), - os.path.join('data', 'fk5_reference.reg'), - os.path.join('data', 'ds9.galactic.reg'), - os.path.join('data', 'ds9.galactic.strip.reg'), - os.path.join('data', 'ds9.galactic.hms.reg'), - os.path.join('data', 'ds9.galactic.hms.strip.reg'), - os.path.join('data', 'galactic_reference.reg'), - os.path.join('data', 'ds9.physical.reg'), - os.path.join('data', 'ds9.physical.strip.reg'), - os.path.join('data', 'ds9.physical.windows.reg'), - os.path.join('data', 'physical_reference.reg')] - + parser_test = ['data/*.reg'] return {'regions.io.tests': parser_test} diff --git a/regions/io/tests/data/ds9.color.reg b/regions/io/tests/data/ds9.color.reg new file mode 100644 index 00000000..75695bcc --- /dev/null +++ b/regions/io/tests/data/ds9.color.reg @@ -0,0 +1,10 @@ +# Region file format: DS9 version 4.1 +global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1 +fk5 +circle(13:29:52.675,+47:11:45.02,1") # color=blue +circle(13:29:52.675,+47:11:45.02,2") # color=#800 +circle(13:29:52.675,+47:11:45.02,3") # color=#0a0 +circle(13:29:52.675,+47:11:45.02,4") # color=#880000 +circle(13:29:52.675,+47:11:45.02,5") # color=#00aa00 +circle(13:29:52.675,+47:11:45.02,6") # color=#888800000000 +circle(13:29:52.675,+47:11:45.02,7") # color=#0000aaaa0000 diff --git a/regions/io/tests/data/ds9.comment.reg b/regions/io/tests/data/ds9.comment.reg new file mode 100644 index 00000000..09ed9fba --- /dev/null +++ b/regions/io/tests/data/ds9.comment.reg @@ -0,0 +1,10 @@ +# Region file format: DS9 version 4.0 +# +# foobar +# foobar+ +# foo+bar +## foobar +### foobar +#. foobar +##. foobar + diff --git a/regions/io/tests/data/ds9.composite.reg b/regions/io/tests/data/ds9.composite.reg new file mode 100644 index 00000000..22532a38 --- /dev/null +++ b/regions/io/tests/data/ds9.composite.reg @@ -0,0 +1,39 @@ +# Region file format: DS9 version 4.1 +global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1 +fk5 +# composite(202.48165,47.1931,317.39831) || composite=1 +circle(202.48705,47.208237,3.9640007") || # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +-ellipse(202.48309,47.204492,7.9280014",3.9640007",2.3983109) || # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +-box(202.47783,47.201057,15.856003",7.9280014",2.3983109) || # color=yellow font="helvetica 10 bold roman" text={Box} +polygon(202.47309,47.198922,202.46877,47.199044,202.46859,47.196108,202.47291,47.195985) || # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +-line(202.4684,47.194116,202.46202,47.193946) || # line=1 1 color=cyan text={Line} +# vector(202.46159,47.191504,7.9280014",2.3983109) || vector=1 color=red text={Vector} +# text(202.45907,47.188886) || color=magenta font="helvetica 14 bold roman" text={Region} +# ruler(202.48176,47.194165,202.47471,47.194171) || ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +annulus(202.49319,47.203697,1.9820003",3.9640007",5.946001") || # color=magenta font="helvetica 10 bold roman" text={Annulus} +ellipse(202.48834,47.200368,2.9730005",1.4865003",5.946001",2.9730005",2.3983109) || # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +box(202.4832,47.197085,7.9280014",3.9640007",11.892002",5.946001",2.3983109) || # font="helvetica 10 bold roman" text={Box Annulus} +point(202.49871,47.200189) || # point=circle text={Circle Point} +point(202.49351,47.196791) || # point=box color=red width=3 text={Box Point} +point(202.48857,47.193854) || # point=diamond text={Diamond Point} +point(202.5005,47.197643) || # point=cross color=blue text={Cross Point} +point(202.49591,47.194852) || # point=x text={X Point} +point(202.49148,47.191862) || # point=arrow color=magenta text={Arrow Point} +point(202.49864,47.19267) || # point=boxcircle text={BoxCircle Point} +# projection(202.47611,47.189884,202.46694,47.189092,3.9640007") || text={Projection} +panda(202.48266,47.190165,317.39831,587.39831,3,0",5.946001",2) || # text={Panda} +panda(202.48753,47.186403,8.9802109,47.398311,1,0",2.9730005",1) || # panda=(8.9802109 47.398311 137.39831 227.39831)(0" 2.9730005" 5.946001") text={Panda 2} +panda(202.48753,47.186403,8.9802109,47.398311,1,2.9730005",5.946001",1) || # panda=ignore +panda(202.48753,47.186403,47.398311,137.39831,1,0",2.9730005",1) || # panda=ignore +panda(202.48753,47.186403,47.398311,137.39831,1,2.9730005",5.946001",1) || # panda=ignore +panda(202.48753,47.186403,137.39831,227.39831,1,0",2.9730005",1) || # panda=ignore +panda(202.48753,47.186403,137.39831,227.39831,1,2.9730005",5.946001",1) || # panda=ignore +# compass(202.46768,47.186188,7.9280014") || compass=physical {N} {E} 1 1 text={Compass} +epanda(202.47821,47.186785,317.39831,587.39831,3,2.9730005",1.4865003",5.946001",2.9730005",1,2.3983109) || # text={Epanda} +epanda(202.48291,47.183066,2.3983109,47.398311,1,2.9730005",1.4865003",5.946001",2.9730005",1,2.3983109) || # epanda=(2.3983109 47.398311 137.39831 227.39831)(2.9730005" 1.4865003" 5.946001" 2.9730005")(2.3983109) text={Epanda 2} +epanda(202.48291,47.183066,47.398311,137.39831,1,2.9730005",1.4865003",5.946001",2.9730005",1,2.3983109) || # epanda=ignore +epanda(202.48291,47.183066,137.39831,227.39831,1,2.9730005",1.4865003",5.946001",2.9730005",1,2.3983109) || # epanda=ignore +bpanda(202.47302,47.183543,317.39831,587.39831,3,7.9280014",3.9640007",11.892002",5.946001",1,2.3983109) || # text={Bpanda} +bpanda(202.47809,47.180126,2.3983109,47.398311,1,7.9280014",3.9640007",11.892002",5.946001",1,2.3983109) # bpanda=(2.3983109 47.398311 137.39831 227.39831)(7.9280014" 3.9640007" 11.892002" 5.946001")(2.3983109) text={Bpanda 2} +bpanda(202.47809,47.180126,47.398311,137.39831,1,7.9280014",3.9640007",11.892002",5.946001",1,2.3983109) # bpanda=ignore +bpanda(202.47809,47.180126,137.39831,227.39831,1,7.9280014",3.9640007",11.892002",5.946001",1,2.3983109) # bpanda=ignore diff --git a/regions/io/tests/data/ds9.ecliptic.hms.reg b/regions/io/tests/data/ds9.ecliptic.hms.reg new file mode 100644 index 00000000..277d6362 --- /dev/null +++ b/regions/io/tests/data/ds9.ecliptic.hms.reg @@ -0,0 +1,39 @@ +# Region file format: DS9 version 4.1 +global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1 +ecliptic +circle(+175:06:44.660,+50:57:09.921,3.964") # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +-ellipse(+175:06:44.660,+50:56:53.323,7.928",3.964",326.717) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +-box(+175:06:39.530,+50:56:35.776,15.856",7.928",326.717) # color=yellow font="helvetica 10 bold roman" text={Box} +polygon(+175:06:31.722,+50:56:22.779,+175:06:17.685,+50:56:16.970,+175:06:26.903,+50:56:08.125,+175:06:40.939,+50:56:13.934) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +-line(+175:06:32.927,+50:56:02.026,+175:06:13.393,+50:55:52.432) # line=1 1 color=cyan text={Line} +# vector(+175:06:20.154,+50:55:44.667,7.928",326.717) vector=1 color=red text={Vector} +# text(+175:06:20.956,+50:55:33.430) color=magenta font="helvetica 14 bold roman" text={Region} +# ruler(+175:07:14.900,+50:56:21.236,+175:06:52.643,+50:56:11.190) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +annulus(+175:07:19.163,+50:57:05.414,1.982",3.964",5.946") # color=magenta font="helvetica 10 bold roman" text={Annulus} +ellipse(+175:07:14.964,+50:56:48.757,2.973",1.4865",5.946",2.973",326.717) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +box(+175:07:09.715,+50:56:31.833,7.928",3.964",11.892",5.946",326.717) # font="helvetica 10 bold roman" text={Box Annulus} +point(+175:07:48.259,+50:57:03.028) # point=circle text={Circle Point} +point(+175:07:43.186,+50:56:45.675) # point=box color=red width=3 text={Box Point} +point(+175:07:37.393,+50:56:30.037) # point=diamond text={Diamond Point} +point(+175:08:02.394,+50:56:58.143) # point=cross color=blue text={Cross Point} +point(+175:07:57.227,+50:56:43.435) # point=x text={X Point} +point(+175:07:53.228,+50:56:28.371) # point=arrow color=magenta text={Arrow Point} +point(+175:08:13.115,+50:56:40.951) # point=boxcircle text={BoxCircle Point} +# projection(+175:07:11.338,+50:56:00.651,+175:06:45.077,+50:55:45.258,3.964") text={Projection} +panda(+175:07:31.067,+50:56:10.824,281.717,551.717,3,0",5.946",2) # text={Panda} +panda(+175:07:58.962,+50:56:06.771,333.299,371.717,1,0",2.973",1) # panda=(333.299 11.7173 101.717 191.717)(0" 2.973" 5.946") text={Panda 2} +panda(+175:07:58.962,+50:56:06.771,333.299,371.717,1,2.973",5.946",1) # panda=ignore +panda(+175:07:58.962,+50:56:06.771,11.7173,101.717,1,0",2.973",1) # panda=ignore +panda(+175:07:58.962,+50:56:06.771,11.7173,101.717,1,2.973",5.946",1) # panda=ignore +panda(+175:07:58.962,+50:56:06.771,101.717,191.717,1,0",2.973",1) # panda=ignore +panda(+175:07:58.962,+50:56:06.771,101.717,191.717,1,2.973",5.946",1) # panda=ignore +# compass(+175:06:57.081,+50:55:37.819,7.928") compass=physical {N} {E} 1 1 text={Compass} +epanda(+175:07:28.292,+50:55:54.588,281.717,551.717,3,2.973",1.4865",5.946",2.973",1,326.717) # text={Epanda} +epanda(+175:07:55.505,+50:55:50.422,326.717,371.717,1,2.973",1.4865",5.946",2.973",1,326.717) # epanda=(326.717 11.7173 101.717 191.717)(2.973" 1.4865" 5.946" 2.973")(326.717) text={Epanda 2} +epanda(+175:07:55.505,+50:55:50.422,11.7173,101.717,1,2.973",1.4865",5.946",2.973",1,326.717) # epanda=ignore +epanda(+175:07:55.505,+50:55:50.422,101.717,191.717,1,2.973",1.4865",5.946",2.973",1,326.717) # epanda=ignore +bpanda(+175:07:22.735,+50:55:37.704,281.717,551.717,3,7.928",3.964",11.892",5.946",1,326.717) # text={Bpanda} +bpanda(+175:07:50.085,+50:55:34.937,326.717,371.717,1,7.928",3.964",11.892",5.946",1,326.717) # bpanda=(326.717 11.7173 101.717 191.717)(7.928" 3.964" 11.892" 5.946")(326.717) text={Bpanda 2} +bpanda(+175:07:50.085,+50:55:34.937,11.7173,101.717,1,7.928",3.964",11.892",5.946",1,326.717) # bpanda=ignore +bpanda(+175:07:50.085,+50:55:34.937,101.717,191.717,1,7.928",3.964",11.892",5.946",1,326.717) # bpanda=ignore +# segment(+175:06:02.705,+50:55:33.587,+175:06:14.128,+50:55:29.262,+175:06:12.470,+50:55:24.216) text={Segment} diff --git a/regions/io/tests/data/ds9.ecliptic.hms.strip.reg b/regions/io/tests/data/ds9.ecliptic.hms.strip.reg new file mode 100644 index 00000000..355db4b7 --- /dev/null +++ b/regions/io/tests/data/ds9.ecliptic.hms.strip.reg @@ -0,0 +1 @@ +ecliptic;circle(+175:06:44.660,+50:57:09.921,3.964");-ellipse(+175:06:44.660,+50:56:53.323,7.928",3.964",326.717);-box(+175:06:39.530,+50:56:35.776,15.856",7.928",326.717);polygon(+175:06:31.722,+50:56:22.779,+175:06:17.685,+50:56:16.970,+175:06:26.903,+50:56:08.125,+175:06:40.939,+50:56:13.934);-line(+175:06:32.927,+50:56:02.026,+175:06:13.393,+50:55:52.432);annulus(+175:07:19.163,+50:57:05.414,1.982",3.964",5.946");ellipse(+175:07:14.964,+50:56:48.757,2.973",1.4865",5.946",2.973",326.717);box(+175:07:09.715,+50:56:31.833,7.928",3.964",11.892",5.946",326.717);point(+175:07:48.259,+50:57:03.028);point(+175:07:43.186,+50:56:45.675);point(+175:07:37.393,+50:56:30.037);point(+175:08:02.394,+50:56:58.143);point(+175:07:57.227,+50:56:43.435);point(+175:07:53.228,+50:56:28.371);point(+175:08:13.115,+50:56:40.951);panda(+175:07:31.067,+50:56:10.824,281.717,551.717,3,0",5.946",2);panda(+175:07:58.962,+50:56:06.771,333.299,371.717,1,0",2.973",1);panda(+175:07:58.962,+50:56:06.771,333.299,371.717,1,2.973",5.946",1);panda(+175:07:58.962,+50:56:06.771,11.7173,101.717,1,0",2.973",1);panda(+175:07:58.962,+50:56:06.771,11.7173,101.717,1,2.973",5.946",1);panda(+175:07:58.962,+50:56:06.771,101.717,191.717,1,0",2.973",1);panda(+175:07:58.962,+50:56:06.771,101.717,191.717,1,2.973",5.946",1);epanda(+175:07:28.292,+50:55:54.588,281.717,551.717,3,2.973",1.4865",5.946",2.973",1,326.717);epanda(+175:07:55.505,+50:55:50.422,326.717,371.717,1,2.973",1.4865",5.946",2.973",1,326.717);epanda(+175:07:55.505,+50:55:50.422,11.7173,101.717,1,2.973",1.4865",5.946",2.973",1,326.717);epanda(+175:07:55.505,+50:55:50.422,101.717,191.717,1,2.973",1.4865",5.946",2.973",1,326.717);bpanda(+175:07:22.735,+50:55:37.704,281.717,551.717,3,7.928",3.964",11.892",5.946",1,326.717);bpanda(+175:07:50.085,+50:55:34.937,326.717,371.717,1,7.928",3.964",11.892",5.946",1,326.717);bpanda(+175:07:50.085,+50:55:34.937,11.7173,101.717,1,7.928",3.964",11.892",5.946",1,326.717);bpanda(+175:07:50.085,+50:55:34.937,101.717,191.717,1,7.928",3.964",11.892",5.946",1,326.717); \ No newline at end of file diff --git a/regions/io/tests/data/ds9.ecliptic.reg b/regions/io/tests/data/ds9.ecliptic.reg new file mode 100644 index 00000000..35387102 --- /dev/null +++ b/regions/io/tests/data/ds9.ecliptic.reg @@ -0,0 +1,39 @@ +# Region file format: DS9 version 4.1 +global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1 +ecliptic +circle(175.11241,50.952756,3.9640007") # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +-ellipse(175.11241,50.948145,7.9280014",3.9640007",326.71725) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +-box(175.11098,50.943271,15.856003",7.9280014",326.71725) # color=yellow font="helvetica 10 bold roman" text={Box} +polygon(175.10881,50.939661,175.10491,50.938047,175.10747,50.93559,175.11137,50.937204) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +-line(175.10915,50.933896,175.10372,50.931231) # line=1 1 color=cyan text={Line} +# vector(175.1056,50.929074,7.9280014",326.71725) vector=1 color=red text={Vector} +# text(175.10582,50.925953) color=magenta font="helvetica 14 bold roman" text={Region} +# ruler(175.12081,50.939232,175.11462,50.936442) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +annulus(175.12199,50.951504,1.9820003",3.9640007",5.946001") # color=magenta font="helvetica 10 bold roman" text={Annulus} +ellipse(175.12082,50.946877,2.9730005",1.4865003",5.946001",2.9730005",326.71725) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +box(175.11937,50.942176,7.9280014",3.9640007",11.892002",5.946001",326.71725) # font="helvetica 10 bold roman" text={Box Annulus} +point(175.13007,50.950841) # point=circle text={Circle Point} +point(175.12866,50.946021) # point=box color=red width=3 text={Box Point} +point(175.12705,50.941677) # point=diamond text={Diamond Point} +point(175.134,50.949484) # point=cross color=blue text={Cross Point} +point(175.13256,50.945398) # point=x text={X Point} +point(175.13145,50.941214) # point=arrow color=magenta text={Arrow Point} +point(175.13698,50.944709) # point=boxcircle text={BoxCircle Point} +# projection(175.11982,50.933514,175.11252,50.929238,3.9640007") text={Projection} +panda(175.1253,50.93634,281.71725,551.71725,3,0",5.946001",2) # text={Panda} +panda(175.13305,50.935214,333.29915,371.71725,1,0",2.9730005",1) # panda=(333.29915 11.717254 101.71725 191.71725)(0" 2.9730005" 5.946001") text={Panda 2} +panda(175.13305,50.935214,333.29915,371.71725,1,2.9730005",5.946001",1) # panda=ignore +panda(175.13305,50.935214,11.717254,101.71725,1,0",2.9730005",1) # panda=ignore +panda(175.13305,50.935214,11.717254,101.71725,1,2.9730005",5.946001",1) # panda=ignore +panda(175.13305,50.935214,101.71725,191.71725,1,0",2.9730005",1) # panda=ignore +panda(175.13305,50.935214,101.71725,191.71725,1,2.9730005",5.946001",1) # panda=ignore +# compass(175.11586,50.927172,7.9280014") compass=physical {N} {E} 1 1 text={Compass} +epanda(175.12453,50.93183,281.71725,551.71725,3,2.9730005",1.4865003",5.946001",2.9730005",1,326.71725) # text={Epanda} +epanda(175.13208,50.930673,326.71725,371.71725,1,2.9730005",1.4865003",5.946001",2.9730005",1,326.71725) # epanda=(326.71725 11.717254 101.71725 191.71725)(2.9730005" 1.4865003" 5.946001" 2.9730005")(326.71725) text={Epanda 2} +epanda(175.13208,50.930673,11.717254,101.71725,1,2.9730005",1.4865003",5.946001",2.9730005",1,326.71725) # epanda=ignore +epanda(175.13208,50.930673,101.71725,191.71725,1,2.9730005",1.4865003",5.946001",2.9730005",1,326.71725) # epanda=ignore +bpanda(175.12298,50.92714,281.71725,551.71725,3,7.9280014",3.9640007",11.892002",5.946001",1,326.71725) # text={Bpanda} +bpanda(175.13058,50.926371,326.71725,371.71725,1,7.9280014",3.9640007",11.892002",5.946001",1,326.71725) # bpanda=(326.71725 11.717254 101.71725 191.71725)(7.9280014" 3.9640007" 11.892002" 5.946001")(326.71725) text={Bpanda 2} +bpanda(175.13058,50.926371,11.717254,101.71725,1,7.9280014",3.9640007",11.892002",5.946001",1,326.71725) # bpanda=ignore +bpanda(175.13058,50.926371,101.71725,191.71725,1,7.9280014",3.9640007",11.892002",5.946001",1,326.71725) # bpanda=ignore +# segment(175.10075,50.925996,175.10392,50.924795,175.10346,50.923393) text={Segment} diff --git a/regions/io/tests/data/ds9.ecliptic.strip.reg b/regions/io/tests/data/ds9.ecliptic.strip.reg new file mode 100644 index 00000000..fa9f73a5 --- /dev/null +++ b/regions/io/tests/data/ds9.ecliptic.strip.reg @@ -0,0 +1 @@ +ecliptic;circle(175.11241,50.952756,3.9640007");-ellipse(175.11241,50.948145,7.9280014",3.9640007",326.71725);-box(175.11098,50.943271,15.856003",7.9280014",326.71725);polygon(175.10881,50.939661,175.10491,50.938047,175.10747,50.93559,175.11137,50.937204);-line(175.10915,50.933896,175.10372,50.931231);annulus(175.12199,50.951504,1.9820003",3.9640007",5.946001");ellipse(175.12082,50.946877,2.9730005",1.4865003",5.946001",2.9730005",326.71725);box(175.11937,50.942176,7.9280014",3.9640007",11.892002",5.946001",326.71725);point(175.13007,50.950841);point(175.12866,50.946021);point(175.12705,50.941677);point(175.134,50.949484);point(175.13256,50.945398);point(175.13145,50.941214);point(175.13698,50.944709);panda(175.1253,50.93634,281.71725,551.71725,3,0",5.946001",2);panda(175.13305,50.935214,333.29915,371.71725,1,0",2.9730005",1);panda(175.13305,50.935214,333.29915,371.71725,1,2.9730005",5.946001",1);panda(175.13305,50.935214,11.717254,101.71725,1,0",2.9730005",1);panda(175.13305,50.935214,11.717254,101.71725,1,2.9730005",5.946001",1);panda(175.13305,50.935214,101.71725,191.71725,1,0",2.9730005",1);panda(175.13305,50.935214,101.71725,191.71725,1,2.9730005",5.946001",1);epanda(175.12453,50.93183,281.71725,551.71725,3,2.9730005",1.4865003",5.946001",2.9730005",1,326.71725);epanda(175.13208,50.930673,326.71725,371.71725,1,2.9730005",1.4865003",5.946001",2.9730005",1,326.71725);epanda(175.13208,50.930673,11.717254,101.71725,1,2.9730005",1.4865003",5.946001",2.9730005",1,326.71725);epanda(175.13208,50.930673,101.71725,191.71725,1,2.9730005",1.4865003",5.946001",2.9730005",1,326.71725);bpanda(175.12298,50.92714,281.71725,551.71725,3,7.9280014",3.9640007",11.892002",5.946001",1,326.71725);bpanda(175.13058,50.926371,326.71725,371.71725,1,7.9280014",3.9640007",11.892002",5.946001",1,326.71725);bpanda(175.13058,50.926371,11.717254,101.71725,1,7.9280014",3.9640007",11.892002",5.946001",1,326.71725);bpanda(175.13058,50.926371,101.71725,191.71725,1,7.9280014",3.9640007",11.892002",5.946001",1,326.71725); \ No newline at end of file diff --git a/regions/io/tests/data/ds9.fits.reg b/regions/io/tests/data/ds9.fits.reg new file mode 100644 index 00000000..c01dd43f --- /dev/null +++ b/regions/io/tests/data/ds9.fits.reg @@ -0,0 +1,12 @@ +# Region file format: DS9 version 4.1 +global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1 +physical +circle(383,1153,40) +box(679,1149,160,80,0) +-box(1057,1155,160,80,30) +box(675,979,160,80,0) +box(1065,979,160,80,30) +-ellipse(399,777,80,40,30) +point(687,773) # point=boxcircle +annulus(685,561,20,60) +polygon(1014,805,1151,805,1151,668,1051,685) diff --git a/regions/io/tests/data/ds9.fk4.hms.reg b/regions/io/tests/data/ds9.fk4.hms.reg new file mode 100644 index 00000000..9bd1b82b --- /dev/null +++ b/regions/io/tests/data/ds9.fk4.hms.reg @@ -0,0 +1,39 @@ +# Region file format: DS9 version 4.1 +global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1 +fk4 +circle(13:27:50.384,+47:27:57.76,3.964") # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +-ellipse(13:27:49.426,+47:27:44.31,7.928",3.964",2.55413) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +-box(13:27:48.154,+47:27:31.98,15.856",7.928",2.55413) # color=yellow font="helvetica 10 bold roman" text={Box} +polygon(13:27:47.011,+47:27:24.32,13:27:45.968,+47:27:24.79,13:27:45.922,+47:27:14.22,13:27:46.964,+47:27:13.75) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +-line(13:27:45.873,+47:27:07.05,13:27:44.336,+47:27:06.48) # line=1 1 color=cyan text={Line} +# vector(13:27:44.228,+47:26:57.70,7.928",2.55413) vector=1 color=red text={Vector} +# text(13:27:43.620,+47:26:48.29) color=magenta font="helvetica 14 bold roman" text={Region} +# ruler(13:27:49.096,+47:27:07.14,13:27:47.395,+47:27:07.21) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +annulus(13:27:51.861,+47:27:41.38,1.982",3.964",5.946") # color=magenta font="helvetica 10 bold roman" text={Annulus} +ellipse(13:27:50.688,+47:27:29.43,2.973",1.4865",5.946",2.973",2.55413) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +box(13:27:49.447,+47:27:17.65,7.928",3.964",11.892",5.946",2.55413) # font="helvetica 10 bold roman" text={Box Annulus} +point(13:27:53.189,+47:27:28.71) # point=circle text={Circle Point} +point(13:27:51.931,+47:27:16.52) # point=box color=red width=3 text={Box Point} +point(13:27:50.737,+47:27:05.98) # point=diamond text={Diamond Point} +point(13:27:53.618,+47:27:19.54) # point=cross color=blue text={Cross Point} +point(13:27:52.509,+47:27:09.52) # point=x text={X Point} +point(13:27:51.438,+47:26:58.79) # point=arrow color=magenta text={Arrow Point} +point(13:27:53.166,+47:27:01.65) # point=boxcircle text={BoxCircle Point} +# projection(13:27:47.729,+47:26:51.77,13:27:45.517,+47:26:48.98,3.964") text={Projection} +panda(13:27:49.309,+47:26:52.74,317.554,587.554,3,0",5.946",2) # text={Panda} +panda(13:27:50.481,+47:26:39.16,9.13603,47.5541,1,0",2.973",1) # panda=(9.13603 47.5541 137.554 227.554)(0" 2.973" 5.946") text={Panda 2} +panda(13:27:50.481,+47:26:39.16,9.13603,47.5541,1,2.973",5.946",1) # panda=ignore +panda(13:27:50.481,+47:26:39.16,47.5541,137.554,1,0",2.973",1) # panda=ignore +panda(13:27:50.481,+47:26:39.16,47.5541,137.554,1,2.973",5.946",1) # panda=ignore +panda(13:27:50.481,+47:26:39.16,137.554,227.554,1,0",2.973",1) # panda=ignore +panda(13:27:50.481,+47:26:39.16,137.554,227.554,1,2.973",5.946",1) # panda=ignore +# compass(13:27:45.693,+47:26:38.52,7.928") compass=physical {N} {E} 1 1 text={Compass} +epanda(13:27:48.233,+47:26:40.60,317.554,587.554,3,2.973",1.4865",5.946",2.973",1,2.55413) # text={Epanda} +epanda(13:27:49.363,+47:26:27.18,2.55413,47.5541,1,2.973",1.4865",5.946",2.973",1,2.55413) # epanda=(2.55413 47.5541 137.554 227.554)(2.973" 1.4865" 5.946" 2.973")(2.55413) text={Epanda 2} +epanda(13:27:49.363,+47:26:27.18,47.5541,137.554,1,2.973",1.4865",5.946",2.973",1,2.55413) # epanda=ignore +epanda(13:27:49.363,+47:26:27.18,137.554,227.554,1,2.973",1.4865",5.946",2.973",1,2.55413) # epanda=ignore +bpanda(13:27:46.979,+47:26:28.96,317.554,587.554,3,7.928",3.964",11.892",5.946",1,2.55413) # text={Bpanda} +bpanda(13:27:48.197,+47:26:16.63,2.55413,47.5541,1,7.928",3.964",11.892",5.946",1,2.55413) # bpanda=(2.55413 47.5541 137.554 227.554)(7.928" 3.964" 11.892" 5.946")(2.55413) text={Bpanda 2} +bpanda(13:27:48.197,+47:26:16.63,47.5541,137.554,1,7.928",3.964",11.892",5.946",1,2.55413) # bpanda=ignore +bpanda(13:27:48.197,+47:26:16.63,137.554,227.554,1,7.928",3.964",11.892",5.946",1,2.55413) # bpanda=ignore +# segment(13:27:42.709,+47:26:55.15,13:27:43.035,+47:26:47.43,13:27:42.661,+47:26:43.95) text={Segment} diff --git a/regions/io/tests/data/ds9.fk4.hms.strip.reg b/regions/io/tests/data/ds9.fk4.hms.strip.reg new file mode 100644 index 00000000..a84c218a --- /dev/null +++ b/regions/io/tests/data/ds9.fk4.hms.strip.reg @@ -0,0 +1 @@ +fk4;circle(13:27:50.384,+47:27:57.76,3.964");-ellipse(13:27:49.426,+47:27:44.31,7.928",3.964",2.55413);-box(13:27:48.154,+47:27:31.98,15.856",7.928",2.55413);polygon(13:27:47.011,+47:27:24.32,13:27:45.968,+47:27:24.79,13:27:45.922,+47:27:14.22,13:27:46.964,+47:27:13.75);-line(13:27:45.873,+47:27:07.05,13:27:44.336,+47:27:06.48);annulus(13:27:51.861,+47:27:41.38,1.982",3.964",5.946");ellipse(13:27:50.688,+47:27:29.43,2.973",1.4865",5.946",2.973",2.55413);box(13:27:49.447,+47:27:17.65,7.928",3.964",11.892",5.946",2.55413);point(13:27:53.189,+47:27:28.71);point(13:27:51.931,+47:27:16.52);point(13:27:50.737,+47:27:05.98);point(13:27:53.618,+47:27:19.54);point(13:27:52.509,+47:27:09.52);point(13:27:51.438,+47:26:58.79);point(13:27:53.166,+47:27:01.65);panda(13:27:49.309,+47:26:52.74,317.554,587.554,3,0",5.946",2);panda(13:27:50.481,+47:26:39.16,9.13603,47.5541,1,0",2.973",1);panda(13:27:50.481,+47:26:39.16,9.13603,47.5541,1,2.973",5.946",1);panda(13:27:50.481,+47:26:39.16,47.5541,137.554,1,0",2.973",1);panda(13:27:50.481,+47:26:39.16,47.5541,137.554,1,2.973",5.946",1);panda(13:27:50.481,+47:26:39.16,137.554,227.554,1,0",2.973",1);panda(13:27:50.481,+47:26:39.16,137.554,227.554,1,2.973",5.946",1);epanda(13:27:48.233,+47:26:40.60,317.554,587.554,3,2.973",1.4865",5.946",2.973",1,2.55413);epanda(13:27:49.363,+47:26:27.18,2.55413,47.5541,1,2.973",1.4865",5.946",2.973",1,2.55413);epanda(13:27:49.363,+47:26:27.18,47.5541,137.554,1,2.973",1.4865",5.946",2.973",1,2.55413);epanda(13:27:49.363,+47:26:27.18,137.554,227.554,1,2.973",1.4865",5.946",2.973",1,2.55413);bpanda(13:27:46.979,+47:26:28.96,317.554,587.554,3,7.928",3.964",11.892",5.946",1,2.55413);bpanda(13:27:48.197,+47:26:16.63,2.55413,47.5541,1,7.928",3.964",11.892",5.946",1,2.55413);bpanda(13:27:48.197,+47:26:16.63,47.5541,137.554,1,7.928",3.964",11.892",5.946",1,2.55413);bpanda(13:27:48.197,+47:26:16.63,137.554,227.554,1,7.928",3.964",11.892",5.946",1,2.55413); \ No newline at end of file diff --git a/regions/io/tests/data/ds9.fk4.reg b/regions/io/tests/data/ds9.fk4.reg new file mode 100644 index 00000000..0d57a43a --- /dev/null +++ b/regions/io/tests/data/ds9.fk4.reg @@ -0,0 +1,39 @@ +# Region file format: DS9 version 4.1 +global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1 +fk4 +circle(201.95993,47.466046,3.9640007") # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +-ellipse(201.95594,47.462308,7.9280014",3.9640007",2.5541322) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +-box(201.95064,47.458883,15.856003",7.9280014",2.5541322) # color=yellow font="helvetica 10 bold roman" text={Box} +polygon(201.94588,47.456757,201.94153,47.456887,201.94134,47.453951,201.94568,47.45382) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +-line(201.94114,47.45196,201.93473,47.451801) # line=1 1 color=cyan text={Line} +# vector(201.93428,47.44936,7.9280014",2.5541322) vector=1 color=red text={Vector} +# text(201.93175,47.446747) color=magenta font="helvetica 14 bold roman" text={Region} +# ruler(201.95457,47.451984,201.94748,47.452003) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +annulus(201.96609,47.461495,1.9820003",3.9640007",5.946001") # color=magenta font="helvetica 10 bold roman" text={Annulus} +ellipse(201.9612,47.458175,2.9730005",1.4865003",5.946001",2.9730005",2.5541322) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +box(201.95603,47.454902,7.9280014",3.9640007",11.892002",5.946001",2.5541322) # font="helvetica 10 bold roman" text={Box Annulus} +point(201.97162,47.457976) # point=circle text={Circle Point} +point(201.96638,47.454589) # point=box color=red width=3 text={Box Point} +point(201.9614,47.451661) # point=diamond text={Diamond Point} +point(201.97341,47.455428) # point=cross color=blue text={Cross Point} +point(201.96879,47.452645) # point=x text={X Point} +point(201.96433,47.449663) # point=arrow color=magenta text={Arrow Point} +point(201.97152,47.450458) # point=boxcircle text={BoxCircle Point} +# projection(201.94887,47.447713,201.93966,47.446938,3.9640007") text={Projection} +panda(201.95546,47.447982,317.55413,587.55413,3,0",5.946001",2) # text={Panda} +panda(201.96034,47.444211,9.1360322,47.554132,1,0",2.9730005",1) # panda=(9.1360322 47.554132 137.55413 227.55413)(0" 2.9730005" 5.946001") text={Panda 2} +panda(201.96034,47.444211,9.1360322,47.554132,1,2.9730005",5.946001",1) # panda=ignore +panda(201.96034,47.444211,47.554132,137.55413,1,0",2.9730005",1) # panda=ignore +panda(201.96034,47.444211,47.554132,137.55413,1,2.9730005",5.946001",1) # panda=ignore +panda(201.96034,47.444211,137.55413,227.55413,1,0",2.9730005",1) # panda=ignore +panda(201.96034,47.444211,137.55413,227.55413,1,2.9730005",5.946001",1) # panda=ignore +# compass(201.94039,47.444033,7.9280014") compass=physical {N} {E} 1 1 text={Compass} +epanda(201.95097,47.444611,317.55413,587.55413,3,2.9730005",1.4865003",5.946001",2.9730005",1,2.5541322) # text={Epanda} +epanda(201.95568,47.440883,2.5541322,47.554132,1,2.9730005",1.4865003",5.946001",2.9730005",1,2.5541322) # epanda=(2.5541322 47.554132 137.55413 227.55413)(2.9730005" 1.4865003" 5.946001" 2.9730005")(2.5541322) text={Epanda 2} +epanda(201.95568,47.440883,47.554132,137.55413,1,2.9730005",1.4865003",5.946001",2.9730005",1,2.5541322) # epanda=ignore +epanda(201.95568,47.440883,137.55413,227.55413,1,2.9730005",1.4865003",5.946001",2.9730005",1,2.5541322) # epanda=ignore +bpanda(201.94574,47.441378,317.55413,587.55413,3,7.9280014",3.9640007",11.892002",5.946001",1,2.5541322) # text={Bpanda} +bpanda(201.95082,47.437951,2.5541322,47.554132,1,7.9280014",3.9640007",11.892002",5.946001",1,2.5541322) # bpanda=(2.5541322 47.554132 137.55413 227.55413)(7.9280014" 3.9640007" 11.892002" 5.946001")(2.5541322) text={Bpanda 2} +bpanda(201.95082,47.437951,47.554132,137.55413,1,7.9280014",3.9640007",11.892002",5.946001",1,2.5541322) # bpanda=ignore +bpanda(201.95082,47.437951,137.55413,227.55413,1,7.9280014",3.9640007",11.892002",5.946001",1,2.5541322) # bpanda=ignore +# segment(201.92796,47.448653,201.92931,47.446508,201.92775,47.445542) text={Segment} diff --git a/regions/io/tests/data/ds9.fk4.strip.reg b/regions/io/tests/data/ds9.fk4.strip.reg new file mode 100644 index 00000000..cfa668b1 --- /dev/null +++ b/regions/io/tests/data/ds9.fk4.strip.reg @@ -0,0 +1 @@ +fk4;circle(201.95993,47.466046,3.9640007");-ellipse(201.95594,47.462308,7.9280014",3.9640007",2.5541322);-box(201.95064,47.458883,15.856003",7.9280014",2.5541322);polygon(201.94588,47.456757,201.94153,47.456887,201.94134,47.453951,201.94568,47.45382);-line(201.94114,47.45196,201.93473,47.451801);annulus(201.96609,47.461495,1.9820003",3.9640007",5.946001");ellipse(201.9612,47.458175,2.9730005",1.4865003",5.946001",2.9730005",2.5541322);box(201.95603,47.454902,7.9280014",3.9640007",11.892002",5.946001",2.5541322);point(201.97162,47.457976);point(201.96638,47.454589);point(201.9614,47.451661);point(201.97341,47.455428);point(201.96879,47.452645);point(201.96433,47.449663);point(201.97152,47.450458);panda(201.95546,47.447982,317.55413,587.55413,3,0",5.946001",2);panda(201.96034,47.444211,9.1360322,47.554132,1,0",2.9730005",1);panda(201.96034,47.444211,9.1360322,47.554132,1,2.9730005",5.946001",1);panda(201.96034,47.444211,47.554132,137.55413,1,0",2.9730005",1);panda(201.96034,47.444211,47.554132,137.55413,1,2.9730005",5.946001",1);panda(201.96034,47.444211,137.55413,227.55413,1,0",2.9730005",1);panda(201.96034,47.444211,137.55413,227.55413,1,2.9730005",5.946001",1);epanda(201.95097,47.444611,317.55413,587.55413,3,2.9730005",1.4865003",5.946001",2.9730005",1,2.5541322);epanda(201.95568,47.440883,2.5541322,47.554132,1,2.9730005",1.4865003",5.946001",2.9730005",1,2.5541322);epanda(201.95568,47.440883,47.554132,137.55413,1,2.9730005",1.4865003",5.946001",2.9730005",1,2.5541322);epanda(201.95568,47.440883,137.55413,227.55413,1,2.9730005",1.4865003",5.946001",2.9730005",1,2.5541322);bpanda(201.94574,47.441378,317.55413,587.55413,3,7.9280014",3.9640007",11.892002",5.946001",1,2.5541322);bpanda(201.95082,47.437951,2.5541322,47.554132,1,7.9280014",3.9640007",11.892002",5.946001",1,2.5541322);bpanda(201.95082,47.437951,47.554132,137.55413,1,7.9280014",3.9640007",11.892002",5.946001",1,2.5541322);bpanda(201.95082,47.437951,137.55413,227.55413,1,7.9280014",3.9640007",11.892002",5.946001",1,2.5541322); \ No newline at end of file diff --git a/regions/io/tests/data/ds9.icrs.hms.reg b/regions/io/tests/data/ds9.icrs.hms.reg new file mode 100644 index 00000000..3968b32d --- /dev/null +++ b/regions/io/tests/data/ds9.icrs.hms.reg @@ -0,0 +1,39 @@ +# Region file format: DS9 version 4.1 +global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1 +icrs +circle(13:29:56.743,+47:12:30.42,3.964") # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +-ellipse(13:29:55.792,+47:12:16.94,7.928",3.964",2.39832) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +-box(13:29:54.530,+47:12:04.57,15.856",7.928",2.39832) # color=yellow font="helvetica 10 bold roman" text={Box} +polygon(13:29:53.394,+47:11:56.88,13:29:52.357,+47:11:57.33,13:29:52.314,+47:11:46.75,13:29:53.351,+47:11:46.31) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +-line(13:29:52.267,+47:11:39.58,13:29:50.737,+47:11:38.97) # line=1 1 color=cyan text={Line} +# vector(13:29:50.632,+47:11:30.18,7.928",2.39832) vector=1 color=red text={Vector} +# text(13:29:50.030,+47:11:20.76) color=magenta font="helvetica 14 bold roman" text={Region} +# ruler(13:29:55.474,+47:11:39.76,13:29:53.782,+47:11:39.78) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +annulus(13:29:58.217,+47:12:14.08,1.982",3.964",5.946") # color=magenta font="helvetica 10 bold roman" text={Annulus} +ellipse(13:29:57.053,+47:12:02.09,2.973",1.4865",5.946",2.973",2.39832) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +box(13:29:55.820,+47:11:50.27,7.928",3.964",11.892",5.946",2.39832) # font="helvetica 10 bold roman" text={Box Annulus} +point(13:29:59.541,+47:12:01.45) # point=circle text={Circle Point} +point(13:29:58.293,+47:11:49.22) # point=box color=red width=3 text={Box Point} +point(13:29:57.108,+47:11:38.64) # point=diamond text={Diamond Point} +point(13:29:59.971,+47:11:52.28) # point=cross color=blue text={Cross Point} +point(13:29:58.870,+47:11:42.24) # point=x text={X Point} +point(13:29:57.807,+47:11:31.47) # point=arrow color=magenta text={Arrow Point} +point(13:29:59.526,+47:11:34.38) # point=boxcircle text={BoxCircle Point} +# projection(13:29:54.118,+47:11:24.35,13:29:51.918,+47:11:21.50,3.964") text={Projection} +panda(13:29:55.691,+47:11:25.36,317.398,587.398,3,0",5.946",2) # text={Panda} +panda(13:29:56.859,+47:11:11.82,8.98022,47.3983,1,0",2.973",1) # panda=(8.98022 47.3983 137.398 227.398)(0" 2.973" 5.946") text={Panda 2} +panda(13:29:56.859,+47:11:11.82,8.98022,47.3983,1,2.973",5.946",1) # panda=ignore +panda(13:29:56.859,+47:11:11.82,47.3983,137.398,1,0",2.973",1) # panda=ignore +panda(13:29:56.859,+47:11:11.82,47.3983,137.398,1,2.973",5.946",1) # panda=ignore +panda(13:29:56.859,+47:11:11.82,137.398,227.398,1,0",2.973",1) # panda=ignore +panda(13:29:56.859,+47:11:11.82,137.398,227.398,1,2.973",5.946",1) # panda=ignore +# compass(13:29:52.095,+47:11:11.04,7.928") compass=physical {N} {E} 1 1 text={Compass} +epanda(13:29:54.622,+47:11:13.19,317.398,587.398,3,2.973",1.4865",5.946",2.973",1,2.39832) # text={Epanda} +epanda(13:29:55.751,+47:10:59.81,2.39832,47.3983,1,2.973",1.4865",5.946",2.973",1,2.39832) # epanda=(2.39832 47.3983 137.398 227.398)(2.973" 1.4865" 5.946" 2.973")(2.39832) text={Epanda 2} +epanda(13:29:55.751,+47:10:59.81,47.3983,137.398,1,2.973",1.4865",5.946",2.973",1,2.39832) # epanda=ignore +epanda(13:29:55.751,+47:10:59.81,137.398,227.398,1,2.973",1.4865",5.946",2.973",1,2.39832) # epanda=ignore +bpanda(13:29:53.377,+47:11:01.52,317.398,587.398,3,7.928",3.964",11.892",5.946",1,2.39832) # text={Bpanda} +bpanda(13:29:54.593,+47:10:49.22,2.39832,47.3983,1,7.928",3.964",11.892",5.946",1,2.39832) # bpanda=(2.39832 47.3983 137.398 227.398)(7.928" 3.964" 11.892" 5.946")(2.39832) text={Bpanda 2} +bpanda(13:29:54.593,+47:10:49.22,47.3983,137.398,1,7.928",3.964",11.892",5.946",1,2.39832) # bpanda=ignore +bpanda(13:29:54.593,+47:10:49.22,137.398,227.398,1,7.928",3.964",11.892",5.946",1,2.39832) # bpanda=ignore +# segment(13:29:49.122,+47:11:27.59,13:29:49.448,+47:11:19.88,13:29:49.076,+47:11:16.39) text={Segment} diff --git a/regions/io/tests/data/ds9.icrs.hms.strip.reg b/regions/io/tests/data/ds9.icrs.hms.strip.reg new file mode 100644 index 00000000..3baf7065 --- /dev/null +++ b/regions/io/tests/data/ds9.icrs.hms.strip.reg @@ -0,0 +1 @@ +icrs;circle(13:29:56.743,+47:12:30.42,3.964");-ellipse(13:29:55.792,+47:12:16.94,7.928",3.964",2.39832);-box(13:29:54.530,+47:12:04.57,15.856",7.928",2.39832);polygon(13:29:53.394,+47:11:56.88,13:29:52.357,+47:11:57.33,13:29:52.314,+47:11:46.75,13:29:53.351,+47:11:46.31);-line(13:29:52.267,+47:11:39.58,13:29:50.737,+47:11:38.97);annulus(13:29:58.217,+47:12:14.08,1.982",3.964",5.946");ellipse(13:29:57.053,+47:12:02.09,2.973",1.4865",5.946",2.973",2.39832);box(13:29:55.820,+47:11:50.27,7.928",3.964",11.892",5.946",2.39832);point(13:29:59.541,+47:12:01.45);point(13:29:58.293,+47:11:49.22);point(13:29:57.108,+47:11:38.64);point(13:29:59.971,+47:11:52.28);point(13:29:58.870,+47:11:42.24);point(13:29:57.807,+47:11:31.47);point(13:29:59.526,+47:11:34.38);panda(13:29:55.691,+47:11:25.36,317.398,587.398,3,0",5.946",2);panda(13:29:56.859,+47:11:11.82,8.98022,47.3983,1,0",2.973",1);panda(13:29:56.859,+47:11:11.82,8.98022,47.3983,1,2.973",5.946",1);panda(13:29:56.859,+47:11:11.82,47.3983,137.398,1,0",2.973",1);panda(13:29:56.859,+47:11:11.82,47.3983,137.398,1,2.973",5.946",1);panda(13:29:56.859,+47:11:11.82,137.398,227.398,1,0",2.973",1);panda(13:29:56.859,+47:11:11.82,137.398,227.398,1,2.973",5.946",1);epanda(13:29:54.622,+47:11:13.19,317.398,587.398,3,2.973",1.4865",5.946",2.973",1,2.39832);epanda(13:29:55.751,+47:10:59.81,2.39832,47.3983,1,2.973",1.4865",5.946",2.973",1,2.39832);epanda(13:29:55.751,+47:10:59.81,47.3983,137.398,1,2.973",1.4865",5.946",2.973",1,2.39832);epanda(13:29:55.751,+47:10:59.81,137.398,227.398,1,2.973",1.4865",5.946",2.973",1,2.39832);bpanda(13:29:53.377,+47:11:01.52,317.398,587.398,3,7.928",3.964",11.892",5.946",1,2.39832);bpanda(13:29:54.593,+47:10:49.22,2.39832,47.3983,1,7.928",3.964",11.892",5.946",1,2.39832);bpanda(13:29:54.593,+47:10:49.22,47.3983,137.398,1,7.928",3.964",11.892",5.946",1,2.39832);bpanda(13:29:54.593,+47:10:49.22,137.398,227.398,1,7.928",3.964",11.892",5.946",1,2.39832); \ No newline at end of file diff --git a/regions/io/tests/data/ds9.icrs.reg b/regions/io/tests/data/ds9.icrs.reg new file mode 100644 index 00000000..275961af --- /dev/null +++ b/regions/io/tests/data/ds9.icrs.reg @@ -0,0 +1,39 @@ +# Region file format: DS9 version 4.1 +global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1 +icrs +circle(202.48643,47.208449,3.9640007") # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +-ellipse(202.48247,47.204705,7.9280014",3.9640007",2.3983198) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +-box(202.47721,47.20127,15.856003",7.9280014",2.3983198) # color=yellow font="helvetica 10 bold roman" text={Box} +polygon(202.47248,47.199135,202.46815,47.199257,202.46797,47.19632,202.4723,47.196198) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +-line(202.46778,47.194329,202.4614,47.194159) # line=1 1 color=cyan text={Line} +# vector(202.46097,47.191716,7.9280014",2.3983198) vector=1 color=red text={Vector} +# text(202.45846,47.189099) color=magenta font="helvetica 14 bold roman" text={Region} +# ruler(202.48114,47.194378,202.47409,47.194384) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +annulus(202.49257,47.20391,1.9820003",3.9640007",5.946001") # color=magenta font="helvetica 10 bold roman" text={Annulus} +ellipse(202.48772,47.200581,2.9730005",1.4865003",5.946001",2.9730005",2.3983198) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +box(202.48259,47.197298,7.9280014",3.9640007",11.892002",5.946001",2.3983198) # font="helvetica 10 bold roman" text={Box Annulus} +point(202.49809,47.200401) # point=circle text={Circle Point} +point(202.49289,47.197004) # point=box color=red width=3 text={Box Point} +point(202.48795,47.194067) # point=diamond text={Diamond Point} +point(202.49988,47.197856) # point=cross color=blue text={Cross Point} +point(202.49529,47.195065) # point=x text={X Point} +point(202.49086,47.192075) # point=arrow color=magenta text={Arrow Point} +point(202.49802,47.192883) # point=boxcircle text={BoxCircle Point} +# projection(202.47549,47.190097,202.46632,47.189305,3.9640007") text={Projection} +panda(202.48204,47.190378,317.39832,587.39832,3,0",5.946001",2) # text={Panda} +panda(202.48691,47.186615,8.9802198,47.39832,1,0",2.9730005",1) # panda=(8.9802198 47.39832 137.39832 227.39832)(0" 2.9730005" 5.946001") text={Panda 2} +panda(202.48691,47.186615,8.9802198,47.39832,1,2.9730005",5.946001",1) # panda=ignore +panda(202.48691,47.186615,47.39832,137.39832,1,0",2.9730005",1) # panda=ignore +panda(202.48691,47.186615,47.39832,137.39832,1,2.9730005",5.946001",1) # panda=ignore +panda(202.48691,47.186615,137.39832,227.39832,1,0",2.9730005",1) # panda=ignore +panda(202.48691,47.186615,137.39832,227.39832,1,2.9730005",5.946001",1) # panda=ignore +# compass(202.46706,47.186401,7.9280014") compass=physical {N} {E} 1 1 text={Compass} +epanda(202.47759,47.186998,317.39832,587.39832,3,2.9730005",1.4865003",5.946001",2.9730005",1,2.3983198) # text={Epanda} +epanda(202.48229,47.183279,2.3983198,47.39832,1,2.9730005",1.4865003",5.946001",2.9730005",1,2.3983198) # epanda=(2.3983198 47.39832 137.39832 227.39832)(2.9730005" 1.4865003" 5.946001" 2.9730005")(2.3983198) text={Epanda 2} +epanda(202.48229,47.183279,47.39832,137.39832,1,2.9730005",1.4865003",5.946001",2.9730005",1,2.3983198) # epanda=ignore +epanda(202.48229,47.183279,137.39832,227.39832,1,2.9730005",1.4865003",5.946001",2.9730005",1,2.3983198) # epanda=ignore +bpanda(202.47241,47.183755,317.39832,587.39832,3,7.9280014",3.9640007",11.892002",5.946001",1,2.3983198) # text={Bpanda} +bpanda(202.47747,47.180338,2.3983198,47.39832,1,7.9280014",3.9640007",11.892002",5.946001",1,2.3983198) # bpanda=(2.3983198 47.39832 137.39832 227.39832)(7.9280014" 3.9640007" 11.892002" 5.946001")(2.3983198) text={Bpanda 2} +bpanda(202.47747,47.180338,47.39832,137.39832,1,7.9280014",3.9640007",11.892002",5.946001",1,2.3983198) # bpanda=ignore +bpanda(202.47747,47.180338,137.39832,227.39832,1,7.9280014",3.9640007",11.892002",5.946001",1,2.3983198) # bpanda=ignore +# segment(202.45468,47.190998,202.45603,47.188856,202.45448,47.187886) text={Segment} diff --git a/regions/io/tests/data/ds9.icrs.strip.reg b/regions/io/tests/data/ds9.icrs.strip.reg new file mode 100644 index 00000000..22541326 --- /dev/null +++ b/regions/io/tests/data/ds9.icrs.strip.reg @@ -0,0 +1 @@ +icrs;circle(202.48643,47.208449,3.9640007");-ellipse(202.48247,47.204705,7.9280014",3.9640007",2.3983198);-box(202.47721,47.20127,15.856003",7.9280014",2.3983198);polygon(202.47248,47.199135,202.46815,47.199257,202.46797,47.19632,202.4723,47.196198);-line(202.46778,47.194329,202.4614,47.194159);annulus(202.49257,47.20391,1.9820003",3.9640007",5.946001");ellipse(202.48772,47.200581,2.9730005",1.4865003",5.946001",2.9730005",2.3983198);box(202.48259,47.197298,7.9280014",3.9640007",11.892002",5.946001",2.3983198);point(202.49809,47.200401);point(202.49289,47.197004);point(202.48795,47.194067);point(202.49988,47.197856);point(202.49529,47.195065);point(202.49086,47.192075);point(202.49802,47.192883);panda(202.48204,47.190378,317.39832,587.39832,3,0",5.946001",2);panda(202.48691,47.186615,8.9802198,47.39832,1,0",2.9730005",1);panda(202.48691,47.186615,8.9802198,47.39832,1,2.9730005",5.946001",1);panda(202.48691,47.186615,47.39832,137.39832,1,0",2.9730005",1);panda(202.48691,47.186615,47.39832,137.39832,1,2.9730005",5.946001",1);panda(202.48691,47.186615,137.39832,227.39832,1,0",2.9730005",1);panda(202.48691,47.186615,137.39832,227.39832,1,2.9730005",5.946001",1);epanda(202.47759,47.186998,317.39832,587.39832,3,2.9730005",1.4865003",5.946001",2.9730005",1,2.3983198);epanda(202.48229,47.183279,2.3983198,47.39832,1,2.9730005",1.4865003",5.946001",2.9730005",1,2.3983198);epanda(202.48229,47.183279,47.39832,137.39832,1,2.9730005",1.4865003",5.946001",2.9730005",1,2.3983198);epanda(202.48229,47.183279,137.39832,227.39832,1,2.9730005",1.4865003",5.946001",2.9730005",1,2.3983198);bpanda(202.47241,47.183755,317.39832,587.39832,3,7.9280014",3.9640007",11.892002",5.946001",1,2.3983198);bpanda(202.47747,47.180338,2.3983198,47.39832,1,7.9280014",3.9640007",11.892002",5.946001",1,2.3983198);bpanda(202.47747,47.180338,47.39832,137.39832,1,7.9280014",3.9640007",11.892002",5.946001",1,2.3983198);bpanda(202.47747,47.180338,137.39832,227.39832,1,7.9280014",3.9640007",11.892002",5.946001",1,2.3983198); \ No newline at end of file diff --git a/regions/io/tests/data/ds9.image.reg b/regions/io/tests/data/ds9.image.reg new file mode 100644 index 00000000..8a602e53 --- /dev/null +++ b/regions/io/tests/data/ds9.image.reg @@ -0,0 +1,39 @@ +# Region file format: DS9 version 4.1 +global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1 +image +circle(166,546,20) # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +-ellipse(248,529,40,20,45) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +-box(338,527,80,40,45) # color=yellow font="helvetica 10 bold roman" text={Box} +polygon(407.24723,538,445,575.75275,482.75277,538,445,500.24723) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +-line(509,513,569,564) # line=1 1 color=cyan text={Line} +# vector(603,535,40,45) vector=1 color=red text={Vector} +# text(658,521) color=magenta font="helvetica 14 bold roman" text={Region} +# ruler(387,402,451,461) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +annulus(166,434,10,20,30) # color=magenta font="helvetica 10 bold roman" text={Annulus} +ellipse(251,430,15,7.5,30,15,45) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +box(338,429,40,20,60,30,45) # font="helvetica 10 bold roman" text={Box Annulus} +point(159,341) # point=circle text={Circle Point} +point(248,339) # point=box color=red width=3 text={Box Point} +point(329,341) # point=diamond text={Diamond Point} +point(174,292) # point=cross color=blue text={Cross Point} +point(250,293) # point=x text={X Point} +point(327,290) # point=arrow color=magenta text={Arrow Point} +point(252,241) # point=boxcircle text={BoxCircle Point} +# projection(491,392,584,458,20) text={Projection} +panda(428,341,0,270,3,0,30,2) # text={Panda} +panda(430,250,51.5819,90,1,0,15,1) # panda=(51.5819 90 180 270)(0 15 30) text={Panda 2} +panda(430,250,51.5819,90,1,15,30,1) # panda=ignore +panda(430,250,90,180,1,0,15,1) # panda=ignore +panda(430,250,90,180,1,15,30,1) # panda=ignore +panda(430,250,180,270,1,0,15,1) # panda=ignore +panda(430,250,180,270,1,15,30,1) # panda=ignore +# compass(613,413,40) compass=physical {N} {E} 1 1 text={Compass} +epanda(510,333,0,270,3,15,7.5,30,15,1,45) # text={Epanda} +epanda(513,244,45,90,1,15,7.5,30,15,1,45) # epanda=(45 90 180 270)(15 7.5 30 15)(45) text={Epanda 2} +epanda(513,244,90,180,1,15,7.5,30,15,1,45) # epanda=ignore +epanda(513,244,180,270,1,15,7.5,30,15,1,45) # epanda=ignore +bpanda(597,333,0,270,3,40,20,60,30,1,45) # text={Bpanda} +bpanda(593,245,45,90,1,40,20,60,30,1,45) # bpanda=(45 90 180 270)(40 20 60 30)(45) text={Bpanda 2} +bpanda(593,245,90,180,1,40,20,60,30,1,45) # bpanda=ignore +bpanda(593,245,180,270,1,40,20,60,30,1,45) # bpanda=ignore +# segment(668.9973,577.99654,682.99709,537.99647,708.99709,537.99633) text={Segment} diff --git a/regions/io/tests/data/ds9.image.strip.reg b/regions/io/tests/data/ds9.image.strip.reg new file mode 100644 index 00000000..7236cae8 --- /dev/null +++ b/regions/io/tests/data/ds9.image.strip.reg @@ -0,0 +1 @@ +image;circle(166,546,20);-ellipse(248,529,40,20,45);-box(338,527,80,40,45);polygon(407.24723,538,445,575.75275,482.75277,538,445,500.24723);-line(509,513,569,564);annulus(166,434,10,20,30);ellipse(251,430,15,7.5,30,15,45);box(338,429,40,20,60,30,45);point(159,341);point(248,339);point(329,341);point(174,292);point(250,293);point(327,290);point(252,241);panda(428,341,0,270,3,0,30,2);panda(430,250,51.5819,90,1,0,15,1);panda(430,250,51.5819,90,1,15,30,1);panda(430,250,90,180,1,0,15,1);panda(430,250,90,180,1,15,30,1);panda(430,250,180,270,1,0,15,1);panda(430,250,180,270,1,15,30,1);epanda(510,333,0,270,3,15,7.5,30,15,1,45);epanda(513,244,45,90,1,15,7.5,30,15,1,45);epanda(513,244,90,180,1,15,7.5,30,15,1,45);epanda(513,244,180,270,1,15,7.5,30,15,1,45);bpanda(597,333,0,270,3,40,20,60,30,1,45);bpanda(593,245,45,90,1,40,20,60,30,1,45);bpanda(593,245,90,180,1,40,20,60,30,1,45);bpanda(593,245,180,270,1,40,20,60,30,1,45); \ No newline at end of file diff --git a/regions/io/tests/data/ds9.linear.wcs.reg b/regions/io/tests/data/ds9.linear.wcs.reg new file mode 100644 index 00000000..8278b7be --- /dev/null +++ b/regions/io/tests/data/ds9.linear.wcs.reg @@ -0,0 +1,143 @@ +# Region file format: DS9 version 4.1 +global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1 +wcs; +# tile 2 +circle(3975,3969,40) # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +# tile 2 +-ellipse(3811,3935,80,40,135) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +# tile 2 +-box(3631,3931,160,80,135) # color=yellow font="helvetica 10 bold roman" text={Box} +# tile 2 +polygon(3492.5055,3953,3417,4028.5055,3341.4945,3953,3417,3877.4945) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +# tile 2 +-line(3289,3903,3169,4005) # line=1 1 color=cyan text={Line} +# tile 2 +# vector(3101,3947,80,135) vector=1 color=red text={Vector} +# tile 2 +# text(2991,3919) color=magenta font="helvetica 14 bold roman" text={Region} +# tile 2 +# ruler(3533,3681,3405,3799) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +# tile 2 +annulus(3975,3745,20,40,60) # color=magenta font="helvetica 10 bold roman" text={Annulus} +# tile 2 +ellipse(3805,3737,30,15,60,30,135) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +# tile 2 +box(3631,3735,80,40,120,60,135) # font="helvetica 10 bold roman" text={Box Annulus} +# tile 2 +point(3989,3559) # point=circle text={Circle Point} +# tile 2 +point(3811,3555) # point=box color=red width=3 text={Box Point} +# tile 2 +point(3649,3559) # point=diamond text={Diamond Point} +# tile 2 +point(3959,3461) # point=cross color=blue text={Cross Point} +# tile 2 +point(3807,3463) # point=x text={X Point} +# tile 2 +point(3653,3457) # point=arrow color=magenta text={Arrow Point} +# tile 2 +point(3803,3359) # point=boxcircle text={BoxCircle Point} +# tile 2 +# projection(3325,3661,3139,3793,40) text={Projection} +# tile 2 +panda(3451,3559,180,270,3,0,60,2) # text={Panda} +# tile 2 +panda(3447,3377,128.4181,450,1,0,30,1) # panda=(128.4181 90 0 270)(0 30 60) text={Panda 2} +# tile 2 +panda(3447,3377,128.4181,450,1,30,60,1) # panda=ignore +# tile 2 +panda(3447,3377,90,360,1,0,30,1) # panda=ignore +# tile 2 +panda(3447,3377,90,360,1,30,60,1) # panda=ignore +# tile 2 +panda(3447,3377,0,270,1,0,30,1) # panda=ignore +# tile 2 +panda(3447,3377,0,270,1,30,60,1) # panda=ignore +# tile 2 +# compass(3081,3703,80) compass=physical {N} {E} 1 1 text={Compass} +# tile 2 +epanda(3287,3543,180,270,3,30,15,60,30,1,135) # text={Epanda} +# tile 2 +epanda(3281,3365,135,450,1,30,15,60,30,1,135) # epanda=(135 90 0 270)(30 15 60 30)(135) text={Epanda 2} +# tile 2 +epanda(3281,3365,90,360,1,30,15,60,30,1,135) # epanda=ignore +# tile 2 +epanda(3281,3365,0,270,1,30,15,60,30,1,135) # epanda=ignore +# tile 2 +bpanda(3113,3543,180,270,3,80,40,120,60,1,135) # text={Bpanda} +# tile 2 +bpanda(3121,3367,135,450,1,80,40,120,60,1,135) # bpanda=(135 90 0 270)(80 40 120 60)(135) text={Bpanda 2} +# tile 2 +bpanda(3121,3367,90,360,1,80,40,120,60,1,135) # bpanda=ignore +# tile 2 +bpanda(3121,3367,0,270,1,80,40,120,60,1,135) # bpanda=ignore +# tile 7 +circle(5027,4773,40) # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +# tile 7 +-ellipse(4863,4739,80,40,135) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +# tile 7 +-box(4683,4735,160,80,135) # color=yellow font="helvetica 10 bold roman" text={Box} +# tile 7 +polygon(4544.5055,4757,4469,4832.5055,4393.4945,4757,4469,4681.4945) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +# tile 7 +-line(4341,4707,4221,4809) # line=1 1 color=cyan text={Line} +# tile 7 +# vector(4153,4751,80,135) vector=1 color=red text={Vector} +# tile 6 +# text(4043,4723) color=magenta font="helvetica 14 bold roman" text={Region} +# tile 7 +# ruler(4585,4485,4457,4603) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +# tile 7 +annulus(5027,4549,20,40,60) # color=magenta font="helvetica 10 bold roman" text={Annulus} +# tile 7 +ellipse(4857,4541,30,15,60,30,135) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +# tile 7 +box(4683,4539,80,40,120,60,135) # font="helvetica 10 bold roman" text={Box Annulus} +# tile 7 +point(5041,4363) # point=circle text={Circle Point} +# tile 7 +point(4863,4359) # point=box color=red width=3 text={Box Point} +# tile 7 +point(4701,4363) # point=diamond text={Diamond Point} +# tile 7 +point(5011,4265) # point=cross color=blue text={Cross Point} +# tile 7 +point(4859,4267) # point=x text={X Point} +# tile 7 +point(4705,4261) # point=arrow color=magenta text={Arrow Point} +# tile 7 +point(4855,4163) # point=boxcircle text={BoxCircle Point} +# tile 7 +# projection(4377,4465,4191,4597,40) text={Projection} +# tile 7 +panda(4503,4363,180,270,3,0,60,2) # text={Panda} +# tile 7 +panda(4499,4181,128.4181,450,1,0,30,1) # panda=(128.4181 90 0 270)(0 30 60) text={Panda 2} +# tile 7 +panda(4499,4181,128.4181,450,1,30,60,1) # panda=ignore +# tile 7 +panda(4499,4181,90,360,1,0,30,1) # panda=ignore +# tile 7 +panda(4499,4181,90,360,1,30,60,1) # panda=ignore +# tile 7 +panda(4499,4181,0,270,1,0,30,1) # panda=ignore +# tile 7 +panda(4499,4181,0,270,1,30,60,1) # panda=ignore +# tile 7 +# compass(4133,4507,80) compass=physical {N} {E} 1 1 text={Compass} +# tile 7 +epanda(4339,4347,180,270,3,30,15,60,30,1,135) # text={Epanda} +# tile 7 +epanda(4333,4169,135,450,1,30,15,60,30,1,135) # epanda=(135 90 0 270)(30 15 60 30)(135) text={Epanda 2} +# tile 7 +epanda(4333,4169,90,360,1,30,15,60,30,1,135) # epanda=ignore +# tile 7 +epanda(4333,4169,0,270,1,30,15,60,30,1,135) # epanda=ignore +# tile 7 +bpanda(4165,4347,180,270,3,80,40,120,60,1,135) # text={Bpanda} +# tile 7 +bpanda(4173,4171,135,450,1,80,40,120,60,1,135) # bpanda=(135 90 0 270)(80 40 120 60)(135) text={Bpanda 2} +# tile 7 +bpanda(4173,4171,90,360,1,80,40,120,60,1,135) # bpanda=ignore +# tile 7 +bpanda(4173,4171,0,270,1,80,40,120,60,1,135) # bpanda=ignore diff --git a/regions/io/tests/data/ds9.linear.wcsa.reg b/regions/io/tests/data/ds9.linear.wcsa.reg new file mode 100644 index 00000000..8146b52d --- /dev/null +++ b/regions/io/tests/data/ds9.linear.wcsa.reg @@ -0,0 +1,143 @@ +# Region file format: DS9 version 4.1 +global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1 +wcsa; +# tile 2 +circle(121.5,3969.5,40) # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +# tile 2 +-ellipse(285.5,3935.5,80,40,45) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +# tile 2 +-box(465.5,3931.5,160,80,45) # color=yellow font="helvetica 10 bold roman" text={Box} +# tile 2 +polygon(603.9945,3953.5,679.5,4029.0055,755.0055,3953.5,679.5,3877.9945) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +# tile 2 +-line(807.5,3903.5,927.5,4005.5) # line=1 1 color=cyan text={Line} +# tile 2 +# vector(995.5,3947.5,80,45) vector=1 color=red text={Vector} +# tile 2 +# text(1105.5,3919.5) color=magenta font="helvetica 14 bold roman" text={Region} +# tile 2 +# ruler(563.5,3681.5,691.5,3799.5) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +# tile 2 +annulus(121.5,3745.5,20,40,60) # color=magenta font="helvetica 10 bold roman" text={Annulus} +# tile 2 +ellipse(291.5,3737.5,30,15,60,30,45) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +# tile 2 +box(465.5,3735.5,80,40,120,60,45) # font="helvetica 10 bold roman" text={Box Annulus} +# tile 2 +point(107.5,3559.5) # point=circle text={Circle Point} +# tile 2 +point(285.5,3555.5) # point=box color=red width=3 text={Box Point} +# tile 2 +point(447.5,3559.5) # point=diamond text={Diamond Point} +# tile 2 +point(137.5,3461.5) # point=cross color=blue text={Cross Point} +# tile 2 +point(289.5,3463.5) # point=x text={X Point} +# tile 2 +point(443.5,3457.5) # point=arrow color=magenta text={Arrow Point} +# tile 2 +point(293.5,3359.5) # point=boxcircle text={BoxCircle Point} +# tile 2 +# projection(771.5,3661.5,957.5,3793.5,40) text={Projection} +# tile 2 +panda(645.5,3559.5,0,270,3,0,60,2) # text={Panda} +# tile 2 +panda(649.5,3377.5,51.5819,90,1,0,30,1) # panda=(51.5819 90 180 270)(0 30 60) text={Panda 2} +# tile 2 +panda(649.5,3377.5,51.5819,90,1,30,60,1) # panda=ignore +# tile 2 +panda(649.5,3377.5,90,180,1,0,30,1) # panda=ignore +# tile 2 +panda(649.5,3377.5,90,180,1,30,60,1) # panda=ignore +# tile 2 +panda(649.5,3377.5,180,270,1,0,30,1) # panda=ignore +# tile 2 +panda(649.5,3377.5,180,270,1,30,60,1) # panda=ignore +# tile 2 +# compass(1015.5,3703.5,80) compass=physical {N} {E} 1 1 text={Compass} +# tile 2 +epanda(809.5,3543.5,0,270,3,30,15,60,30,1,45) # text={Epanda} +# tile 2 +epanda(815.5,3365.5,45,90,1,30,15,60,30,1,45) # epanda=(45 90 180 270)(30 15 60 30)(45) text={Epanda 2} +# tile 2 +epanda(815.5,3365.5,90,180,1,30,15,60,30,1,45) # epanda=ignore +# tile 2 +epanda(815.5,3365.5,180,270,1,30,15,60,30,1,45) # epanda=ignore +# tile 2 +bpanda(983.5,3543.5,0,270,3,80,40,120,60,1,45) # text={Bpanda} +# tile 2 +bpanda(975.5,3367.5,45,90,1,80,40,120,60,1,45) # bpanda=(45 90 180 270)(80 40 120 60)(45) text={Bpanda 2} +# tile 2 +bpanda(975.5,3367.5,90,180,1,80,40,120,60,1,45) # bpanda=ignore +# tile 2 +bpanda(975.5,3367.5,180,270,1,80,40,120,60,1,45) # bpanda=ignore +# tile 7 +circle(931.5,3419.5,40) # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +# tile 7 +-ellipse(767.5,3453.5,80,40,45) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +# tile 7 +-box(587.5,3457.5,160,80,45) # color=yellow font="helvetica 10 bold roman" text={Box} +# tile 7 +polygon(449.0055,3435.5,373.5,3359.9945,297.9945,3435.5,373.5,3511.0055) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +# tile 7 +-line(245.5,3485.5,125.5,3383.5) # line=1 1 color=cyan text={Line} +# tile 7 +# vector(57.5,3441.5,80,45) vector=1 color=red text={Vector} +# tile 6 +# text(1995.5,3469.5) color=magenta font="helvetica 14 bold roman" text={Region} +# tile 7 +# ruler(489.5,3707.5,361.5,3589.5) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +# tile 7 +annulus(931.5,3643.5,20,40,60) # color=magenta font="helvetica 10 bold roman" text={Annulus} +# tile 7 +ellipse(761.5,3651.5,30,15,60,30,45) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +# tile 7 +box(587.5,3653.5,80,40,120,60,45) # font="helvetica 10 bold roman" text={Box Annulus} +# tile 7 +point(945.5,3829.5) # point=circle text={Circle Point} +# tile 7 +point(767.5,3833.5) # point=box color=red width=3 text={Box Point} +# tile 7 +point(605.5,3829.5) # point=diamond text={Diamond Point} +# tile 7 +point(915.5,3927.5) # point=cross color=blue text={Cross Point} +# tile 7 +point(763.5,3925.5) # point=x text={X Point} +# tile 7 +point(609.5,3931.5) # point=arrow color=magenta text={Arrow Point} +# tile 7 +point(759.5,4029.5) # point=boxcircle text={BoxCircle Point} +# tile 7 +# projection(281.5,3727.5,95.5,3595.5,40) text={Projection} +# tile 7 +panda(407.5,3829.5,0,270,3,0,60,2) # text={Panda} +# tile 7 +panda(403.5,4011.5,51.5819,90,1,0,30,1) # panda=(51.5819 90 180 270)(0 30 60) text={Panda 2} +# tile 7 +panda(403.5,4011.5,51.5819,90,1,30,60,1) # panda=ignore +# tile 7 +panda(403.5,4011.5,90,180,1,0,30,1) # panda=ignore +# tile 7 +panda(403.5,4011.5,90,180,1,30,60,1) # panda=ignore +# tile 7 +panda(403.5,4011.5,180,270,1,0,30,1) # panda=ignore +# tile 7 +panda(403.5,4011.5,180,270,1,30,60,1) # panda=ignore +# tile 7 +# compass(37.5,3685.5,80) compass=physical {N} {E} 1 1 text={Compass} +# tile 7 +epanda(243.5,3845.5,0,270,3,30,15,60,30,1,45) # text={Epanda} +# tile 7 +epanda(237.5,4023.5,45,90,1,30,15,60,30,1,45) # epanda=(45 90 180 270)(30 15 60 30)(45) text={Epanda 2} +# tile 7 +epanda(237.5,4023.5,90,180,1,30,15,60,30,1,45) # epanda=ignore +# tile 7 +epanda(237.5,4023.5,180,270,1,30,15,60,30,1,45) # epanda=ignore +# tile 7 +bpanda(69.5,3845.5,0,270,3,80,40,120,60,1,45) # text={Bpanda} +# tile 7 +bpanda(77.5,4021.5,45,90,1,80,40,120,60,1,45) # bpanda=(45 90 180 270)(80 40 120 60)(45) text={Bpanda 2} +# tile 7 +bpanda(77.5,4021.5,90,180,1,80,40,120,60,1,45) # bpanda=ignore +# tile 7 +bpanda(77.5,4021.5,180,270,1,80,40,120,60,1,45) # bpanda=ignore diff --git a/regions/io/tests/data/ds9.linear.wcsc.reg b/regions/io/tests/data/ds9.linear.wcsc.reg new file mode 100644 index 00000000..40375403 --- /dev/null +++ b/regions/io/tests/data/ds9.linear.wcsc.reg @@ -0,0 +1,143 @@ +# Region file format: DS9 version 4.1 +global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1 +wcsc; +# tile 2 +circle(121.5,3969.5,40) # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +# tile 2 +-ellipse(285.5,3935.5,80,40,45) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +# tile 2 +-box(465.5,3931.5,160,80,45) # color=yellow font="helvetica 10 bold roman" text={Box} +# tile 2 +polygon(603.9945,3953.5,679.5,4029.0055,755.0055,3953.5,679.5,3877.9945) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +# tile 2 +-line(807.5,3903.5,927.5,4005.5) # line=1 1 color=cyan text={Line} +# tile 2 +# vector(995.5,3947.5,80,45) vector=1 color=red text={Vector} +# tile 2 +# text(1105.5,3919.5) color=magenta font="helvetica 14 bold roman" text={Region} +# tile 2 +# ruler(563.5,3681.5,691.5,3799.5) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +# tile 2 +annulus(121.5,3745.5,20,40,60) # color=magenta font="helvetica 10 bold roman" text={Annulus} +# tile 2 +ellipse(291.5,3737.5,30,15,60,30,45) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +# tile 2 +box(465.5,3735.5,80,40,120,60,45) # font="helvetica 10 bold roman" text={Box Annulus} +# tile 2 +point(107.5,3559.5) # point=circle text={Circle Point} +# tile 2 +point(285.5,3555.5) # point=box color=red width=3 text={Box Point} +# tile 2 +point(447.5,3559.5) # point=diamond text={Diamond Point} +# tile 2 +point(137.5,3461.5) # point=cross color=blue text={Cross Point} +# tile 2 +point(289.5,3463.5) # point=x text={X Point} +# tile 2 +point(443.5,3457.5) # point=arrow color=magenta text={Arrow Point} +# tile 2 +point(293.5,3359.5) # point=boxcircle text={BoxCircle Point} +# tile 2 +# projection(771.5,3661.5,957.5,3793.5,40) text={Projection} +# tile 2 +panda(645.5,3559.5,0,270,3,0,60,2) # text={Panda} +# tile 2 +panda(649.5,3377.5,51.5819,90,1,0,30,1) # panda=(51.5819 90 180 270)(0 30 60) text={Panda 2} +# tile 2 +panda(649.5,3377.5,51.5819,90,1,30,60,1) # panda=ignore +# tile 2 +panda(649.5,3377.5,90,180,1,0,30,1) # panda=ignore +# tile 2 +panda(649.5,3377.5,90,180,1,30,60,1) # panda=ignore +# tile 2 +panda(649.5,3377.5,180,270,1,0,30,1) # panda=ignore +# tile 2 +panda(649.5,3377.5,180,270,1,30,60,1) # panda=ignore +# tile 2 +# compass(1015.5,3703.5,80) compass=physical {N} {E} 1 1 text={Compass} +# tile 2 +epanda(809.5,3543.5,0,270,3,30,15,60,30,1,45) # text={Epanda} +# tile 2 +epanda(815.5,3365.5,45,90,1,30,15,60,30,1,45) # epanda=(45 90 180 270)(30 15 60 30)(45) text={Epanda 2} +# tile 2 +epanda(815.5,3365.5,90,180,1,30,15,60,30,1,45) # epanda=ignore +# tile 2 +epanda(815.5,3365.5,180,270,1,30,15,60,30,1,45) # epanda=ignore +# tile 2 +bpanda(983.5,3543.5,0,270,3,80,40,120,60,1,45) # text={Bpanda} +# tile 2 +bpanda(975.5,3367.5,45,90,1,80,40,120,60,1,45) # bpanda=(45 90 180 270)(80 40 120 60)(45) text={Bpanda 2} +# tile 2 +bpanda(975.5,3367.5,90,180,1,80,40,120,60,1,45) # bpanda=ignore +# tile 2 +bpanda(975.5,3367.5,180,270,1,80,40,120,60,1,45) # bpanda=ignore +# tile 7 +circle(-929.5,3419.5,40) # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +# tile 7 +-ellipse(-765.5,3453.5,80,40,45) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +# tile 7 +-box(-585.5,3457.5,160,80,45) # color=yellow font="helvetica 10 bold roman" text={Box} +# tile 7 +polygon(-447.0055,3435.5,-371.5,3359.9945,-295.9945,3435.5,-371.5,3511.0055) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +# tile 7 +-line(-243.5,3485.5,-123.5,3383.5) # line=1 1 color=cyan text={Line} +# tile 7 +# vector(-55.5,3441.5,80,45) vector=1 color=red text={Vector} +# tile 6 +# text(-1993.5,3469.5) color=magenta font="helvetica 14 bold roman" text={Region} +# tile 7 +# ruler(-487.5,3707.5,-359.5,3589.5) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +# tile 7 +annulus(-929.5,3643.5,20,40,60) # color=magenta font="helvetica 10 bold roman" text={Annulus} +# tile 7 +ellipse(-759.5,3651.5,30,15,60,30,45) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +# tile 7 +box(-585.5,3653.5,80,40,120,60,45) # font="helvetica 10 bold roman" text={Box Annulus} +# tile 7 +point(-943.5,3829.5) # point=circle text={Circle Point} +# tile 7 +point(-765.5,3833.5) # point=box color=red width=3 text={Box Point} +# tile 7 +point(-603.5,3829.5) # point=diamond text={Diamond Point} +# tile 7 +point(-913.5,3927.5) # point=cross color=blue text={Cross Point} +# tile 7 +point(-761.5,3925.5) # point=x text={X Point} +# tile 7 +point(-607.5,3931.5) # point=arrow color=magenta text={Arrow Point} +# tile 7 +point(-757.5,4029.5) # point=boxcircle text={BoxCircle Point} +# tile 7 +# projection(-279.5,3727.5,-93.5,3595.5,40) text={Projection} +# tile 7 +panda(-405.5,3829.5,0,270,3,0,60,2) # text={Panda} +# tile 7 +panda(-401.5,4011.5,51.5819,90,1,0,30,1) # panda=(51.5819 90 180 270)(0 30 60) text={Panda 2} +# tile 7 +panda(-401.5,4011.5,51.5819,90,1,30,60,1) # panda=ignore +# tile 7 +panda(-401.5,4011.5,90,180,1,0,30,1) # panda=ignore +# tile 7 +panda(-401.5,4011.5,90,180,1,30,60,1) # panda=ignore +# tile 7 +panda(-401.5,4011.5,180,270,1,0,30,1) # panda=ignore +# tile 7 +panda(-401.5,4011.5,180,270,1,30,60,1) # panda=ignore +# tile 7 +# compass(-35.5,3685.5,80) compass=physical {N} {E} 1 1 text={Compass} +# tile 7 +epanda(-241.5,3845.5,0,270,3,30,15,60,30,1,45) # text={Epanda} +# tile 7 +epanda(-235.5,4023.5,45,90,1,30,15,60,30,1,45) # epanda=(45 90 180 270)(30 15 60 30)(45) text={Epanda 2} +# tile 7 +epanda(-235.5,4023.5,90,180,1,30,15,60,30,1,45) # epanda=ignore +# tile 7 +epanda(-235.5,4023.5,180,270,1,30,15,60,30,1,45) # epanda=ignore +# tile 7 +bpanda(-67.5,3845.5,0,270,3,80,40,120,60,1,45) # text={Bpanda} +# tile 7 +bpanda(-75.5,4021.5,45,90,1,80,40,120,60,1,45) # bpanda=(45 90 180 270)(80 40 120 60)(45) text={Bpanda 2} +# tile 7 +bpanda(-75.5,4021.5,90,180,1,80,40,120,60,1,45) # bpanda=ignore +# tile 7 +bpanda(-75.5,4021.5,180,270,1,80,40,120,60,1,45) # bpanda=ignore diff --git a/regions/io/tests/data/ds9.linear.wcsd.reg b/regions/io/tests/data/ds9.linear.wcsd.reg new file mode 100644 index 00000000..f373528f --- /dev/null +++ b/regions/io/tests/data/ds9.linear.wcsd.reg @@ -0,0 +1,143 @@ +# Region file format: DS9 version 4.1 +global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1 +wcsd; +# tile 2 +circle(3975.5,3969.5,40) # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +# tile 2 +-ellipse(3811.5,3935.5,80,40,135) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +# tile 2 +-box(3631.5,3931.5,160,80,135) # color=yellow font="helvetica 10 bold roman" text={Box} +# tile 2 +polygon(3493.0055,3953.5,3417.5,4029.0055,3341.9945,3953.5,3417.5,3877.9945) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +# tile 2 +-line(3289.5,3903.5,3169.5,4005.5) # line=1 1 color=cyan text={Line} +# tile 2 +# vector(3101.5,3947.5,80,135) vector=1 color=red text={Vector} +# tile 2 +# text(2991.5,3919.5) color=magenta font="helvetica 14 bold roman" text={Region} +# tile 2 +# ruler(3533.5,3681.5,3405.5,3799.5) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +# tile 2 +annulus(3975.5,3745.5,20,40,60) # color=magenta font="helvetica 10 bold roman" text={Annulus} +# tile 2 +ellipse(3805.5,3737.5,30,15,60,30,135) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +# tile 2 +box(3631.5,3735.5,80,40,120,60,135) # font="helvetica 10 bold roman" text={Box Annulus} +# tile 2 +point(3989.5,3559.5) # point=circle text={Circle Point} +# tile 2 +point(3811.5,3555.5) # point=box color=red width=3 text={Box Point} +# tile 2 +point(3649.5,3559.5) # point=diamond text={Diamond Point} +# tile 2 +point(3959.5,3461.5) # point=cross color=blue text={Cross Point} +# tile 2 +point(3807.5,3463.5) # point=x text={X Point} +# tile 2 +point(3653.5,3457.5) # point=arrow color=magenta text={Arrow Point} +# tile 2 +point(3803.5,3359.5) # point=boxcircle text={BoxCircle Point} +# tile 2 +# projection(3325.5,3661.5,3139.5,3793.5,40) text={Projection} +# tile 2 +panda(3451.5,3559.5,180,270,3,0,60,2) # text={Panda} +# tile 2 +panda(3447.5,3377.5,128.4181,450,1,0,30,1) # panda=(128.4181 90 0 270)(0 30 60) text={Panda 2} +# tile 2 +panda(3447.5,3377.5,128.4181,450,1,30,60,1) # panda=ignore +# tile 2 +panda(3447.5,3377.5,90,360,1,0,30,1) # panda=ignore +# tile 2 +panda(3447.5,3377.5,90,360,1,30,60,1) # panda=ignore +# tile 2 +panda(3447.5,3377.5,0,270,1,0,30,1) # panda=ignore +# tile 2 +panda(3447.5,3377.5,0,270,1,30,60,1) # panda=ignore +# tile 2 +# compass(3081.5,3703.5,80) compass=physical {N} {E} 1 1 text={Compass} +# tile 2 +epanda(3287.5,3543.5,180,270,3,30,15,60,30,1,135) # text={Epanda} +# tile 2 +epanda(3281.5,3365.5,135,450,1,30,15,60,30,1,135) # epanda=(135 90 0 270)(30 15 60 30)(135) text={Epanda 2} +# tile 2 +epanda(3281.5,3365.5,90,360,1,30,15,60,30,1,135) # epanda=ignore +# tile 2 +epanda(3281.5,3365.5,0,270,1,30,15,60,30,1,135) # epanda=ignore +# tile 2 +bpanda(3113.5,3543.5,180,270,3,80,40,120,60,1,135) # text={Bpanda} +# tile 2 +bpanda(3121.5,3367.5,135,450,1,80,40,120,60,1,135) # bpanda=(135 90 0 270)(80 40 120 60)(135) text={Bpanda 2} +# tile 2 +bpanda(3121.5,3367.5,90,360,1,80,40,120,60,1,135) # bpanda=ignore +# tile 2 +bpanda(3121.5,3367.5,0,270,1,80,40,120,60,1,135) # bpanda=ignore +# tile 7 +circle(5027.5,4773.5,40) # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +# tile 7 +-ellipse(4863.5,4739.5,80,40,135) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +# tile 7 +-box(4683.5,4735.5,160,80,135) # color=yellow font="helvetica 10 bold roman" text={Box} +# tile 7 +polygon(4545.0055,4757.5,4469.5,4833.0055,4393.9945,4757.5,4469.5,4681.9945) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +# tile 7 +-line(4341.5,4707.5,4221.5,4809.5) # line=1 1 color=cyan text={Line} +# tile 7 +# vector(4153.5,4751.5,80,135) vector=1 color=red text={Vector} +# tile 6 +# text(4043.5,4723.5) color=magenta font="helvetica 14 bold roman" text={Region} +# tile 7 +# ruler(4585.5,4485.5,4457.5,4603.5) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +# tile 7 +annulus(5027.5,4549.5,20,40,60) # color=magenta font="helvetica 10 bold roman" text={Annulus} +# tile 7 +ellipse(4857.5,4541.5,30,15,60,30,135) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +# tile 7 +box(4683.5,4539.5,80,40,120,60,135) # font="helvetica 10 bold roman" text={Box Annulus} +# tile 7 +point(5041.5,4363.5) # point=circle text={Circle Point} +# tile 7 +point(4863.5,4359.5) # point=box color=red width=3 text={Box Point} +# tile 7 +point(4701.5,4363.5) # point=diamond text={Diamond Point} +# tile 7 +point(5011.5,4265.5) # point=cross color=blue text={Cross Point} +# tile 7 +point(4859.5,4267.5) # point=x text={X Point} +# tile 7 +point(4705.5,4261.5) # point=arrow color=magenta text={Arrow Point} +# tile 7 +point(4855.5,4163.5) # point=boxcircle text={BoxCircle Point} +# tile 7 +# projection(4377.5,4465.5,4191.5,4597.5,40) text={Projection} +# tile 7 +panda(4503.5,4363.5,180,270,3,0,60,2) # text={Panda} +# tile 7 +panda(4499.5,4181.5,128.4181,450,1,0,30,1) # panda=(128.4181 90 0 270)(0 30 60) text={Panda 2} +# tile 7 +panda(4499.5,4181.5,128.4181,450,1,30,60,1) # panda=ignore +# tile 7 +panda(4499.5,4181.5,90,360,1,0,30,1) # panda=ignore +# tile 7 +panda(4499.5,4181.5,90,360,1,30,60,1) # panda=ignore +# tile 7 +panda(4499.5,4181.5,0,270,1,0,30,1) # panda=ignore +# tile 7 +panda(4499.5,4181.5,0,270,1,30,60,1) # panda=ignore +# tile 7 +# compass(4133.5,4507.5,80) compass=physical {N} {E} 1 1 text={Compass} +# tile 7 +epanda(4339.5,4347.5,180,270,3,30,15,60,30,1,135) # text={Epanda} +# tile 7 +epanda(4333.5,4169.5,135,450,1,30,15,60,30,1,135) # epanda=(135 90 0 270)(30 15 60 30)(135) text={Epanda 2} +# tile 7 +epanda(4333.5,4169.5,90,360,1,30,15,60,30,1,135) # epanda=ignore +# tile 7 +epanda(4333.5,4169.5,0,270,1,30,15,60,30,1,135) # epanda=ignore +# tile 7 +bpanda(4165.5,4347.5,180,270,3,80,40,120,60,1,135) # text={Bpanda} +# tile 7 +bpanda(4173.5,4171.5,135,450,1,80,40,120,60,1,135) # bpanda=(135 90 0 270)(80 40 120 60)(135) text={Bpanda 2} +# tile 7 +bpanda(4173.5,4171.5,90,360,1,80,40,120,60,1,135) # bpanda=ignore +# tile 7 +bpanda(4173.5,4171.5,0,270,1,80,40,120,60,1,135) # bpanda=ignore diff --git a/regions/io/tests/data/ds9.linear.wcsi.reg b/regions/io/tests/data/ds9.linear.wcsi.reg new file mode 100644 index 00000000..101cb70f --- /dev/null +++ b/regions/io/tests/data/ds9.linear.wcsi.reg @@ -0,0 +1,143 @@ +# Region file format: DS9 version 4.1 +global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1 +wcsi; +# tile 2 +circle(67,1135,20) # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +# tile 2 +-ellipse(149,1118,40,20,45) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +# tile 2 +-box(239,1116,80,40,45) # color=yellow font="helvetica 10 bold roman" text={Box} +# tile 2 +polygon(308.24725,1127,346,1164.7528,383.75275,1127,346,1089.2472) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +# tile 2 +-line(410,1102,470,1153) # line=1 1 color=cyan text={Line} +# tile 2 +# vector(504,1124,40,45) vector=1 color=red text={Vector} +# tile 2 +# text(559,1110) color=magenta font="helvetica 14 bold roman" text={Region} +# tile 2 +# ruler(288,991,352,1050) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +# tile 2 +annulus(67,1023,10,20,30) # color=magenta font="helvetica 10 bold roman" text={Annulus} +# tile 2 +ellipse(152,1019,15,7.5,30,15,45) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +# tile 2 +box(239,1018,40,20,60,30,45) # font="helvetica 10 bold roman" text={Box Annulus} +# tile 2 +point(60,930) # point=circle text={Circle Point} +# tile 2 +point(149,928) # point=box color=red width=3 text={Box Point} +# tile 2 +point(230,930) # point=diamond text={Diamond Point} +# tile 2 +point(75,881) # point=cross color=blue text={Cross Point} +# tile 2 +point(151,882) # point=x text={X Point} +# tile 2 +point(228,879) # point=arrow color=magenta text={Arrow Point} +# tile 2 +point(153,830) # point=boxcircle text={BoxCircle Point} +# tile 2 +# projection(392,981,485,1047,20) text={Projection} +# tile 2 +panda(329,930,0,270,3,0,30,2) # text={Panda} +# tile 2 +panda(331,839,51.5819,90,1,0,15,1) # panda=(51.5819 90 180 270)(0 15 30) text={Panda 2} +# tile 2 +panda(331,839,51.5819,90,1,15,30,1) # panda=ignore +# tile 2 +panda(331,839,90,180,1,0,15,1) # panda=ignore +# tile 2 +panda(331,839,90,180,1,15,30,1) # panda=ignore +# tile 2 +panda(331,839,180,270,1,0,15,1) # panda=ignore +# tile 2 +panda(331,839,180,270,1,15,30,1) # panda=ignore +# tile 2 +# compass(514,1002,40) compass=physical {N} {E} 1 1 text={Compass} +# tile 2 +epanda(411,922,0,270,3,15,7.5,30,15,1,45) # text={Epanda} +# tile 2 +epanda(414,833,45,90,1,15,7.5,30,15,1,45) # epanda=(45 90 180 270)(15 7.5 30 15)(45) text={Epanda 2} +# tile 2 +epanda(414,833,90,180,1,15,7.5,30,15,1,45) # epanda=ignore +# tile 2 +epanda(414,833,180,270,1,15,7.5,30,15,1,45) # epanda=ignore +# tile 2 +bpanda(498,922,0,270,3,40,20,60,30,1,45) # text={Bpanda} +# tile 2 +bpanda(494,834,45,90,1,40,20,60,30,1,45) # bpanda=(45 90 180 270)(40 20 60 30)(45) text={Bpanda 2} +# tile 2 +bpanda(494,834,90,180,1,40,20,60,30,1,45) # bpanda=ignore +# tile 2 +bpanda(494,834,180,270,1,40,20,60,30,1,45) # bpanda=ignore +# tile 7 +circle(472,860,20) # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +# tile 7 +-ellipse(390,877,40,20,45) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +# tile 7 +-box(300,879,80,40,45) # color=yellow font="helvetica 10 bold roman" text={Box} +# tile 7 +polygon(230.75275,868,193,830.24725,155.24725,868,193,905.75275) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +# tile 7 +-line(129,893,69,842) # line=1 1 color=cyan text={Line} +# tile 7 +# vector(35,871,40,45) vector=1 color=red text={Vector} +# tile 6 +# text(1004,885) color=magenta font="helvetica 14 bold roman" text={Region} +# tile 7 +# ruler(251,1004,187,945) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +# tile 7 +annulus(472,972,10,20,30) # color=magenta font="helvetica 10 bold roman" text={Annulus} +# tile 7 +ellipse(387,976,15,7.5,30,15,45) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +# tile 7 +box(300,977,40,20,60,30,45) # font="helvetica 10 bold roman" text={Box Annulus} +# tile 7 +point(479,1065) # point=circle text={Circle Point} +# tile 7 +point(390,1067) # point=box color=red width=3 text={Box Point} +# tile 7 +point(309,1065) # point=diamond text={Diamond Point} +# tile 7 +point(464,1114) # point=cross color=blue text={Cross Point} +# tile 7 +point(388,1113) # point=x text={X Point} +# tile 7 +point(311,1116) # point=arrow color=magenta text={Arrow Point} +# tile 7 +point(386,1165) # point=boxcircle text={BoxCircle Point} +# tile 7 +# projection(147,1014,54,948,20) text={Projection} +# tile 7 +panda(210,1065,0,270,3,0,30,2) # text={Panda} +# tile 7 +panda(208,1156,51.5819,90,1,0,15,1) # panda=(51.5819 90 180 270)(0 15 30) text={Panda 2} +# tile 7 +panda(208,1156,51.5819,90,1,15,30,1) # panda=ignore +# tile 7 +panda(208,1156,90,180,1,0,15,1) # panda=ignore +# tile 7 +panda(208,1156,90,180,1,15,30,1) # panda=ignore +# tile 7 +panda(208,1156,180,270,1,0,15,1) # panda=ignore +# tile 7 +panda(208,1156,180,270,1,15,30,1) # panda=ignore +# tile 7 +# compass(25,993,40) compass=physical {N} {E} 1 1 text={Compass} +# tile 7 +epanda(128,1073,0,270,3,15,7.5,30,15,1,45) # text={Epanda} +# tile 7 +epanda(125,1162,45,90,1,15,7.5,30,15,1,45) # epanda=(45 90 180 270)(15 7.5 30 15)(45) text={Epanda 2} +# tile 7 +epanda(125,1162,90,180,1,15,7.5,30,15,1,45) # epanda=ignore +# tile 7 +epanda(125,1162,180,270,1,15,7.5,30,15,1,45) # epanda=ignore +# tile 7 +bpanda(41,1073,0,270,3,40,20,60,30,1,45) # text={Bpanda} +# tile 7 +bpanda(45,1161,45,90,1,40,20,60,30,1,45) # bpanda=(45 90 180 270)(40 20 60 30)(45) text={Bpanda 2} +# tile 7 +bpanda(45,1161,90,180,1,40,20,60,30,1,45) # bpanda=ignore +# tile 7 +bpanda(45,1161,180,270,1,40,20,60,30,1,45) # bpanda=ignore diff --git a/regions/io/tests/data/ds9.linear.wcsp.reg b/regions/io/tests/data/ds9.linear.wcsp.reg new file mode 100644 index 00000000..e09d54c5 --- /dev/null +++ b/regions/io/tests/data/ds9.linear.wcsp.reg @@ -0,0 +1,143 @@ +# Region file format: DS9 version 4.1 +global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1 +wcsp; +# tile 2 +circle(3975,3969,40) # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +# tile 2 +-ellipse(3811,3935,80,40,135) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +# tile 2 +-box(3631,3931,160,80,135) # color=yellow font="helvetica 10 bold roman" text={Box} +# tile 2 +polygon(3492.5055,3953,3417,4028.5055,3341.4945,3953,3417,3877.4945) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +# tile 2 +-line(3289,3903,3169,4005) # line=1 1 color=cyan text={Line} +# tile 2 +# vector(3101,3947,80,135) vector=1 color=red text={Vector} +# tile 2 +# text(2991,3919) color=magenta font="helvetica 14 bold roman" text={Region} +# tile 2 +# ruler(3533,3681,3405,3799) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +# tile 2 +annulus(3975,3745,20,40,60) # color=magenta font="helvetica 10 bold roman" text={Annulus} +# tile 2 +ellipse(3805,3737,30,15,60,30,135) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +# tile 2 +box(3631,3735,80,40,120,60,135) # font="helvetica 10 bold roman" text={Box Annulus} +# tile 2 +point(3989,3559) # point=circle text={Circle Point} +# tile 2 +point(3811,3555) # point=box color=red width=3 text={Box Point} +# tile 2 +point(3649,3559) # point=diamond text={Diamond Point} +# tile 2 +point(3959,3461) # point=cross color=blue text={Cross Point} +# tile 2 +point(3807,3463) # point=x text={X Point} +# tile 2 +point(3653,3457) # point=arrow color=magenta text={Arrow Point} +# tile 2 +point(3803,3359) # point=boxcircle text={BoxCircle Point} +# tile 2 +# projection(3325,3661,3139,3793,40) text={Projection} +# tile 2 +panda(3451,3559,180,270,3,0,60,2) # text={Panda} +# tile 2 +panda(3447,3377,128.4181,450,1,0,30,1) # panda=(128.4181 90 0 270)(0 30 60) text={Panda 2} +# tile 2 +panda(3447,3377,128.4181,450,1,30,60,1) # panda=ignore +# tile 2 +panda(3447,3377,90,360,1,0,30,1) # panda=ignore +# tile 2 +panda(3447,3377,90,360,1,30,60,1) # panda=ignore +# tile 2 +panda(3447,3377,0,270,1,0,30,1) # panda=ignore +# tile 2 +panda(3447,3377,0,270,1,30,60,1) # panda=ignore +# tile 2 +# compass(3081,3703,80) compass=physical {N} {E} 1 1 text={Compass} +# tile 2 +epanda(3287,3543,180,270,3,30,15,60,30,1,135) # text={Epanda} +# tile 2 +epanda(3281,3365,135,450,1,30,15,60,30,1,135) # epanda=(135 90 0 270)(30 15 60 30)(135) text={Epanda 2} +# tile 2 +epanda(3281,3365,90,360,1,30,15,60,30,1,135) # epanda=ignore +# tile 2 +epanda(3281,3365,0,270,1,30,15,60,30,1,135) # epanda=ignore +# tile 2 +bpanda(3113,3543,180,270,3,80,40,120,60,1,135) # text={Bpanda} +# tile 2 +bpanda(3121,3367,135,450,1,80,40,120,60,1,135) # bpanda=(135 90 0 270)(80 40 120 60)(135) text={Bpanda 2} +# tile 2 +bpanda(3121,3367,90,360,1,80,40,120,60,1,135) # bpanda=ignore +# tile 2 +bpanda(3121,3367,0,270,1,80,40,120,60,1,135) # bpanda=ignore +# tile 7 +circle(5027,4773,40) # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +# tile 7 +-ellipse(4863,4739,80,40,135) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +# tile 7 +-box(4683,4735,160,80,135) # color=yellow font="helvetica 10 bold roman" text={Box} +# tile 7 +polygon(4544.5055,4757,4469,4832.5055,4393.4945,4757,4469,4681.4945) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +# tile 7 +-line(4341,4707,4221,4809) # line=1 1 color=cyan text={Line} +# tile 7 +# vector(4153,4751,80,135) vector=1 color=red text={Vector} +# tile 6 +# text(4043,4723) color=magenta font="helvetica 14 bold roman" text={Region} +# tile 7 +# ruler(4585,4485,4457,4603) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +# tile 7 +annulus(5027,4549,20,40,60) # color=magenta font="helvetica 10 bold roman" text={Annulus} +# tile 7 +ellipse(4857,4541,30,15,60,30,135) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +# tile 7 +box(4683,4539,80,40,120,60,135) # font="helvetica 10 bold roman" text={Box Annulus} +# tile 7 +point(5041,4363) # point=circle text={Circle Point} +# tile 7 +point(4863,4359) # point=box color=red width=3 text={Box Point} +# tile 7 +point(4701,4363) # point=diamond text={Diamond Point} +# tile 7 +point(5011,4265) # point=cross color=blue text={Cross Point} +# tile 7 +point(4859,4267) # point=x text={X Point} +# tile 7 +point(4705,4261) # point=arrow color=magenta text={Arrow Point} +# tile 7 +point(4855,4163) # point=boxcircle text={BoxCircle Point} +# tile 7 +# projection(4377,4465,4191,4597,40) text={Projection} +# tile 7 +panda(4503,4363,180,270,3,0,60,2) # text={Panda} +# tile 7 +panda(4499,4181,128.4181,450,1,0,30,1) # panda=(128.4181 90 0 270)(0 30 60) text={Panda 2} +# tile 7 +panda(4499,4181,128.4181,450,1,30,60,1) # panda=ignore +# tile 7 +panda(4499,4181,90,360,1,0,30,1) # panda=ignore +# tile 7 +panda(4499,4181,90,360,1,30,60,1) # panda=ignore +# tile 7 +panda(4499,4181,0,270,1,0,30,1) # panda=ignore +# tile 7 +panda(4499,4181,0,270,1,30,60,1) # panda=ignore +# tile 7 +# compass(4133,4507,80) compass=physical {N} {E} 1 1 text={Compass} +# tile 7 +epanda(4339,4347,180,270,3,30,15,60,30,1,135) # text={Epanda} +# tile 7 +epanda(4333,4169,135,450,1,30,15,60,30,1,135) # epanda=(135 90 0 270)(30 15 60 30)(135) text={Epanda 2} +# tile 7 +epanda(4333,4169,90,360,1,30,15,60,30,1,135) # epanda=ignore +# tile 7 +epanda(4333,4169,0,270,1,30,15,60,30,1,135) # epanda=ignore +# tile 7 +bpanda(4165,4347,180,270,3,80,40,120,60,1,135) # text={Bpanda} +# tile 7 +bpanda(4173,4171,135,450,1,80,40,120,60,1,135) # bpanda=(135 90 0 270)(80 40 120 60)(135) text={Bpanda 2} +# tile 7 +bpanda(4173,4171,90,360,1,80,40,120,60,1,135) # bpanda=ignore +# tile 7 +bpanda(4173,4171,0,270,1,80,40,120,60,1,135) # bpanda=ignore diff --git a/regions/io/tests/data/ds9.mosaic.ecliptic.hms.reg b/regions/io/tests/data/ds9.mosaic.ecliptic.hms.reg new file mode 100644 index 00000000..9b3a5974 --- /dev/null +++ b/regions/io/tests/data/ds9.mosaic.ecliptic.hms.reg @@ -0,0 +1,73 @@ +# Region file format: DS9 version 4.1 +global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1 +ecliptic +circle(+275:41:56.645,+54:45:59.579,6.66") # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +-ellipse(+275:41:08.911,+54:45:55.184,13.32",6.66",47.5211) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +-box(+275:40:16.965,+54:45:55.895,26.64",13.32",47.5211) # color=yellow font="helvetica 10 bold roman" text={Box} +polygon(+275:39:37.328,+54:46:00.610,+275:39:16.553,+54:46:13.742,+275:38:53.790,+54:46:01.756,+275:39:14.565,+54:45:48.625) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +-line(+275:38:37.999,+54:45:53.837,+275:38:04.737,+54:46:11.709) # line=1 1 color=cyan text={Line} +# vector(+275:37:44.373,+54:46:02.575,13.32",47.5211) vector=1 color=red text={Vector} +# text(+275:37:12.294,+54:45:58.745) color=magenta font="helvetica 14 bold roman" text={Region} +# ruler(+275:39:45.414,+54:45:15.061,+275:39:10.074,+54:45:35.660) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +annulus(+275:41:53.657,+54:45:22.323,3.33",6.66",9.99") # color=magenta font="helvetica 10 bold roman" text={Annulus} +ellipse(+275:41:04.552,+54:45:22.298,4.995",2.4975",9.99",4.995",47.5211) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +box(+275:40:14.373,+54:45:23.296,13.32",6.66",19.98",9.99",47.5211) # font="helvetica 10 bold roman" text={Box Annulus} +point(+275:41:55.211,+54:44:51.279) # point=circle text={Circle Point} +point(+275:41:03.864,+54:44:51.981) # point=box color=red width=3 text={Box Point} +point(+275:40:17.234,+54:44:53.885) # point=diamond text={Diamond Point} +point(+275:41:45.260,+54:44:35.210) # point=cross color=blue text={Cross Point} +point(+275:41:01.490,+54:44:36.710) # point=x text={X Point} +point(+275:40:17.038,+54:44:36.889) # point=arrow color=magenta text={Arrow Point} +point(+275:40:58.958,+54:44:19.443) # point=boxcircle text={BoxCircle Point} +# projection(+275:38:45.202,+54:45:13.313,+275:37:53.317,+54:45:36.674,6.66") text={Projection} +panda(+275:39:20.175,+54:44:55.392,2.52109,272.521,3,0",9.99",2) # text={Panda} +panda(+275:39:16.628,+54:44:25.151,54.103,92.5211,1,0",4.995",1) # panda=(54.103 92.5211 182.521 272.521)(0" 4.995" 9.99") text={Panda 2} +panda(+275:39:16.628,+54:44:25.151,54.103,92.5211,1,4.995",9.99",1) # panda=ignore +panda(+275:39:16.628,+54:44:25.151,92.5211,182.521,1,0",4.995",1) # panda=ignore +panda(+275:39:16.628,+54:44:25.151,92.5211,182.521,1,4.995",9.99",1) # panda=ignore +panda(+275:39:16.628,+54:44:25.151,182.521,272.521,1,0",4.995",1) # panda=ignore +panda(+275:39:16.628,+54:44:25.151,182.521,272.521,1,4.995",9.99",1) # panda=ignore +# compass(+275:37:35.424,+54:45:22.141,13.32") compass=physical {N} {E} 1 1 text={Compass} +epanda(+275:38:32.703,+54:44:53.974,2.52109,272.521,3,4.995",2.4975",9.99",4.995",1,47.5211) # text={Epanda} +epanda(+275:38:28.642,+54:44:24.413,47.5211,92.5211,1,4.995",2.4975",9.99",4.995",1,47.5211) # epanda=(47.5211 92.5211 182.521 272.521)(4.995" 2.4975" 9.99" 4.995")(47.5211) text={Epanda 2} +epanda(+275:38:28.642,+54:44:24.413,92.5211,182.521,1,4.995",2.4975",9.99",4.995",1,47.5211) # epanda=ignore +epanda(+275:38:28.642,+54:44:24.413,182.521,272.521,1,4.995",2.4975",9.99",4.995",1,47.5211) # epanda=ignore +bpanda(+275:37:42.560,+54:44:55.287,2.52109,272.521,3,13.32",6.66",19.98",9.99",1,47.5211) # text={Bpanda} +bpanda(+275:37:42.569,+54:44:25.953,47.5211,92.5211,1,13.32",6.66",19.98",9.99",1,47.5211) # bpanda=(47.5211 92.5211 182.521 272.521)(13.32" 6.66" 19.98" 9.99")(47.5211) text={Bpanda 2} +bpanda(+275:37:42.569,+54:44:25.953,92.5211,182.521,1,13.32",6.66",19.98",9.99",1,47.5211) # bpanda=ignore +bpanda(+275:37:42.569,+54:44:25.953,182.521,272.521,1,13.32",6.66",19.98",9.99",1,47.5211) # bpanda=ignore +circle(+275:49:30.767,+54:48:31.242,6.66") # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +-ellipse(+275:48:42.970,+54:48:26.897,13.32",6.66",47.5211) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +-box(+275:47:50.972,+54:48:27.662,26.64",13.32",47.5211) # color=yellow font="helvetica 10 bold roman" text={Box} +polygon(+275:47:11.308,+54:48:32.418,+275:46:50.552,+54:48:45.571,+275:46:27.728,+54:48:33.609,+275:46:48.485,+54:48:20.456) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +-line(+275:46:11.897,+54:48:25.707,+275:45:38.656,+54:48:43.613) # line=1 1 color=cyan text={Line} +# vector(+275:45:18.242,+54:48:34.500,13.32",47.5211) vector=1 color=red text={Vector} +# text(+275:44:46.117,+54:48:30.703) color=magenta font="helvetica 14 bold roman" text={Region} +# ruler(+275:47:19.261,+54:47:46.861,+275:46:43.948,+54:48:07.496) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +annulus(+275:49:27.659,+54:47:53.989,3.33",6.66",9.99") # color=magenta font="helvetica 10 bold roman" text={Annulus} +ellipse(+275:48:38.503,+54:47:54.015,4.995",2.4975",9.99",4.995",47.5211) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +box(+275:47:48.276,+54:47:55.065,13.32",6.66",19.98",9.99",47.5211) # font="helvetica 10 bold roman" text={Box Annulus} +point(+275:49:29.118,+54:47:22.944) # point=circle text={Circle Point} +point(+275:48:37.721,+54:47:23.699) # point=box color=red width=3 text={Box Point} +point(+275:47:51.047,+54:47:25.652) # point=diamond text={Diamond Point} +point(+275:49:19.107,+54:47:06.886) # point=cross color=blue text={Cross Point} +point(+275:48:35.297,+54:47:08.431) # point=x text={X Point} +point(+275:47:50.798,+54:47:08.656) # point=arrow color=magenta text={Arrow Point} +point(+275:48:32.708,+54:46:51.166) # point=boxcircle text={BoxCircle Point} +# projection(+275:46:18.980,+54:47:45.175,+275:45:27.114,+54:48:08.590,6.66") text={Projection} +panda(+275:46:53.934,+54:47:27.218,2.52109,272.521,3,0",9.99",2) # text={Panda} +panda(+275:46:50.289,+54:46:56.981,54.103,92.5211,1,0",4.995",1) # panda=(54.103 92.5211 182.521 272.521)(0" 4.995" 9.99") text={Panda 2} +panda(+275:46:50.289,+54:46:56.981,54.103,92.5211,1,4.995",9.99",1) # panda=ignore +panda(+275:46:50.289,+54:46:56.981,92.5211,182.521,1,0",4.995",1) # panda=ignore +panda(+275:46:50.289,+54:46:56.981,92.5211,182.521,1,4.995",9.99",1) # panda=ignore +panda(+275:46:50.289,+54:46:56.981,182.521,272.521,1,0",4.995",1) # panda=ignore +panda(+275:46:50.289,+54:46:56.981,182.521,272.521,1,4.995",9.99",1) # panda=ignore +# compass(+275:45:09.157,+54:47:54.075,13.32") compass=physical {N} {E} 1 1 text={Compass} +epanda(+275:46:06.408,+54:47:25.849,2.52109,272.521,3,4.995",2.4975",9.99",4.995",1,47.5211) # text={Epanda} +epanda(+275:46:02.251,+54:46:56.293,47.5211,92.5211,1,4.995",2.4975",9.99",4.995",1,47.5211) # epanda=(47.5211 92.5211 182.521 272.521)(4.995" 2.4975" 9.99" 4.995")(47.5211) text={Epanda 2} +epanda(+275:46:02.251,+54:46:56.293,92.5211,182.521,1,4.995",2.4975",9.99",4.995",1,47.5211) # epanda=ignore +epanda(+275:46:02.251,+54:46:56.293,182.521,272.521,1,4.995",2.4975",9.99",4.995",1,47.5211) # epanda=ignore +bpanda(+275:45:16.217,+54:47:27.214,2.52109,272.521,3,13.32",6.66",19.98",9.99",1,47.5211) # text={Bpanda} +bpanda(+275:45:16.134,+54:46:57.880,47.5211,92.5211,1,13.32",6.66",19.98",9.99",1,47.5211) # bpanda=(47.5211 92.5211 182.521 272.521)(13.32" 6.66" 19.98" 9.99")(47.5211) text={Bpanda 2} +bpanda(+275:45:16.134,+54:46:57.880,92.5211,182.521,1,13.32",6.66",19.98",9.99",1,47.5211) # bpanda=ignore +bpanda(+275:45:16.134,+54:46:57.880,182.521,272.521,1,13.32",6.66",19.98",9.99",1,47.5211) # bpanda=ignore diff --git a/regions/io/tests/data/ds9.mosaic.ecliptic.reg b/regions/io/tests/data/ds9.mosaic.ecliptic.reg new file mode 100644 index 00000000..a7e0e1a1 --- /dev/null +++ b/regions/io/tests/data/ds9.mosaic.ecliptic.reg @@ -0,0 +1,73 @@ +# Region file format: DS9 version 4.1 +global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1 +ecliptic +circle(275.69907,54.76655,6.66") # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +-ellipse(275.68581,54.765329,13.32",6.66",47.521086) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +-box(275.67138,54.765526,26.64",13.32",47.521086) # color=yellow font="helvetica 10 bold roman" text={Box} +polygon(275.66037,54.766836,275.6546,54.770484,275.64827,54.767154,275.65405,54.763507) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +-line(275.64389,54.764955,275.63465,54.769919) # line=1 1 color=cyan text={Line} +# vector(275.62899,54.767382,13.32",47.521086) vector=1 color=red text={Vector} +# text(275.62008,54.766318) color=magenta font="helvetica 14 bold roman" text={Region} +# ruler(275.66262,54.754184,275.6528,54.759906) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +annulus(275.69824,54.756201,3.33",6.66",9.99") # color=magenta font="helvetica 10 bold roman" text={Annulus} +ellipse(275.6846,54.756194,4.995",2.4975",9.99",4.995",47.521086) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +box(275.67066,54.756471,13.32",6.66",19.98",9.99",47.521086) # font="helvetica 10 bold roman" text={Box Annulus} +point(275.69867,54.747578) # point=circle text={Circle Point} +point(275.68441,54.747772) # point=box color=red width=3 text={Box Point} +point(275.67145,54.748301) # point=diamond text={Diamond Point} +point(275.69591,54.743114) # point=cross color=blue text={Cross Point} +point(275.68375,54.74353) # point=x text={X Point} +point(275.6714,54.74358) # point=arrow color=magenta text={Arrow Point} +point(275.68304,54.738734) # point=boxcircle text={BoxCircle Point} +# projection(275.64589,54.753698,275.63148,54.760187,6.66") text={Projection} +panda(275.6556,54.74872,2.5210862,272.52109,3,0",9.99",2) # text={Panda} +panda(275.65462,54.74032,54.102986,92.521086,1,0",4.995",1) # panda=(54.102986 92.521086 182.52109 272.52109)(0" 4.995" 9.99") text={Panda 2} +panda(275.65462,54.74032,54.102986,92.521086,1,4.995",9.99",1) # panda=ignore +panda(275.65462,54.74032,92.521086,182.52109,1,0",4.995",1) # panda=ignore +panda(275.65462,54.74032,92.521086,182.52109,1,4.995",9.99",1) # panda=ignore +panda(275.65462,54.74032,182.52109,272.52109,1,0",4.995",1) # panda=ignore +panda(275.65462,54.74032,182.52109,272.52109,1,4.995",9.99",1) # panda=ignore +# compass(275.62651,54.75615,13.32") compass=physical {N} {E} 1 1 text={Compass} +epanda(275.64242,54.748326,2.5210862,272.52109,3,4.995",2.4975",9.99",4.995",1,47.521086) # text={Epanda} +epanda(275.64129,54.740115,47.521086,92.521086,1,4.995",2.4975",9.99",4.995",1,47.521086) # epanda=(47.521086 92.521086 182.52109 272.52109)(4.995" 2.4975" 9.99" 4.995")(47.521086) text={Epanda 2} +epanda(275.64129,54.740115,92.521086,182.52109,1,4.995",2.4975",9.99",4.995",1,47.521086) # epanda=ignore +epanda(275.64129,54.740115,182.52109,272.52109,1,4.995",2.4975",9.99",4.995",1,47.521086) # epanda=ignore +bpanda(275.62849,54.748691,2.5210862,272.52109,3,13.32",6.66",19.98",9.99",1,47.521086) # text={Bpanda} +bpanda(275.62849,54.740543,47.521086,92.521086,1,13.32",6.66",19.98",9.99",1,47.521086) # bpanda=(47.521086 92.521086 182.52109 272.52109)(13.32" 6.66" 19.98" 9.99")(47.521086) text={Bpanda 2} +bpanda(275.62849,54.740543,92.521086,182.52109,1,13.32",6.66",19.98",9.99",1,47.521086) # bpanda=ignore +bpanda(275.62849,54.740543,182.52109,272.52109,1,13.32",6.66",19.98",9.99",1,47.521086) # bpanda=ignore +circle(275.82521,54.808678,6.66") # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +-ellipse(275.81194,54.807471,13.32",6.66",47.521086) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +-box(275.79749,54.807684,26.64",13.32",47.521086) # color=yellow font="helvetica 10 bold roman" text={Box} +polygon(275.78647,54.809005,275.78071,54.812659,275.77437,54.809336,275.78013,54.805682) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +-line(275.76997,54.807141,275.76074,54.812115) # line=1 1 color=cyan text={Line} +# vector(275.75507,54.809583,13.32",47.521086) vector=1 color=red text={Vector} +# text(275.74614,54.808529) color=magenta font="helvetica 14 bold roman" text={Region} +# ruler(275.78868,54.79635,275.77887,54.802082) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +annulus(275.82435,54.79833,3.33",6.66",9.99") # color=magenta font="helvetica 10 bold roman" text={Annulus} +ellipse(275.8107,54.798338,4.995",2.4975",9.99",4.995",47.521086) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +box(275.79674,54.798629,13.32",6.66",19.98",9.99",47.521086) # font="helvetica 10 bold roman" text={Box Annulus} +point(275.82476,54.789707) # point=circle text={Circle Point} +point(275.81048,54.789916) # point=box color=red width=3 text={Box Point} +point(275.79751,54.790459) # point=diamond text={Diamond Point} +point(275.82197,54.785246) # point=cross color=blue text={Cross Point} +point(275.8098,54.785675) # point=x text={X Point} +point(275.79744,54.785738) # point=arrow color=magenta text={Arrow Point} +point(275.80909,54.780879) # point=boxcircle text={BoxCircle Point} +# projection(275.77194,54.795882,275.75753,54.802386,6.66") text={Projection} +panda(275.78165,54.790894,2.5210862,272.52109,3,0",9.99",2) # text={Panda} +panda(275.78064,54.782495,54.102986,92.521086,1,0",4.995",1) # panda=(54.102986 92.521086 182.52109 272.52109)(0" 4.995" 9.99") text={Panda 2} +panda(275.78064,54.782495,54.102986,92.521086,1,4.995",9.99",1) # panda=ignore +panda(275.78064,54.782495,92.521086,182.52109,1,0",4.995",1) # panda=ignore +panda(275.78064,54.782495,92.521086,182.52109,1,4.995",9.99",1) # panda=ignore +panda(275.78064,54.782495,182.52109,272.52109,1,0",4.995",1) # panda=ignore +panda(275.78064,54.782495,182.52109,272.52109,1,4.995",9.99",1) # panda=ignore +# compass(275.75254,54.798354,13.32") compass=physical {N} {E} 1 1 text={Compass} +epanda(275.76845,54.790514,2.5210862,272.52109,3,4.995",2.4975",9.99",4.995",1,47.521086) # text={Epanda} +epanda(275.76729,54.782303,47.521086,92.521086,1,4.995",2.4975",9.99",4.995",1,47.521086) # epanda=(47.521086 92.521086 182.52109 272.52109)(4.995" 2.4975" 9.99" 4.995")(47.521086) text={Epanda 2} +epanda(275.76729,54.782303,92.521086,182.52109,1,4.995",2.4975",9.99",4.995",1,47.521086) # epanda=ignore +epanda(275.76729,54.782303,182.52109,272.52109,1,4.995",2.4975",9.99",4.995",1,47.521086) # epanda=ignore +bpanda(275.7545,54.790893,2.5210862,272.52109,3,13.32",6.66",19.98",9.99",1,47.521086) # text={Bpanda} +bpanda(275.75448,54.782745,47.521086,92.521086,1,13.32",6.66",19.98",9.99",1,47.521086) # bpanda=(47.521086 92.521086 182.52109 272.52109)(13.32" 6.66" 19.98" 9.99")(47.521086) text={Bpanda 2} +bpanda(275.75448,54.782745,92.521086,182.52109,1,13.32",6.66",19.98",9.99",1,47.521086) # bpanda=ignore +bpanda(275.75448,54.782745,182.52109,272.52109,1,13.32",6.66",19.98",9.99",1,47.521086) # bpanda=ignore diff --git a/regions/io/tests/data/ds9.mosaic.fk4.hms.reg b/regions/io/tests/data/ds9.mosaic.fk4.hms.reg new file mode 100644 index 00000000..35b05d49 --- /dev/null +++ b/regions/io/tests/data/ds9.mosaic.fk4.hms.reg @@ -0,0 +1,73 @@ +# Region file format: DS9 version 4.1 +global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1 +fk4 +circle(18:13:32.047,+31:23:09.41,6.66") # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +-ellipse(18:13:29.912,+31:23:03.90,13.32",6.66",45.2623) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +-box(18:13:27.572,+31:23:03.40,26.64",13.32",45.2623) # color=yellow font="helvetica 10 bold roman" text={Box} +polygon(18:13:25.772,+31:23:07.18,18:13:24.796,+31:23:19.82,18:13:23.809,+31:23:07.32,18:13:24.786,+31:22:54.68) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +-line(18:13:23.123,+31:22:59.04,18:13:21.570,+31:23:16.12) # line=1 1 color=cyan text={Line} +# vector(18:13:20.682,+31:23:06.52,13.32",45.2623) vector=1 color=red text={Vector} +# text(18:13:19.250,+31:23:01.96) color=magenta font="helvetica 14 bold roman" text={Region} +# ruler(18:13:26.280,+31:22:21.86,18:13:24.624,+31:22:41.62) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +annulus(18:13:32.031,+31:22:32.11,3.33",6.66",9.99") # color=magenta font="helvetica 10 bold roman" text={Annulus} +ellipse(18:13:29.820,+31:22:30.94,4.995",2.4975",9.99",4.995",45.2623) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +box(18:13:27.558,+31:22:30.76,13.32",6.66",19.98",9.99",45.2623) # font="helvetica 10 bold roman" text={Box Annulus} +point(18:13:32.200,+31:22:01.13) # point=circle text={Circle Point} +point(18:13:29.885,+31:22:00.63) # point=box color=red width=3 text={Box Point} +point(18:13:27.780,+31:22:01.44) # point=diamond text={Diamond Point} +point(18:13:31.802,+31:21:44.84) # point=cross color=blue text={Cross Point} +point(18:13:29.827,+31:21:45.32) # point=x text={X Point} +point(18:13:27.824,+31:21:44.46) # point=arrow color=magenta text={Arrow Point} +point(18:13:29.767,+31:21:28.00) # point=boxcircle text={BoxCircle Point} +# projection(18:13:23.575,+31:22:18.71,18:13:21.165,+31:22:40.85,6.66") text={Projection} +panda(18:13:25.206,+31:22:01.62,0.262262,270.262,3,0",9.99",2) # text={Panda} +panda(18:13:25.141,+31:21:31.32,51.8442,90.2623,1,0",4.995",1) # panda=(51.8442 90.2623 180.262 270.262)(0" 4.995" 9.99") text={Panda 2} +panda(18:13:25.141,+31:21:31.32,51.8442,90.2623,1,4.995",9.99",1) # panda=ignore +panda(18:13:25.141,+31:21:31.32,90.2623,180.262,1,0",4.995",1) # panda=ignore +panda(18:13:25.141,+31:21:31.32,90.2623,180.262,1,4.995",9.99",1) # panda=ignore +panda(18:13:25.141,+31:21:31.32,180.262,270.262,1,0",4.995",1) # panda=ignore +panda(18:13:25.141,+31:21:31.32,180.262,270.262,1,4.995",9.99",1) # panda=ignore +# compass(18:13:20.405,+31:22:25.92,13.32") compass=physical {N} {E} 1 1 text={Compass} +epanda(18:13:23.073,+31:21:59.10,0.262262,270.262,3,4.995",2.4975",9.99",4.995",1,45.2623) # text={Epanda} +epanda(18:13:22.983,+31:21:29.47,45.2623,90.2623,1,4.995",2.4975",9.99",4.995",1,45.2623) # epanda=(45.2623 90.2623 180.262 270.262)(4.995" 2.4975" 9.99" 4.995")(45.2623) text={Epanda 2} +epanda(18:13:22.983,+31:21:29.47,90.2623,180.262,1,4.995",2.4975",9.99",4.995",1,45.2623) # epanda=ignore +epanda(18:13:22.983,+31:21:29.47,180.262,270.262,1,4.995",2.4975",9.99",4.995",1,45.2623) # epanda=ignore +bpanda(18:13:20.811,+31:21:59.25,0.262262,270.262,3,13.32",6.66",19.98",9.99",1,45.2623) # text={Bpanda} +bpanda(18:13:20.903,+31:21:29.94,45.2623,90.2623,1,13.32",6.66",19.98",9.99",1,45.2623) # bpanda=(45.2623 90.2623 180.262 270.262)(13.32" 6.66" 19.98" 9.99")(45.2623) text={Bpanda 2} +bpanda(18:13:20.903,+31:21:29.94,90.2623,180.262,1,13.32",6.66",19.98",9.99",1,45.2623) # bpanda=ignore +bpanda(18:13:20.903,+31:21:29.94,180.262,270.262,1,13.32",6.66",19.98",9.99",1,45.2623) # bpanda=ignore +circle(18:13:51.995,+31:25:51.73,6.66") # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +-ellipse(18:13:49.859,+31:25:46.24,13.32",6.66",45.2623) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +-box(18:13:47.517,+31:25:45.76,26.64",13.32",45.2623) # color=yellow font="helvetica 10 bold roman" text={Box} +polygon(18:13:45.718,+31:25:49.57,18:13:44.741,+31:26:02.21,18:13:43.753,+31:25:49.72,18:13:44.729,+31:25:37.07) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +-line(18:13:43.066,+31:25:41.45,18:13:41.513,+31:25:58.55) # line=1 1 color=cyan text={Line} +# vector(18:13:40.624,+31:25:48.96,13.32",45.2623) vector=1 color=red text={Vector} +# text(18:13:39.191,+31:25:44.40) color=magenta font="helvetica 14 bold roman" text={Region} +# ruler(18:13:46.223,+31:25:04.24,18:13:44.567,+31:25:24.01) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +annulus(18:13:51.977,+31:25:14.44,3.33",6.66",9.99") # color=magenta font="helvetica 10 bold roman" text={Annulus} +ellipse(18:13:49.765,+31:25:13.28,4.995",2.4975",9.99",4.995",45.2623) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +box(18:13:47.502,+31:25:13.13,13.32",6.66",19.98",9.99",45.2623) # font="helvetica 10 bold roman" text={Box Annulus} +point(18:13:52.144,+31:24:43.45) # point=circle text={Circle Point} +point(18:13:49.828,+31:24:42.97) # point=box color=red width=3 text={Box Point} +point(18:13:47.722,+31:24:43.81) # point=diamond text={Diamond Point} +point(18:13:51.746,+31:24:27.17) # point=cross color=blue text={Cross Point} +point(18:13:49.769,+31:24:27.66) # point=x text={X Point} +point(18:13:47.766,+31:24:26.82) # point=arrow color=magenta text={Arrow Point} +point(18:13:49.709,+31:24:10.35) # point=boxcircle text={BoxCircle Point} +# projection(18:13:43.516,+31:25:01.12,18:13:41.107,+31:25:23.28,6.66") text={Projection} +panda(18:13:45.147,+31:24:44.01,0.262262,270.262,3,0",9.99",2) # text={Panda} +panda(18:13:45.080,+31:24:13.71,51.8442,90.2623,1,0",4.995",1) # panda=(51.8442 90.2623 180.262 270.262)(0" 4.995" 9.99") text={Panda 2} +panda(18:13:45.080,+31:24:13.71,51.8442,90.2623,1,4.995",9.99",1) # panda=ignore +panda(18:13:45.080,+31:24:13.71,90.2623,180.262,1,0",4.995",1) # panda=ignore +panda(18:13:45.080,+31:24:13.71,90.2623,180.262,1,4.995",9.99",1) # panda=ignore +panda(18:13:45.080,+31:24:13.71,180.262,270.262,1,0",4.995",1) # panda=ignore +panda(18:13:45.080,+31:24:13.71,180.262,270.262,1,4.995",9.99",1) # panda=ignore +# compass(18:13:40.345,+31:25:08.35,13.32") compass=physical {N} {E} 1 1 text={Compass} +epanda(18:13:43.012,+31:24:41.51,0.262262,270.262,3,4.995",2.4975",9.99",4.995",1,45.2623) # text={Epanda} +epanda(18:13:42.921,+31:24:11.88,45.2623,90.2623,1,4.995",2.4975",9.99",4.995",1,45.2623) # epanda=(45.2623 90.2623 180.262 270.262)(4.995" 2.4975" 9.99" 4.995")(45.2623) text={Epanda 2} +epanda(18:13:42.921,+31:24:11.88,90.2623,180.262,1,4.995",2.4975",9.99",4.995",1,45.2623) # epanda=ignore +epanda(18:13:42.921,+31:24:11.88,180.262,270.262,1,4.995",2.4975",9.99",4.995",1,45.2623) # epanda=ignore +bpanda(18:13:40.749,+31:24:41.68,0.262262,270.262,3,13.32",6.66",19.98",9.99",1,45.2623) # text={Bpanda} +bpanda(18:13:40.840,+31:24:12.37,45.2623,90.2623,1,13.32",6.66",19.98",9.99",1,45.2623) # bpanda=(45.2623 90.2623 180.262 270.262)(13.32" 6.66" 19.98" 9.99")(45.2623) text={Bpanda 2} +bpanda(18:13:40.840,+31:24:12.37,90.2623,180.262,1,13.32",6.66",19.98",9.99",1,45.2623) # bpanda=ignore +bpanda(18:13:40.840,+31:24:12.37,180.262,270.262,1,13.32",6.66",19.98",9.99",1,45.2623) # bpanda=ignore diff --git a/regions/io/tests/data/ds9.mosaic.fk4.reg b/regions/io/tests/data/ds9.mosaic.fk4.reg new file mode 100644 index 00000000..587a1fb1 --- /dev/null +++ b/regions/io/tests/data/ds9.mosaic.fk4.reg @@ -0,0 +1,73 @@ +# Region file format: DS9 version 4.1 +global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1 +fk4 +circle(273.38353,31.385947,6.66") # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +-ellipse(273.37463,31.384417,13.32",6.66",45.262262) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +-box(273.36488,31.384277,26.64",13.32",45.262262) # color=yellow font="helvetica 10 bold roman" text={Box} +polygon(273.35739,31.385329,273.35332,31.388839,273.3492,31.385365,273.35327,31.381855) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +-line(273.34635,31.383066,273.33987,31.387812) # line=1 1 color=cyan text={Line} +# vector(273.33617,31.385146,13.32",45.262262) vector=1 color=red text={Vector} +# text(273.33021,31.383877) color=magenta font="helvetica 14 bold roman" text={Region} +# ruler(273.3595,31.372739,273.3526,31.378228) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +annulus(273.38346,31.375587,3.33",6.66",9.99") # color=magenta font="helvetica 10 bold roman" text={Annulus} +ellipse(273.37425,31.375261,4.995",2.4975",9.99",4.995",45.262262) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +box(273.36482,31.375212,13.32",6.66",19.98",9.99",45.262262) # font="helvetica 10 bold roman" text={Box Annulus} +point(273.38416,31.366981) # point=circle text={Circle Point} +point(273.37452,31.366842) # point=box color=red width=3 text={Box Point} +point(273.36575,31.367068) # point=diamond text={Diamond Point} +point(273.38251,31.362457) # point=cross color=blue text={Cross Point} +point(273.37428,31.362588) # point=x text={X Point} +point(273.36594,31.362349) # point=arrow color=magenta text={Arrow Point} +point(273.37403,31.357779) # point=boxcircle text={BoxCircle Point} +# projection(273.34823,31.371865,273.33819,31.378014,6.66") text={Projection} +panda(273.35502,31.367117,0.26226242,270.26226,3,0",9.99",2) # text={Panda} +panda(273.35475,31.3587,51.844162,90.262262,1,0",4.995",1) # panda=(51.844162 90.262262 180.26226 270.26226)(0" 4.995" 9.99") text={Panda 2} +panda(273.35475,31.3587,51.844162,90.262262,1,4.995",9.99",1) # panda=ignore +panda(273.35475,31.3587,90.262262,180.26226,1,0",4.995",1) # panda=ignore +panda(273.35475,31.3587,90.262262,180.26226,1,4.995",9.99",1) # panda=ignore +panda(273.35475,31.3587,180.26226,270.26226,1,0",4.995",1) # panda=ignore +panda(273.35475,31.3587,180.26226,270.26226,1,4.995",9.99",1) # panda=ignore +# compass(273.33502,31.373866,13.32") compass=physical {N} {E} 1 1 text={Compass} +epanda(273.34614,31.366416,0.26226242,270.26226,3,4.995",2.4975",9.99",4.995",1,45.262262) # text={Epanda} +epanda(273.34576,31.358185,45.262262,90.262262,1,4.995",2.4975",9.99",4.995",1,45.262262) # epanda=(45.262262 90.262262 180.26226 270.26226)(4.995" 2.4975" 9.99" 4.995")(45.262262) text={Epanda 2} +epanda(273.34576,31.358185,90.262262,180.26226,1,4.995",2.4975",9.99",4.995",1,45.262262) # epanda=ignore +epanda(273.34576,31.358185,180.26226,270.26226,1,4.995",2.4975",9.99",4.995",1,45.262262) # epanda=ignore +bpanda(273.33671,31.366458,0.26226242,270.26226,3,13.32",6.66",19.98",9.99",1,45.262262) # text={Bpanda} +bpanda(273.3371,31.358316,45.262262,90.262262,1,13.32",6.66",19.98",9.99",1,45.262262) # bpanda=(45.262262 90.262262 180.26226 270.26226)(13.32" 6.66" 19.98" 9.99")(45.262262) text={Bpanda 2} +bpanda(273.3371,31.358316,90.262262,180.26226,1,13.32",6.66",19.98",9.99",1,45.262262) # bpanda=ignore +bpanda(273.3371,31.358316,180.26226,270.26226,1,13.32",6.66",19.98",9.99",1,45.262262) # bpanda=ignore +circle(273.46665,31.431037,6.66") # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +-ellipse(273.45775,31.429512,13.32",6.66",45.262262) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +-box(273.44799,31.429379,26.64",13.32",45.262262) # color=yellow font="helvetica 10 bold roman" text={Box} +polygon(273.44049,31.430435,273.43642,31.433948,273.4323,31.430477,273.43637,31.426964) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +-line(273.42944,31.428179,273.42297,31.43293) # line=1 1 color=cyan text={Line} +# vector(273.41927,31.430266,13.32",45.262262) vector=1 color=red text={Vector} +# text(273.4133,31.429001) color=magenta font="helvetica 14 bold roman" text={Region} +# ruler(273.44259,31.417844,273.4357,31.423337) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +annulus(273.46657,31.420677,3.33",6.66",9.99") # color=magenta font="helvetica 10 bold roman" text={Annulus} +ellipse(273.45735,31.420357,4.995",2.4975",9.99",4.995",45.262262) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +box(273.44792,31.420314,13.32",6.66",19.98",9.99",45.262262) # font="helvetica 10 bold roman" text={Box Annulus} +point(273.46727,31.412071) # point=circle text={Circle Point} +point(273.45762,31.411937) # point=box color=red width=3 text={Box Point} +point(273.44884,31.412169) # point=diamond text={Diamond Point} +point(273.46561,31.407547) # point=cross color=blue text={Cross Point} +point(273.45737,31.407684) # point=x text={X Point} +point(273.44902,31.40745) # point=arrow color=magenta text={Arrow Point} +point(273.45712,31.402875) # point=boxcircle text={BoxCircle Point} +# projection(273.43132,31.416977,273.42128,31.423133,6.66") text={Projection} +panda(273.43811,31.412225,0.26226242,270.26226,3,0",9.99",2) # text={Panda} +panda(273.43783,31.403809,51.844162,90.262262,1,0",4.995",1) # panda=(51.844162 90.262262 180.26226 270.26226)(0" 4.995" 9.99") text={Panda 2} +panda(273.43783,31.403809,51.844162,90.262262,1,4.995",9.99",1) # panda=ignore +panda(273.43783,31.403809,90.262262,180.26226,1,0",4.995",1) # panda=ignore +panda(273.43783,31.403809,90.262262,180.26226,1,4.995",9.99",1) # panda=ignore +panda(273.43783,31.403809,180.26226,270.26226,1,0",4.995",1) # panda=ignore +panda(273.43783,31.403809,180.26226,270.26226,1,4.995",9.99",1) # panda=ignore +# compass(273.41811,31.418987,13.32") compass=physical {N} {E} 1 1 text={Compass} +epanda(273.42922,31.41153,0.26226242,270.26226,3,4.995",2.4975",9.99",4.995",1,45.262262) # text={Epanda} +epanda(273.42884,31.4033,45.262262,90.262262,1,4.995",2.4975",9.99",4.995",1,45.262262) # epanda=(45.262262 90.262262 180.26226 270.26226)(4.995" 2.4975" 9.99" 4.995")(45.262262) text={Epanda 2} +epanda(273.42884,31.4033,90.262262,180.26226,1,4.995",2.4975",9.99",4.995",1,45.262262) # epanda=ignore +epanda(273.42884,31.4033,180.26226,270.26226,1,4.995",2.4975",9.99",4.995",1,45.262262) # epanda=ignore +bpanda(273.41979,31.411578,0.26226242,270.26226,3,13.32",6.66",19.98",9.99",1,45.262262) # text={Bpanda} +bpanda(273.42017,31.403436,45.262262,90.262262,1,13.32",6.66",19.98",9.99",1,45.262262) # bpanda=(45.262262 90.262262 180.26226 270.26226)(13.32" 6.66" 19.98" 9.99")(45.262262) text={Bpanda 2} +bpanda(273.42017,31.403436,90.262262,180.26226,1,13.32",6.66",19.98",9.99",1,45.262262) # bpanda=ignore +bpanda(273.42017,31.403436,180.26226,270.26226,1,13.32",6.66",19.98",9.99",1,45.262262) # bpanda=ignore diff --git a/regions/io/tests/data/ds9.mosaic.fk5.hms.reg b/regions/io/tests/data/ds9.mosaic.fk5.hms.reg new file mode 100644 index 00000000..1c27d985 --- /dev/null +++ b/regions/io/tests/data/ds9.mosaic.fk5.hms.reg @@ -0,0 +1,73 @@ +# Region file format: DS9 version 4.1 +global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1 +fk5 +circle(18:15:25.155,+31:24:12.71,6.66") # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +-ellipse(18:15:23.022,+31:24:07.05,13.32",6.66",44.9398) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +-box(18:15:20.681,+31:24:06.37,26.64",13.32",44.9398) # color=yellow font="helvetica 10 bold roman" text={Box} +polygon(18:15:18.880,+31:24:10.03,18:15:17.898,+31:24:22.59,18:15:16.916,+31:24:10.02,18:15:17.898,+31:23:57.45) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +-line(18:15:16.234,+31:24:01.69,18:15:14.673,+31:24:18.66) # line=1 1 color=cyan text={Line} +# vector(18:15:13.789,+31:24:09.00,13.32",44.9398) vector=1 color=red text={Vector} +# text(18:15:12.358,+31:24:04.33) color=magenta font="helvetica 14 bold roman" text={Region} +# ruler(18:15:19.408,+31:23:24.74,18:15:17.743,+31:23:44.38) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +annulus(18:15:25.155,+31:23:35.41,3.33",6.66",9.99") # color=magenta font="helvetica 10 bold roman" text={Annulus} +ellipse(18:15:22.945,+31:23:34.08,4.995",2.4975",9.99",4.995",44.9398) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +box(18:15:20.682,+31:23:33.74,13.32",6.66",19.98",9.99",44.9398) # font="helvetica 10 bold roman" text={Box Annulus} +point(18:15:25.337,+31:23:04.45) # point=circle text={Circle Point} +point(18:15:23.023,+31:23:03.78) # point=box color=red width=3 text={Box Point} +point(18:15:20.917,+31:23:04.43) # point=diamond text={Diamond Point} +point(18:15:24.948,+31:22:48.13) # point=cross color=blue text={Cross Point} +point(18:15:22.971,+31:22:48.46) # point=x text={X Point} +point(18:15:20.969,+31:22:47.45) # point=arrow color=magenta text={Arrow Point} +point(18:15:22.920,+31:22:31.14) # point=boxcircle text={BoxCircle Point} +# projection(18:15:16.703,+31:23:21.40,18:15:14.284,+31:23:43.36,6.66") text={Projection} +panda(18:15:18.342,+31:23:04.42,359.94,629.94,3,0",9.99",2) # text={Panda} +panda(18:15:18.291,+31:22:34.12,51.5217,89.9398,1,0",4.995",1) # panda=(51.5217 89.9398 179.94 269.94)(0" 4.995" 9.99") text={Panda 2} +panda(18:15:18.291,+31:22:34.12,51.5217,89.9398,1,4.995",9.99",1) # panda=ignore +panda(18:15:18.291,+31:22:34.12,89.9398,179.94,1,0",4.995",1) # panda=ignore +panda(18:15:18.291,+31:22:34.12,89.9398,179.94,1,4.995",9.99",1) # panda=ignore +panda(18:15:18.291,+31:22:34.12,179.94,269.94,1,0",4.995",1) # panda=ignore +panda(18:15:18.291,+31:22:34.12,179.94,269.94,1,4.995",9.99",1) # panda=ignore +# compass(18:15:13.530,+31:23:28.37,13.32") compass=physical {N} {E} 1 1 text={Compass} +epanda(18:15:16.210,+31:23:01.75,359.94,629.94,3,4.995",2.4975",9.99",4.995",1,44.9398) # text={Epanda} +epanda(18:15:16.133,+31:22:32.11,44.9398,89.9398,1,4.995",2.4975",9.99",4.995",1,44.9398) # epanda=(44.9398 89.9398 179.94 269.94)(4.995" 2.4975" 9.99" 4.995")(44.9398) text={Epanda 2} +epanda(18:15:16.133,+31:22:32.11,89.9398,179.94,1,4.995",2.4975",9.99",4.995",1,44.9398) # epanda=ignore +epanda(18:15:16.133,+31:22:32.11,179.94,269.94,1,4.995",2.4975",9.99",4.995",1,44.9398) # epanda=ignore +bpanda(18:15:13.947,+31:23:01.73,359.94,629.94,3,13.32",6.66",19.98",9.99",1,44.9398) # text={Bpanda} +bpanda(18:15:14.053,+31:22:32.43,44.9398,89.9398,1,13.32",6.66",19.98",9.99",1,44.9398) # bpanda=(44.9398 89.9398 179.94 269.94)(13.32" 6.66" 19.98" 9.99")(44.9398) text={Bpanda 2} +bpanda(18:15:14.053,+31:22:32.43,89.9398,179.94,1,13.32",6.66",19.98",9.99",1,44.9398) # bpanda=ignore +bpanda(18:15:14.053,+31:22:32.43,179.94,269.94,1,13.32",6.66",19.98",9.99",1,44.9398) # bpanda=ignore +circle(18:15:45.034,+31:26:56.48,6.66") # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +-ellipse(18:15:42.900,+31:26:50.84,13.32",6.66",44.9398) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +-box(18:15:40.558,+31:26:50.19,26.64",13.32",44.9398) # color=yellow font="helvetica 10 bold roman" text={Box} +polygon(18:15:38.756,+31:26:53.86,18:15:37.774,+31:27:06.44,18:15:36.792,+31:26:53.87,18:15:37.774,+31:26:41.29) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +-line(18:15:36.108,+31:26:45.55,18:15:34.547,+31:27:02.53) # line=1 1 color=cyan text={Line} +# vector(18:15:33.663,+31:26:52.88,13.32",44.9398) vector=1 color=red text={Vector} +# text(18:15:32.231,+31:26:48.22) color=magenta font="helvetica 14 bold roman" text={Region} +# ruler(18:15:39.282,+31:26:08.57,18:15:37.617,+31:26:28.22) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +annulus(18:15:45.033,+31:26:19.19,3.33",6.66",9.99") # color=magenta font="helvetica 10 bold roman" text={Annulus} +ellipse(18:15:42.821,+31:26:17.87,4.995",2.4975",9.99",4.995",44.9398) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +box(18:15:40.557,+31:26:17.55,13.32",6.66",19.98",9.99",44.9398) # font="helvetica 10 bold roman" text={Box Annulus} +point(18:15:45.213,+31:25:48.22) # point=circle text={Circle Point} +point(18:15:42.898,+31:25:47.57) # point=box color=red width=3 text={Box Point} +point(18:15:40.790,+31:25:48.25) # point=diamond text={Diamond Point} +point(18:15:44.822,+31:25:31.90) # point=cross color=blue text={Cross Point} +point(18:15:42.845,+31:25:32.25) # point=x text={X Point} +point(18:15:40.842,+31:25:31.26) # point=arrow color=magenta text={Arrow Point} +point(18:15:42.792,+31:25:14.93) # point=boxcircle text={BoxCircle Point} +# projection(18:15:36.576,+31:26:05.25,18:15:34.157,+31:26:27.24,6.66") text={Projection} +panda(18:15:38.215,+31:25:48.26,359.94,629.94,3,0",9.99",2) # text={Panda} +panda(18:15:38.162,+31:25:17.96,51.5217,89.9398,1,0",4.995",1) # panda=(51.5217 89.9398 179.94 269.94)(0" 4.995" 9.99") text={Panda 2} +panda(18:15:38.162,+31:25:17.96,51.5217,89.9398,1,4.995",9.99",1) # panda=ignore +panda(18:15:38.162,+31:25:17.96,89.9398,179.94,1,0",4.995",1) # panda=ignore +panda(18:15:38.162,+31:25:17.96,89.9398,179.94,1,4.995",9.99",1) # panda=ignore +panda(18:15:38.162,+31:25:17.96,179.94,269.94,1,0",4.995",1) # panda=ignore +panda(18:15:38.162,+31:25:17.96,179.94,269.94,1,4.995",9.99",1) # panda=ignore +# compass(18:15:33.402,+31:26:12.25,13.32") compass=physical {N} {E} 1 1 text={Compass} +epanda(18:15:36.081,+31:25:45.61,359.94,629.94,3,4.995",2.4975",9.99",4.995",1,44.9398) # text={Epanda} +epanda(18:15:36.002,+31:25:15.97,44.9398,89.9398,1,4.995",2.4975",9.99",4.995",1,44.9398) # epanda=(44.9398 89.9398 179.94 269.94)(4.995" 2.4975" 9.99" 4.995")(44.9398) text={Epanda 2} +epanda(18:15:36.002,+31:25:15.97,89.9398,179.94,1,4.995",2.4975",9.99",4.995",1,44.9398) # epanda=ignore +epanda(18:15:36.002,+31:25:15.97,179.94,269.94,1,4.995",2.4975",9.99",4.995",1,44.9398) # epanda=ignore +bpanda(18:15:33.818,+31:25:45.61,359.94,629.94,3,13.32",6.66",19.98",9.99",1,44.9398) # text={Bpanda} +bpanda(18:15:33.921,+31:25:16.31,44.9398,89.9398,1,13.32",6.66",19.98",9.99",1,44.9398) # bpanda=(44.9398 89.9398 179.94 269.94)(13.32" 6.66" 19.98" 9.99")(44.9398) text={Bpanda 2} +bpanda(18:15:33.921,+31:25:16.31,89.9398,179.94,1,13.32",6.66",19.98",9.99",1,44.9398) # bpanda=ignore +bpanda(18:15:33.921,+31:25:16.31,179.94,269.94,1,13.32",6.66",19.98",9.99",1,44.9398) # bpanda=ignore diff --git a/regions/io/tests/data/ds9.mosaic.fk5.reg b/regions/io/tests/data/ds9.mosaic.fk5.reg new file mode 100644 index 00000000..0feaa489 --- /dev/null +++ b/regions/io/tests/data/ds9.mosaic.fk5.reg @@ -0,0 +1,73 @@ +# Region file format: DS9 version 4.1 +global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1 +fk5 +circle(273.85481,31.403531,6.66") # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +-ellipse(273.84593,31.401957,13.32",6.66",44.939783) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +-box(273.83617,31.40177,26.64",13.32",44.939783) # color=yellow font="helvetica 10 bold roman" text={Box} +polygon(273.82867,31.402785,273.82457,31.406276,273.82048,31.402783,273.82458,31.399292) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +-line(273.81764,31.400469,273.81114,31.405184) # line=1 1 color=cyan text={Line} +# vector(273.80745,31.4025,13.32",44.939783) vector=1 color=red text={Vector} +# text(273.80149,31.401202) color=magenta font="helvetica 14 bold roman" text={Region} +# ruler(273.83087,31.390206,273.82393,31.395661) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +annulus(273.85481,31.393171,3.33",6.66",9.99") # color=magenta font="helvetica 10 bold roman" text={Annulus} +ellipse(273.8456,31.3928,4.995",2.4975",9.99",4.995",44.939783) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +box(273.83617,31.392705,13.32",6.66",19.98",9.99",44.939783) # font="helvetica 10 bold roman" text={Box Annulus} +point(273.85557,31.384568) # point=circle text={Circle Point} +point(273.84593,31.384382) # point=box color=red width=3 text={Box Point} +point(273.83715,31.384565) # point=diamond text={Diamond Point} +point(273.85395,31.380036) # point=cross color=blue text={Cross Point} +point(273.84571,31.380127) # point=x text={X Point} +point(273.83737,31.379848) # point=arrow color=magenta text={Arrow Point} +point(273.8455,31.375317) # point=boxcircle text={BoxCircle Point} +# projection(273.8196,31.389277,273.80952,31.395378,6.66") text={Projection} +panda(273.82643,31.384562,359.93978,629.93978,3,0",9.99",2) # text={Panda} +panda(273.82621,31.376145,51.521683,89.939783,1,0",4.995",1) # panda=(51.521683 89.939783 179.93978 269.93978)(0" 4.995" 9.99") text={Panda 2} +panda(273.82621,31.376145,51.521683,89.939783,1,4.995",9.99",1) # panda=ignore +panda(273.82621,31.376145,89.939783,179.93978,1,0",4.995",1) # panda=ignore +panda(273.82621,31.376145,89.939783,179.93978,1,4.995",9.99",1) # panda=ignore +panda(273.82621,31.376145,179.93978,269.93978,1,0",4.995",1) # panda=ignore +panda(273.82621,31.376145,179.93978,269.93978,1,4.995",9.99",1) # panda=ignore +# compass(273.80638,31.391214,13.32") compass=physical {N} {E} 1 1 text={Compass} +epanda(273.81754,31.383819,359.93978,629.93978,3,4.995",2.4975",9.99",4.995",1,44.939783) # text={Epanda} +epanda(273.81722,31.375586,44.939783,89.939783,1,4.995",2.4975",9.99",4.995",1,44.939783) # epanda=(44.939783 89.939783 179.93978 269.93978)(4.995" 2.4975" 9.99" 4.995")(44.939783) text={Epanda 2} +epanda(273.81722,31.375586,89.939783,179.93978,1,4.995",2.4975",9.99",4.995",1,44.939783) # epanda=ignore +epanda(273.81722,31.375586,179.93978,269.93978,1,4.995",2.4975",9.99",4.995",1,44.939783) # epanda=ignore +bpanda(273.80811,31.383815,359.93978,629.93978,3,13.32",6.66",19.98",9.99",1,44.939783) # text={Bpanda} +bpanda(273.80855,31.375675,44.939783,89.939783,1,13.32",6.66",19.98",9.99",1,44.939783) # bpanda=(44.939783 89.939783 179.93978 269.93978)(13.32" 6.66" 19.98" 9.99")(44.939783) text={Bpanda 2} +bpanda(273.80855,31.375675,89.939783,179.93978,1,13.32",6.66",19.98",9.99",1,44.939783) # bpanda=ignore +bpanda(273.80855,31.375675,179.93978,269.93978,1,13.32",6.66",19.98",9.99",1,44.939783) # bpanda=ignore +circle(273.93764,31.449023,6.66") # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +-ellipse(273.92875,31.447455,13.32",6.66",44.939783) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +-box(273.91899,31.447274,26.64",13.32",44.939783) # color=yellow font="helvetica 10 bold roman" text={Box} +polygon(273.91149,31.448294,273.90739,31.451788,273.9033,31.448297,273.90739,31.444803) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +-line(273.90045,31.445985,273.89395,31.450704) # line=1 1 color=cyan text={Line} +# vector(273.89026,31.448022,13.32",44.939783) vector=1 color=red text={Vector} +# text(273.8843,31.446728) color=magenta font="helvetica 14 bold roman" text={Region} +# ruler(273.91367,31.435713,273.90674,31.441173) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +annulus(273.93764,31.438663,3.33",6.66",9.99") # color=magenta font="helvetica 10 bold roman" text={Annulus} +ellipse(273.92842,31.438297,4.995",2.4975",9.99",4.995",44.939783) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +box(273.91899,31.438209,13.32",6.66",19.98",9.99",44.939783) # font="helvetica 10 bold roman" text={Box Annulus} +point(273.93839,31.43006) # point=circle text={Circle Point} +point(273.92874,31.42988) # point=box color=red width=3 text={Box Point} +point(273.91996,31.430069) # point=diamond text={Diamond Point} +point(273.93676,31.425528) # point=cross color=blue text={Cross Point} +point(273.92852,31.425625) # point=x text={X Point} +point(273.92017,31.425351) # point=arrow color=magenta text={Arrow Point} +point(273.9283,31.420815) # point=boxcircle text={BoxCircle Point} +# projection(273.9024,31.434792,273.89232,31.440899,6.66") text={Projection} +panda(273.90923,31.430072,359.93978,629.93978,3,0",9.99",2) # text={Panda} +panda(273.90901,31.421655,51.521683,89.939783,1,0",4.995",1) # panda=(51.521683 89.939783 179.93978 269.93978)(0" 4.995" 9.99") text={Panda 2} +panda(273.90901,31.421655,51.521683,89.939783,1,4.995",9.99",1) # panda=ignore +panda(273.90901,31.421655,89.939783,179.93978,1,0",4.995",1) # panda=ignore +panda(273.90901,31.421655,89.939783,179.93978,1,4.995",9.99",1) # panda=ignore +panda(273.90901,31.421655,179.93978,269.93978,1,0",4.995",1) # panda=ignore +panda(273.90901,31.421655,179.93978,269.93978,1,4.995",9.99",1) # panda=ignore +# compass(273.88917,31.436737,13.32") compass=physical {N} {E} 1 1 text={Compass} +epanda(273.90034,31.429335,359.93978,629.93978,3,4.995",2.4975",9.99",4.995",1,44.939783) # text={Epanda} +epanda(273.90001,31.421103,44.939783,89.939783,1,4.995",2.4975",9.99",4.995",1,44.939783) # epanda=(44.939783 89.939783 179.93978 269.93978)(4.995" 2.4975" 9.99" 4.995")(44.939783) text={Epanda 2} +epanda(273.90001,31.421103,89.939783,179.93978,1,4.995",2.4975",9.99",4.995",1,44.939783) # epanda=ignore +epanda(273.90001,31.421103,179.93978,269.93978,1,4.995",2.4975",9.99",4.995",1,44.939783) # epanda=ignore +bpanda(273.89091,31.429337,359.93978,629.93978,3,13.32",6.66",19.98",9.99",1,44.939783) # text={Bpanda} +bpanda(273.89134,31.421197,44.939783,89.939783,1,13.32",6.66",19.98",9.99",1,44.939783) # bpanda=(44.939783 89.939783 179.93978 269.93978)(13.32" 6.66" 19.98" 9.99")(44.939783) text={Bpanda 2} +bpanda(273.89134,31.421197,89.939783,179.93978,1,13.32",6.66",19.98",9.99",1,44.939783) # bpanda=ignore +bpanda(273.89134,31.421197,179.93978,269.93978,1,13.32",6.66",19.98",9.99",1,44.939783) # bpanda=ignore diff --git a/regions/io/tests/data/ds9.mosaic.galactic.hms.reg b/regions/io/tests/data/ds9.mosaic.galactic.hms.reg new file mode 100644 index 00000000..ce9f8ee8 --- /dev/null +++ b/regions/io/tests/data/ds9.mosaic.galactic.hms.reg @@ -0,0 +1,73 @@ +# Region file format: DS9 version 4.1 +global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1 +galactic +circle(+58:28:21.331,+20:53:04.817,6.66") # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +-ellipse(+58:28:05.723,+20:53:28.587,13.32",6.66",115.143) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +-box(+58:27:54.177,+20:53:56.556,26.64",13.32",115.143) # color=yellow font="helvetica 10 bold roman" text={Box} +polygon(+58:27:49.497,+20:54:19.492,+58:27:57.595,+20:54:35.581,+58:27:40.371,+20:54:43.146,+58:27:32.273,+20:54:27.056) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +-line(+58:27:28.814,+20:54:48.546,+58:27:38.666,+20:55:13.101) # line=1 1 color=cyan text={Line} +# vector(+58:27:24.830,+20:55:20.478,13.32",115.143) vector=1 color=red text={Vector} +# text(+58:27:13.486,+20:55:36.127) color=magenta font="helvetica 14 bold roman" text={Region} +# ruler(+58:27:06.337,+20:53:57.793,+58:27:18.386,+20:54:24.505) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +annulus(+58:27:43.777,+20:52:52.173,3.33",6.66",9.99") # color=magenta font="helvetica 10 bold roman" text={Annulus} +ellipse(+58:27:32.164,+20:53:18.350,4.995",2.4975",9.99",4.995",115.143) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +box(+58:27:21.314,+20:53:45.492,13.32",6.66",19.98",9.99",115.143) # font="helvetica 10 bold roman" text={Box Annulus} +point(+58:27:13.441,+20:52:39.479) # point=circle text={Circle Point} +point(+58:27:02.014,+20:53:07.134) # point=box color=red width=3 text={Box Point} +point(+58:26:52.894,+20:53:32.735) # point=diamond text={Diamond Point} +point(+58:26:55.199,+20:52:38.645) # point=cross color=blue text={Cross Point} +point(+58:26:46.348,+20:53:02.566) # point=x text={X Point} +point(+58:26:36.035,+20:53:26.349) # point=arrow color=magenta text={Arrow Point} +point(+58:26:28.672,+20:52:57.320) # point=boxcircle text={BoxCircle Point} +# projection(+58:26:50.412,+20:54:29.243,+58:27:01.303,+20:55:05.831,6.66") text={Projection} +panda(+58:26:40.926,+20:54:03.748,70.1434,340.143,3,0",9.99",2) # text={Panda} +panda(+58:26:10.170,+20:53:54.097,121.725,160.143,1,0",4.995",1) # panda=(121.725 160.143 250.143 340.143)(0" 4.995" 9.99") text={Panda 2} +panda(+58:26:10.170,+20:53:54.097,121.725,160.143,1,4.995",9.99",1) # panda=ignore +panda(+58:26:10.170,+20:53:54.097,160.143,250.143,1,0",4.995",1) # panda=ignore +panda(+58:26:10.170,+20:53:54.097,160.143,250.143,1,4.995",9.99",1) # panda=ignore +panda(+58:26:10.170,+20:53:54.097,250.143,340.143,1,0",4.995",1) # panda=ignore +panda(+58:26:10.170,+20:53:54.097,250.143,340.143,1,4.995",9.99",1) # panda=ignore +# compass(+58:26:42.705,+20:55:09.833,13.32") compass=physical {N} {E} 1 1 text={Compass} +epanda(+58:26:28.330,+20:54:28.532,70.1434,340.143,3,4.995",2.4975",9.99",4.995",1,115.143) # text={Epanda} +epanda(+58:25:58.122,+20:54:19.419,115.143,160.143,1,4.995",2.4975",9.99",4.995",1,115.143) # epanda=(115.143 160.143 250.143 340.143)(4.995" 2.4975" 9.99" 4.995")(115.143) text={Epanda 2} +epanda(+58:25:58.122,+20:54:19.419,160.143,250.143,1,4.995",2.4975",9.99",4.995",1,115.143) # epanda=ignore +epanda(+58:25:58.122,+20:54:19.419,250.143,340.143,1,4.995",2.4975",9.99",4.995",1,115.143) # epanda=ignore +bpanda(+58:26:17.810,+20:54:55.786,70.1434,340.143,3,13.32",6.66",19.98",9.99",1,115.143) # text={Bpanda} +bpanda(+58:25:48.783,+20:54:44.592,115.143,160.143,1,13.32",6.66",19.98",9.99",1,115.143) # bpanda=(115.143 160.143 250.143 340.143)(13.32" 6.66" 19.98" 9.99")(115.143) text={Bpanda 2} +bpanda(+58:25:48.783,+20:54:44.592,160.143,250.143,1,13.32",6.66",19.98",9.99",1,115.143) # bpanda=ignore +bpanda(+58:25:48.783,+20:54:44.592,250.143,340.143,1,13.32",6.66",19.98",9.99",1,115.143) # bpanda=ignore +circle(+58:32:38.525,+20:50:00.954,6.66") # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +-ellipse(+58:32:22.933,+20:50:24.730,13.32",6.66",115.143) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +-box(+58:32:11.404,+20:50:52.704,26.64",13.32",115.143) # color=yellow font="helvetica 10 bold roman" text={Box} +polygon(+58:32:06.737,+20:51:15.642,+58:32:14.840,+20:51:31.728,+58:31:57.626,+20:51:39.299,+58:31:49.523,+20:51:23.213) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +-line(+58:31:46.075,+20:51:44.704,+58:31:55.935,+20:52:09.255) # line=1 1 color=cyan text={Line} +# vector(+58:31:42.108,+20:52:16.637,13.32",115.143) vector=1 color=red text={Vector} +# text(+58:31:30.774,+20:52:32.291) color=magenta font="helvetica 14 bold roman" text={Region} +# ruler(+58:31:23.582,+20:50:53.961,+58:31:35.640,+20:51:20.667) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +annulus(+58:32:00.978,+20:49:48.325,3.33",6.66",9.99") # color=magenta font="helvetica 10 bold roman" text={Annulus} +ellipse(+58:31:49.381,+20:50:14.507,4.995",2.4975",9.99",4.995",115.143) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +box(+58:31:38.547,+20:50:41.653,13.32",6.66",19.98",9.99",115.143) # font="helvetica 10 bold roman" text={Box Annulus} +point(+58:31:30.646,+20:49:35.644) # point=circle text={Circle Point} +point(+58:31:19.236,+20:50:03.304) # point=box color=red width=3 text={Box Point} +point(+58:31:10.131,+20:50:28.908) # point=diamond text={Diamond Point} +point(+58:31:12.410,+20:49:34.817) # point=cross color=blue text={Cross Point} +point(+58:31:03.573,+20:49:58.742) # point=x text={X Point} +point(+58:30:53.275,+20:50:22.529) # point=arrow color=magenta text={Arrow Point} +point(+58:30:45.900,+20:49:53.503) # point=boxcircle text={BoxCircle Point} +# projection(+58:31:07.677,+20:51:25.418,+58:31:18.581,+20:52:02.000,6.66") text={Projection} +panda(+58:30:58.182,+20:50:59.926,70.1434,340.143,3,0",9.99",2) # text={Panda} +panda(+58:30:27.432,+20:50:50.288,121.725,160.143,1,0",4.995",1) # panda=(121.725 160.143 250.143 340.143)(0" 4.995" 9.99") text={Panda 2} +panda(+58:30:27.432,+20:50:50.288,121.725,160.143,1,4.995",9.99",1) # panda=ignore +panda(+58:30:27.432,+20:50:50.288,160.143,250.143,1,0",4.995",1) # panda=ignore +panda(+58:30:27.432,+20:50:50.288,160.143,250.143,1,4.995",9.99",1) # panda=ignore +panda(+58:30:27.432,+20:50:50.288,250.143,340.143,1,0",4.995",1) # panda=ignore +panda(+58:30:27.432,+20:50:50.288,250.143,340.143,1,4.995",9.99",1) # panda=ignore +# compass(+58:30:59.992,+20:52:06.011,13.32") compass=physical {N} {E} 1 1 text={Compass} +epanda(+58:30:45.602,+20:51:24.716,70.1434,340.143,3,4.995",2.4975",9.99",4.995",1,115.143) # text={Epanda} +epanda(+58:30:15.400,+20:51:15.615,115.143,160.143,1,4.995",2.4975",9.99",4.995",1,115.143) # epanda=(115.143 160.143 250.143 340.143)(4.995" 2.4975" 9.99" 4.995")(115.143) text={Epanda 2} +epanda(+58:30:15.400,+20:51:15.615,160.143,250.143,1,4.995",2.4975",9.99",4.995",1,115.143) # epanda=ignore +epanda(+58:30:15.400,+20:51:15.615,250.143,340.143,1,4.995",2.4975",9.99",4.995",1,115.143) # epanda=ignore +bpanda(+58:30:35.099,+20:51:51.974,70.1434,340.143,3,13.32",6.66",19.98",9.99",1,115.143) # text={Bpanda} +bpanda(+58:30:06.076,+20:51:40.792,115.143,160.143,1,13.32",6.66",19.98",9.99",1,115.143) # bpanda=(115.143 160.143 250.143 340.143)(13.32" 6.66" 19.98" 9.99")(115.143) text={Bpanda 2} +bpanda(+58:30:06.076,+20:51:40.792,160.143,250.143,1,13.32",6.66",19.98",9.99",1,115.143) # bpanda=ignore +bpanda(+58:30:06.076,+20:51:40.792,250.143,340.143,1,13.32",6.66",19.98",9.99",1,115.143) # bpanda=ignore diff --git a/regions/io/tests/data/ds9.mosaic.galactic.reg b/regions/io/tests/data/ds9.mosaic.galactic.reg new file mode 100644 index 00000000..bb1eeedb --- /dev/null +++ b/regions/io/tests/data/ds9.mosaic.galactic.reg @@ -0,0 +1,73 @@ +# Region file format: DS9 version 4.1 +global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1 +galactic +circle(58.472592,20.884671,6.66") # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +-ellipse(58.468256,20.891274,13.32",6.66",115.14338) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +-box(58.465049,20.899043,26.64",13.32",115.14338) # color=yellow font="helvetica 10 bold roman" text={Box} +polygon(58.463749,20.905414,58.465999,20.909884,58.461214,20.911985,58.458965,20.907516) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +-line(58.458004,20.913485,58.460741,20.920306) # line=1 1 color=cyan text={Line} +# vector(58.456897,20.922355,13.32",115.14338) vector=1 color=red text={Vector} +# text(58.453746,20.926702) color=magenta font="helvetica 14 bold roman" text={Region} +# ruler(58.45176,20.899387,58.455107,20.906807) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +annulus(58.46216,20.881159,3.33",6.66",9.99") # color=magenta font="helvetica 10 bold roman" text={Annulus} +ellipse(58.458934,20.88843,4.995",2.4975",9.99",4.995",115.14338) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +box(58.455921,20.89597,13.32",6.66",19.98",9.99",115.14338) # font="helvetica 10 bold roman" text={Box Annulus} +point(58.453734,20.877633) # point=circle text={Circle Point} +point(58.450559,20.885315) # point=box color=red width=3 text={Box Point} +point(58.448026,20.892426) # point=diamond text={Diamond Point} +point(58.448666,20.877401) # point=cross color=blue text={Cross Point} +point(58.446208,20.884046) # point=x text={X Point} +point(58.443343,20.890652) # point=arrow color=magenta text={Arrow Point} +point(58.441298,20.882589) # point=boxcircle text={BoxCircle Point} +# projection(58.447337,20.908123,58.450362,20.918286,6.66") text={Projection} +panda(58.444702,20.901041,70.143383,340.14338,3,0",9.99",2) # text={Panda} +panda(58.436158,20.89836,121.72528,160.14338,1,0",4.995",1) # panda=(121.72528 160.14338 250.14338 340.14338)(0" 4.995" 9.99") text={Panda 2} +panda(58.436158,20.89836,121.72528,160.14338,1,4.995",9.99",1) # panda=ignore +panda(58.436158,20.89836,160.14338,250.14338,1,0",4.995",1) # panda=ignore +panda(58.436158,20.89836,160.14338,250.14338,1,4.995",9.99",1) # panda=ignore +panda(58.436158,20.89836,250.14338,340.14338,1,0",4.995",1) # panda=ignore +panda(58.436158,20.89836,250.14338,340.14338,1,4.995",9.99",1) # panda=ignore +# compass(58.445196,20.919398,13.32") compass=physical {N} {E} 1 1 text={Compass} +epanda(58.441203,20.907926,70.143383,340.14338,3,4.995",2.4975",9.99",4.995",1,115.14338) # text={Epanda} +epanda(58.432812,20.905394,115.14338,160.14338,1,4.995",2.4975",9.99",4.995",1,115.14338) # epanda=(115.14338 160.14338 250.14338 340.14338)(4.995" 2.4975" 9.99" 4.995")(115.14338) text={Epanda 2} +epanda(58.432812,20.905394,160.14338,250.14338,1,4.995",2.4975",9.99",4.995",1,115.14338) # epanda=ignore +epanda(58.432812,20.905394,250.14338,340.14338,1,4.995",2.4975",9.99",4.995",1,115.14338) # epanda=ignore +bpanda(58.438281,20.915496,70.143383,340.14338,3,13.32",6.66",19.98",9.99",1,115.14338) # text={Bpanda} +bpanda(58.430218,20.912387,115.14338,160.14338,1,13.32",6.66",19.98",9.99",1,115.14338) # bpanda=(115.14338 160.14338 250.14338 340.14338)(13.32" 6.66" 19.98" 9.99")(115.14338) text={Bpanda 2} +bpanda(58.430218,20.912387,160.14338,250.14338,1,13.32",6.66",19.98",9.99",1,115.14338) # bpanda=ignore +bpanda(58.430218,20.912387,250.14338,340.14338,1,13.32",6.66",19.98",9.99",1,115.14338) # bpanda=ignore +circle(58.544035,20.833598,6.66") # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +-ellipse(58.539704,20.840203,13.32",6.66",115.14338) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +-box(58.536501,20.847973,26.64",13.32",115.14338) # color=yellow font="helvetica 10 bold roman" text={Box} +polygon(58.535205,20.854345,58.537456,20.858813,58.532674,20.860917,58.530423,20.856448) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +-line(58.529465,20.862418,58.532204,20.869237) # line=1 1 color=cyan text={Line} +# vector(58.528363,20.871288,13.32",115.14338) vector=1 color=red text={Vector} +# text(58.525215,20.875636) color=magenta font="helvetica 14 bold roman" text={Region} +# ruler(58.523217,20.848322,58.526567,20.855741) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +annulus(58.533605,20.83009,3.33",6.66",9.99") # color=magenta font="helvetica 10 bold roman" text={Annulus} +ellipse(58.530384,20.837363,4.995",2.4975",9.99",4.995",115.14338) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +box(58.527374,20.844904,13.32",6.66",19.98",9.99",115.14338) # font="helvetica 10 bold roman" text={Box Annulus} +point(58.525179,20.826568) # point=circle text={Circle Point} +point(58.52201,20.834251) # point=box color=red width=3 text={Box Point} +point(58.519481,20.841363) # point=diamond text={Diamond Point} +point(58.520114,20.826338) # point=cross color=blue text={Cross Point} +point(58.517659,20.832984) # point=x text={X Point} +point(58.514798,20.839591) # point=arrow color=magenta text={Arrow Point} +point(58.51275,20.831529) # point=boxcircle text={BoxCircle Point} +# projection(58.518799,20.85706,58.521828,20.867222,6.66") text={Projection} +panda(58.516162,20.84998,70.143383,340.14338,3,0",9.99",2) # text={Panda} +panda(58.50762,20.847302,121.72528,160.14338,1,0",4.995",1) # panda=(121.72528 160.14338 250.14338 340.14338)(0" 4.995" 9.99") text={Panda 2} +panda(58.50762,20.847302,121.72528,160.14338,1,4.995",9.99",1) # panda=ignore +panda(58.50762,20.847302,160.14338,250.14338,1,0",4.995",1) # panda=ignore +panda(58.50762,20.847302,160.14338,250.14338,1,4.995",9.99",1) # panda=ignore +panda(58.50762,20.847302,250.14338,340.14338,1,0",4.995",1) # panda=ignore +panda(58.50762,20.847302,250.14338,340.14338,1,4.995",9.99",1) # panda=ignore +# compass(58.516664,20.868336,13.32") compass=physical {N} {E} 1 1 text={Compass} +epanda(58.512667,20.856865,70.143383,340.14338,3,4.995",2.4975",9.99",4.995",1,115.14338) # text={Epanda} +epanda(58.504278,20.854338,115.14338,160.14338,1,4.995",2.4975",9.99",4.995",1,115.14338) # epanda=(115.14338 160.14338 250.14338 340.14338)(4.995" 2.4975" 9.99" 4.995")(115.14338) text={Epanda 2} +epanda(58.504278,20.854338,160.14338,250.14338,1,4.995",2.4975",9.99",4.995",1,115.14338) # epanda=ignore +epanda(58.504278,20.854338,250.14338,340.14338,1,4.995",2.4975",9.99",4.995",1,115.14338) # epanda=ignore +bpanda(58.50975,20.864437,70.143383,340.14338,3,13.32",6.66",19.98",9.99",1,115.14338) # text={Bpanda} +bpanda(58.501688,20.861331,115.14338,160.14338,1,13.32",6.66",19.98",9.99",1,115.14338) # bpanda=(115.14338 160.14338 250.14338 340.14338)(13.32" 6.66" 19.98" 9.99")(115.14338) text={Bpanda 2} +bpanda(58.501688,20.861331,160.14338,250.14338,1,13.32",6.66",19.98",9.99",1,115.14338) # bpanda=ignore +bpanda(58.501688,20.861331,250.14338,340.14338,1,13.32",6.66",19.98",9.99",1,115.14338) # bpanda=ignore diff --git a/regions/io/tests/data/ds9.mosaic.icrs.hms.reg b/regions/io/tests/data/ds9.mosaic.icrs.hms.reg new file mode 100644 index 00000000..9d875faf --- /dev/null +++ b/regions/io/tests/data/ds9.mosaic.icrs.hms.reg @@ -0,0 +1,73 @@ +# Region file format: DS9 version 4.1 +global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1 +icrs +circle(18:15:25.154,+31:24:12.69,6.66") # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +-ellipse(18:15:23.021,+31:24:07.03,13.32",6.66",44.9398) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +-box(18:15:20.680,+31:24:06.35,26.64",13.32",44.9398) # color=yellow font="helvetica 10 bold roman" text={Box} +polygon(18:15:18.879,+31:24:10.01,18:15:17.897,+31:24:22.57,18:15:16.915,+31:24:10.00,18:15:17.897,+31:23:57.43) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +-line(18:15:16.233,+31:24:01.67,18:15:14.671,+31:24:18.64) # line=1 1 color=cyan text={Line} +# vector(18:15:13.787,+31:24:08.98,13.32",44.9398) vector=1 color=red text={Vector} +# text(18:15:12.357,+31:24:04.31) color=magenta font="helvetica 14 bold roman" text={Region} +# ruler(18:15:19.407,+31:23:24.72,18:15:17.742,+31:23:44.36) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +annulus(18:15:25.154,+31:23:35.39,3.33",6.66",9.99") # color=magenta font="helvetica 10 bold roman" text={Annulus} +ellipse(18:15:22.943,+31:23:34.06,4.995",2.4975",9.99",4.995",44.9398) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +box(18:15:20.681,+31:23:33.72,13.32",6.66",19.98",9.99",44.9398) # font="helvetica 10 bold roman" text={Box Annulus} +point(18:15:25.336,+31:23:04.43) # point=circle text={Circle Point} +point(18:15:23.022,+31:23:03.76) # point=box color=red width=3 text={Box Point} +point(18:15:20.915,+31:23:04.41) # point=diamond text={Diamond Point} +point(18:15:24.946,+31:22:48.11) # point=cross color=blue text={Cross Point} +point(18:15:22.970,+31:22:48.44) # point=x text={X Point} +point(18:15:20.968,+31:22:47.43) # point=arrow color=magenta text={Arrow Point} +point(18:15:22.918,+31:22:31.12) # point=boxcircle text={BoxCircle Point} +# projection(18:15:16.702,+31:23:21.38,18:15:14.283,+31:23:43.34,6.66") text={Projection} +panda(18:15:18.341,+31:23:04.40,359.94,629.94,3,0",9.99",2) # text={Panda} +panda(18:15:18.290,+31:22:34.10,51.5217,89.9398,1,0",4.995",1) # panda=(51.5217 89.9398 179.94 269.94)(0" 4.995" 9.99") text={Panda 2} +panda(18:15:18.290,+31:22:34.10,51.5217,89.9398,1,4.995",9.99",1) # panda=ignore +panda(18:15:18.290,+31:22:34.10,89.9398,179.94,1,0",4.995",1) # panda=ignore +panda(18:15:18.290,+31:22:34.10,89.9398,179.94,1,4.995",9.99",1) # panda=ignore +panda(18:15:18.290,+31:22:34.10,179.94,269.94,1,0",4.995",1) # panda=ignore +panda(18:15:18.290,+31:22:34.10,179.94,269.94,1,4.995",9.99",1) # panda=ignore +# compass(18:15:13.529,+31:23:28.35,13.32") compass=physical {N} {E} 1 1 text={Compass} +epanda(18:15:16.209,+31:23:01.73,359.94,629.94,3,4.995",2.4975",9.99",4.995",1,44.9398) # text={Epanda} +epanda(18:15:16.132,+31:22:32.09,44.9398,89.9398,1,4.995",2.4975",9.99",4.995",1,44.9398) # epanda=(44.9398 89.9398 179.94 269.94)(4.995" 2.4975" 9.99" 4.995")(44.9398) text={Epanda 2} +epanda(18:15:16.132,+31:22:32.09,89.9398,179.94,1,4.995",2.4975",9.99",4.995",1,44.9398) # epanda=ignore +epanda(18:15:16.132,+31:22:32.09,179.94,269.94,1,4.995",2.4975",9.99",4.995",1,44.9398) # epanda=ignore +bpanda(18:15:13.946,+31:23:01.71,359.94,629.94,3,13.32",6.66",19.98",9.99",1,44.9398) # text={Bpanda} +bpanda(18:15:14.052,+31:22:32.41,44.9398,89.9398,1,13.32",6.66",19.98",9.99",1,44.9398) # bpanda=(44.9398 89.9398 179.94 269.94)(13.32" 6.66" 19.98" 9.99")(44.9398) text={Bpanda 2} +bpanda(18:15:14.052,+31:22:32.41,89.9398,179.94,1,13.32",6.66",19.98",9.99",1,44.9398) # bpanda=ignore +bpanda(18:15:14.052,+31:22:32.41,179.94,269.94,1,13.32",6.66",19.98",9.99",1,44.9398) # bpanda=ignore +circle(18:15:45.033,+31:26:56.46,6.66") # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +-ellipse(18:15:42.899,+31:26:50.82,13.32",6.66",44.9398) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +-box(18:15:40.557,+31:26:50.17,26.64",13.32",44.9398) # color=yellow font="helvetica 10 bold roman" text={Box} +polygon(18:15:38.755,+31:26:53.84,18:15:37.773,+31:27:06.42,18:15:36.790,+31:26:53.85,18:15:37.773,+31:26:41.27) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +-line(18:15:36.107,+31:26:45.53,18:15:34.546,+31:27:02.51) # line=1 1 color=cyan text={Line} +# vector(18:15:33.661,+31:26:52.86,13.32",44.9398) vector=1 color=red text={Vector} +# text(18:15:32.230,+31:26:48.20) color=magenta font="helvetica 14 bold roman" text={Region} +# ruler(18:15:39.281,+31:26:08.55,18:15:37.616,+31:26:28.20) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +annulus(18:15:45.031,+31:26:19.17,3.33",6.66",9.99") # color=magenta font="helvetica 10 bold roman" text={Annulus} +ellipse(18:15:42.820,+31:26:17.85,4.995",2.4975",9.99",4.995",44.9398) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +box(18:15:40.556,+31:26:17.53,13.32",6.66",19.98",9.99",44.9398) # font="helvetica 10 bold roman" text={Box Annulus} +point(18:15:45.212,+31:25:48.20) # point=circle text={Circle Point} +point(18:15:42.896,+31:25:47.55) # point=box color=red width=3 text={Box Point} +point(18:15:40.789,+31:25:48.23) # point=diamond text={Diamond Point} +point(18:15:44.821,+31:25:31.88) # point=cross color=blue text={Cross Point} +point(18:15:42.844,+31:25:32.23) # point=x text={X Point} +point(18:15:40.841,+31:25:31.24) # point=arrow color=magenta text={Arrow Point} +point(18:15:42.791,+31:25:14.91) # point=boxcircle text={BoxCircle Point} +# projection(18:15:36.575,+31:26:05.23,18:15:34.155,+31:26:27.22,6.66") text={Projection} +panda(18:15:38.213,+31:25:48.24,359.94,629.94,3,0",9.99",2) # text={Panda} +panda(18:15:38.160,+31:25:17.94,51.5217,89.9398,1,0",4.995",1) # panda=(51.5217 89.9398 179.94 269.94)(0" 4.995" 9.99") text={Panda 2} +panda(18:15:38.160,+31:25:17.94,51.5217,89.9398,1,4.995",9.99",1) # panda=ignore +panda(18:15:38.160,+31:25:17.94,89.9398,179.94,1,0",4.995",1) # panda=ignore +panda(18:15:38.160,+31:25:17.94,89.9398,179.94,1,4.995",9.99",1) # panda=ignore +panda(18:15:38.160,+31:25:17.94,179.94,269.94,1,0",4.995",1) # panda=ignore +panda(18:15:38.160,+31:25:17.94,179.94,269.94,1,4.995",9.99",1) # panda=ignore +# compass(18:15:33.401,+31:26:12.23,13.32") compass=physical {N} {E} 1 1 text={Compass} +epanda(18:15:36.080,+31:25:45.59,359.94,629.94,3,4.995",2.4975",9.99",4.995",1,44.9398) # text={Epanda} +epanda(18:15:36.001,+31:25:15.95,44.9398,89.9398,1,4.995",2.4975",9.99",4.995",1,44.9398) # epanda=(44.9398 89.9398 179.94 269.94)(4.995" 2.4975" 9.99" 4.995")(44.9398) text={Epanda 2} +epanda(18:15:36.001,+31:25:15.95,89.9398,179.94,1,4.995",2.4975",9.99",4.995",1,44.9398) # epanda=ignore +epanda(18:15:36.001,+31:25:15.95,179.94,269.94,1,4.995",2.4975",9.99",4.995",1,44.9398) # epanda=ignore +bpanda(18:15:33.816,+31:25:45.59,359.94,629.94,3,13.32",6.66",19.98",9.99",1,44.9398) # text={Bpanda} +bpanda(18:15:33.920,+31:25:16.29,44.9398,89.9398,1,13.32",6.66",19.98",9.99",1,44.9398) # bpanda=(44.9398 89.9398 179.94 269.94)(13.32" 6.66" 19.98" 9.99")(44.9398) text={Bpanda 2} +bpanda(18:15:33.920,+31:25:16.29,89.9398,179.94,1,13.32",6.66",19.98",9.99",1,44.9398) # bpanda=ignore +bpanda(18:15:33.920,+31:25:16.29,179.94,269.94,1,13.32",6.66",19.98",9.99",1,44.9398) # bpanda=ignore diff --git a/regions/io/tests/data/ds9.mosaic.icrs.reg b/regions/io/tests/data/ds9.mosaic.icrs.reg new file mode 100644 index 00000000..18ad0d81 --- /dev/null +++ b/regions/io/tests/data/ds9.mosaic.icrs.reg @@ -0,0 +1,73 @@ +# Region file format: DS9 version 4.1 +global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1 +icrs +circle(273.85481,31.403525,6.66") # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +-ellipse(273.84592,31.401951,13.32",6.66",44.939786) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +-box(273.83617,31.401764,26.64",13.32",44.939786) # color=yellow font="helvetica 10 bold roman" text={Box} +polygon(273.82866,31.40278,273.82457,31.406271,273.82048,31.402777,273.82457,31.399286) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +-line(273.81764,31.400463,273.81113,31.405178) # line=1 1 color=cyan text={Line} +# vector(273.80745,31.402494,13.32",44.939786) vector=1 color=red text={Vector} +# text(273.80149,31.401196) color=magenta font="helvetica 14 bold roman" text={Region} +# ruler(273.83086,31.3902,273.82392,31.395656) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +annulus(273.85481,31.393165,3.33",6.66",9.99") # color=magenta font="helvetica 10 bold roman" text={Annulus} +ellipse(273.8456,31.392794,4.995",2.4975",9.99",4.995",44.939786) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +box(273.83617,31.392699,13.32",6.66",19.98",9.99",44.939786) # font="helvetica 10 bold roman" text={Box Annulus} +point(273.85557,31.384563) # point=circle text={Circle Point} +point(273.84592,31.384376) # point=box color=red width=3 text={Box Point} +point(273.83715,31.38456) # point=diamond text={Diamond Point} +point(273.85394,31.38003) # point=cross color=blue text={Cross Point} +point(273.84571,31.380121) # point=x text={X Point} +point(273.83737,31.379842) # point=arrow color=magenta text={Arrow Point} +point(273.84549,31.375311) # point=boxcircle text={BoxCircle Point} +# projection(273.81959,31.389272,273.80951,31.395372,6.66") text={Projection} +panda(273.82642,31.384557,359.93979,629.93979,3,0",9.99",2) # text={Panda} +panda(273.82621,31.376139,51.521686,89.939786,1,0",4.995",1) # panda=(51.521686 89.939786 179.93979 269.93979)(0" 4.995" 9.99") text={Panda 2} +panda(273.82621,31.376139,51.521686,89.939786,1,4.995",9.99",1) # panda=ignore +panda(273.82621,31.376139,89.939786,179.93979,1,0",4.995",1) # panda=ignore +panda(273.82621,31.376139,89.939786,179.93979,1,4.995",9.99",1) # panda=ignore +panda(273.82621,31.376139,179.93979,269.93979,1,0",4.995",1) # panda=ignore +panda(273.82621,31.376139,179.93979,269.93979,1,4.995",9.99",1) # panda=ignore +# compass(273.80637,31.391209,13.32") compass=physical {N} {E} 1 1 text={Compass} +epanda(273.81754,31.383813,359.93979,629.93979,3,4.995",2.4975",9.99",4.995",1,44.939786) # text={Epanda} +epanda(273.81722,31.375581,44.939786,89.939786,1,4.995",2.4975",9.99",4.995",1,44.939786) # epanda=(44.939786 89.939786 179.93979 269.93979)(4.995" 2.4975" 9.99" 4.995")(44.939786) text={Epanda 2} +epanda(273.81722,31.375581,89.939786,179.93979,1,4.995",2.4975",9.99",4.995",1,44.939786) # epanda=ignore +epanda(273.81722,31.375581,179.93979,269.93979,1,4.995",2.4975",9.99",4.995",1,44.939786) # epanda=ignore +bpanda(273.80811,31.383809,359.93979,629.93979,3,13.32",6.66",19.98",9.99",1,44.939786) # text={Bpanda} +bpanda(273.80855,31.37567,44.939786,89.939786,1,13.32",6.66",19.98",9.99",1,44.939786) # bpanda=(44.939786 89.939786 179.93979 269.93979)(13.32" 6.66" 19.98" 9.99")(44.939786) text={Bpanda 2} +bpanda(273.80855,31.37567,89.939786,179.93979,1,13.32",6.66",19.98",9.99",1,44.939786) # bpanda=ignore +bpanda(273.80855,31.37567,179.93979,269.93979,1,13.32",6.66",19.98",9.99",1,44.939786) # bpanda=ignore +circle(273.93764,31.449017,6.66") # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +-ellipse(273.92875,31.447449,13.32",6.66",44.939786) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +-box(273.91899,31.447268,26.64",13.32",44.939786) # color=yellow font="helvetica 10 bold roman" text={Box} +polygon(273.91148,31.448289,273.90739,31.451782,273.90329,31.448291,273.90739,31.444798) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +-line(273.90045,31.445979,273.89394,31.450698) # line=1 1 color=cyan text={Line} +# vector(273.89026,31.448016,13.32",44.939786) vector=1 color=red text={Vector} +# text(273.88429,31.446722) color=magenta font="helvetica 14 bold roman" text={Region} +# ruler(273.91367,31.435708,273.90673,31.441168) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +annulus(273.93763,31.438657,3.33",6.66",9.99") # color=magenta font="helvetica 10 bold roman" text={Annulus} +ellipse(273.92842,31.438292,4.995",2.4975",9.99",4.995",44.939786) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +box(273.91898,31.438203,13.32",6.66",19.98",9.99",44.939786) # font="helvetica 10 bold roman" text={Box Annulus} +point(273.93838,31.430054) # point=circle text={Circle Point} +point(273.92874,31.429874) # point=box color=red width=3 text={Box Point} +point(273.91995,31.430063) # point=diamond text={Diamond Point} +point(273.93675,31.425523) # point=cross color=blue text={Cross Point} +point(273.92852,31.425619) # point=x text={X Point} +point(273.92017,31.425345) # point=arrow color=magenta text={Arrow Point} +point(273.9283,31.420809) # point=boxcircle text={BoxCircle Point} +# projection(273.90239,31.434786,273.89231,31.440894,6.66") text={Projection} +panda(273.90922,31.430067,359.93979,629.93979,3,0",9.99",2) # text={Panda} +panda(273.909,31.421649,51.521686,89.939786,1,0",4.995",1) # panda=(51.521686 89.939786 179.93979 269.93979)(0" 4.995" 9.99") text={Panda 2} +panda(273.909,31.421649,51.521686,89.939786,1,4.995",9.99",1) # panda=ignore +panda(273.909,31.421649,89.939786,179.93979,1,0",4.995",1) # panda=ignore +panda(273.909,31.421649,89.939786,179.93979,1,4.995",9.99",1) # panda=ignore +panda(273.909,31.421649,179.93979,269.93979,1,0",4.995",1) # panda=ignore +panda(273.909,31.421649,179.93979,269.93979,1,4.995",9.99",1) # panda=ignore +# compass(273.88917,31.436732,13.32") compass=physical {N} {E} 1 1 text={Compass} +epanda(273.90033,31.429329,359.93979,629.93979,3,4.995",2.4975",9.99",4.995",1,44.939786) # text={Epanda} +epanda(273.9,31.421097,44.939786,89.939786,1,4.995",2.4975",9.99",4.995",1,44.939786) # epanda=(44.939786 89.939786 179.93979 269.93979)(4.995" 2.4975" 9.99" 4.995")(44.939786) text={Epanda 2} +epanda(273.9,31.421097,89.939786,179.93979,1,4.995",2.4975",9.99",4.995",1,44.939786) # epanda=ignore +epanda(273.9,31.421097,179.93979,269.93979,1,4.995",2.4975",9.99",4.995",1,44.939786) # epanda=ignore +bpanda(273.8909,31.429331,359.93979,629.93979,3,13.32",6.66",19.98",9.99",1,44.939786) # text={Bpanda} +bpanda(273.89133,31.421191,44.939786,89.939786,1,13.32",6.66",19.98",9.99",1,44.939786) # bpanda=(44.939786 89.939786 179.93979 269.93979)(13.32" 6.66" 19.98" 9.99")(44.939786) text={Bpanda 2} +bpanda(273.89133,31.421191,89.939786,179.93979,1,13.32",6.66",19.98",9.99",1,44.939786) # bpanda=ignore +bpanda(273.89133,31.421191,179.93979,269.93979,1,13.32",6.66",19.98",9.99",1,44.939786) # bpanda=ignore diff --git a/regions/io/tests/data/ds9.mosaic.image.reg b/regions/io/tests/data/ds9.mosaic.image.reg new file mode 100644 index 00000000..ad581025 --- /dev/null +++ b/regions/io/tests/data/ds9.mosaic.image.reg @@ -0,0 +1,143 @@ +# Region file format: DS9 version 4.1 +global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1 +image +# tile 1 +circle(97,1963,20) # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +# tile 1 +-ellipse(179,1946,40,20,45) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +# tile 1 +-box(269,1944,80,40,45) # color=yellow font="helvetica 10 bold roman" text={Box} +# tile 1 +polygon(338.24723,1955,376,1992.7528,413.75277,1955,376,1917.2472) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +# tile 1 +-line(440,1930,500,1981) # line=1 1 color=cyan text={Line} +# tile 1 +# vector(534,1952,40,45) vector=1 color=red text={Vector} +# tile 1 +# text(589,1938) color=magenta font="helvetica 14 bold roman" text={Region} +# tile 1 +# ruler(318,1819,382,1878) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +# tile 1 +annulus(97,1851,10,20,30) # color=magenta font="helvetica 10 bold roman" text={Annulus} +# tile 1 +ellipse(182,1847,15,7.5,30,15,45) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +# tile 1 +box(269,1846,40,20,60,30,45) # font="helvetica 10 bold roman" text={Box Annulus} +# tile 1 +point(90,1758) # point=circle text={Circle Point} +# tile 1 +point(179,1756) # point=box color=red width=3 text={Box Point} +# tile 1 +point(260,1758) # point=diamond text={Diamond Point} +# tile 1 +point(105,1709) # point=cross color=blue text={Cross Point} +# tile 1 +point(181,1710) # point=x text={X Point} +# tile 1 +point(258,1707) # point=arrow color=magenta text={Arrow Point} +# tile 1 +point(183,1658) # point=boxcircle text={BoxCircle Point} +# tile 1 +# projection(422,1809,515,1875,20) text={Projection} +# tile 1 +panda(359,1758,0,270,3,0,30,2) # text={Panda} +# tile 1 +panda(361,1667,51.5819,90,1,0,15,1) # panda=(51.5819 90 180 270)(0 15 30) text={Panda 2} +# tile 1 +panda(361,1667,51.5819,90,1,15,30,1) # panda=ignore +# tile 1 +panda(361,1667,90,180,1,0,15,1) # panda=ignore +# tile 1 +panda(361,1667,90,180,1,15,30,1) # panda=ignore +# tile 1 +panda(361,1667,180,270,1,0,15,1) # panda=ignore +# tile 1 +panda(361,1667,180,270,1,15,30,1) # panda=ignore +# tile 1 +# compass(544,1830,40) compass=physical {N} {E} 1 1 text={Compass} +# tile 1 +epanda(441,1750,0,270,3,15,7.5,30,15,1,45) # text={Epanda} +# tile 1 +epanda(444,1661,45,90,1,15,7.5,30,15,1,45) # epanda=(45 90 180 270)(15 7.5 30 15)(45) text={Epanda 2} +# tile 1 +epanda(444,1661,90,180,1,15,7.5,30,15,1,45) # epanda=ignore +# tile 1 +epanda(444,1661,180,270,1,15,7.5,30,15,1,45) # epanda=ignore +# tile 1 +bpanda(528,1750,0,270,3,40,20,60,30,1,45) # text={Bpanda} +# tile 1 +bpanda(524,1662,45,90,1,40,20,60,30,1,45) # bpanda=(45 90 180 270)(40 20 60 30)(45) text={Bpanda 2} +# tile 1 +bpanda(524,1662,90,180,1,40,20,60,30,1,45) # bpanda=ignore +# tile 1 +bpanda(524,1662,180,270,1,40,20,60,30,1,45) # bpanda=ignore +# tile 3 +circle(1465,363,20) # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +# tile 3 +-ellipse(1547,346,40,20,45) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +# tile 3 +-box(1637,344,80,40,45) # color=yellow font="helvetica 10 bold roman" text={Box} +# tile 3 +polygon(1706.2472,355,1744,392.75275,1781.7528,355,1744,317.24723) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +# tile 3 +-line(1808,330,1868,381) # line=1 1 color=cyan text={Line} +# tile 3 +# vector(1902,352,40,45) vector=1 color=red text={Vector} +# tile 3 +# text(1957,338) color=magenta font="helvetica 14 bold roman" text={Region} +# tile 3 +# ruler(1686,219,1750,278) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +# tile 3 +annulus(1465,251,10,20,30) # color=magenta font="helvetica 10 bold roman" text={Annulus} +# tile 3 +ellipse(1550,247,15,7.5,30,15,45) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +# tile 3 +box(1637,246,40,20,60,30,45) # font="helvetica 10 bold roman" text={Box Annulus} +# tile 3 +point(1458,158) # point=circle text={Circle Point} +# tile 3 +point(1547,156) # point=box color=red width=3 text={Box Point} +# tile 3 +point(1628,158) # point=diamond text={Diamond Point} +# tile 3 +point(1473,109) # point=cross color=blue text={Cross Point} +# tile 3 +point(1549,110) # point=x text={X Point} +# tile 3 +point(1626,107) # point=arrow color=magenta text={Arrow Point} +# tile 3 +point(1551,58) # point=boxcircle text={BoxCircle Point} +# tile 3 +# projection(1790,209,1883,275,20) text={Projection} +# tile 3 +panda(1727,158,0,270,3,0,30,2) # text={Panda} +# tile 3 +panda(1729,67,51.5819,90,1,0,15,1) # panda=(51.5819 90 180 270)(0 15 30) text={Panda 2} +# tile 3 +panda(1729,67,51.5819,90,1,15,30,1) # panda=ignore +# tile 3 +panda(1729,67,90,180,1,0,15,1) # panda=ignore +# tile 3 +panda(1729,67,90,180,1,15,30,1) # panda=ignore +# tile 3 +panda(1729,67,180,270,1,0,15,1) # panda=ignore +# tile 3 +panda(1729,67,180,270,1,15,30,1) # panda=ignore +# tile 3 +# compass(1912,230,40) compass=physical {N} {E} 1 1 text={Compass} +# tile 3 +epanda(1809,150,0,270,3,15,7.5,30,15,1,45) # text={Epanda} +# tile 3 +epanda(1812,61,45,90,1,15,7.5,30,15,1,45) # epanda=(45 90 180 270)(15 7.5 30 15)(45) text={Epanda 2} +# tile 3 +epanda(1812,61,90,180,1,15,7.5,30,15,1,45) # epanda=ignore +# tile 3 +epanda(1812,61,180,270,1,15,7.5,30,15,1,45) # epanda=ignore +# tile 3 +bpanda(1896,150,0,270,3,40,20,60,30,1,45) # text={Bpanda} +# tile 3 +bpanda(1892,62,45,90,1,40,20,60,30,1,45) # bpanda=(45 90 180 270)(40 20 60 30)(45) text={Bpanda 2} +# tile 3 +bpanda(1892,62,90,180,1,40,20,60,30,1,45) # bpanda=ignore +# tile 3 +bpanda(1892,62,180,270,1,40,20,60,30,1,45) # bpanda=ignore diff --git a/regions/io/tests/data/ds9.mosaic.physical.reg b/regions/io/tests/data/ds9.mosaic.physical.reg new file mode 100644 index 00000000..999f934c --- /dev/null +++ b/regions/io/tests/data/ds9.mosaic.physical.reg @@ -0,0 +1,143 @@ +# Region file format: DS9 version 4.1 +global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1 +physical +# tile 1 +circle(66,1963,20) # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +# tile 1 +-ellipse(148,1946,40,20,45) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +# tile 1 +-box(238,1944,80,40,45) # color=yellow font="helvetica 10 bold roman" text={Box} +# tile 1 +polygon(307.24723,1955,345,1992.7528,382.75277,1955,345,1917.2472) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +# tile 1 +-line(409,1930,469,1981) # line=1 1 color=cyan text={Line} +# tile 1 +# vector(503,1952,40,45) vector=1 color=red text={Vector} +# tile 1 +# text(558,1938) color=magenta font="helvetica 14 bold roman" text={Region} +# tile 1 +# ruler(287,1819,351,1878) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +# tile 1 +annulus(66,1851,10,20,30) # color=magenta font="helvetica 10 bold roman" text={Annulus} +# tile 1 +ellipse(151,1847,15,7.5,30,15,45) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +# tile 1 +box(238,1846,40,20,60,30,45) # font="helvetica 10 bold roman" text={Box Annulus} +# tile 1 +point(59,1758) # point=circle text={Circle Point} +# tile 1 +point(148,1756) # point=box color=red width=3 text={Box Point} +# tile 1 +point(229,1758) # point=diamond text={Diamond Point} +# tile 1 +point(74,1709) # point=cross color=blue text={Cross Point} +# tile 1 +point(150,1710) # point=x text={X Point} +# tile 1 +point(227,1707) # point=arrow color=magenta text={Arrow Point} +# tile 1 +point(152,1658) # point=boxcircle text={BoxCircle Point} +# tile 1 +# projection(391,1809,484,1875,20) text={Projection} +# tile 1 +panda(328,1758,0,270,3,0,30,2) # text={Panda} +# tile 1 +panda(330,1667,51.5819,90,1,0,15,1) # panda=(51.5819 90 180 270)(0 15 30) text={Panda 2} +# tile 1 +panda(330,1667,51.5819,90,1,15,30,1) # panda=ignore +# tile 1 +panda(330,1667,90,180,1,0,15,1) # panda=ignore +# tile 1 +panda(330,1667,90,180,1,15,30,1) # panda=ignore +# tile 1 +panda(330,1667,180,270,1,0,15,1) # panda=ignore +# tile 1 +panda(330,1667,180,270,1,15,30,1) # panda=ignore +# tile 1 +# compass(513,1830,40) compass=physical {N} {E} 1 1 text={Compass} +# tile 1 +epanda(410,1750,0,270,3,15,7.5,30,15,1,45) # text={Epanda} +# tile 1 +epanda(413,1661,45,90,1,15,7.5,30,15,1,45) # epanda=(45 90 180 270)(15 7.5 30 15)(45) text={Epanda 2} +# tile 1 +epanda(413,1661,90,180,1,15,7.5,30,15,1,45) # epanda=ignore +# tile 1 +epanda(413,1661,180,270,1,15,7.5,30,15,1,45) # epanda=ignore +# tile 1 +bpanda(497,1750,0,270,3,40,20,60,30,1,45) # text={Bpanda} +# tile 1 +bpanda(493,1662,45,90,1,40,20,60,30,1,45) # bpanda=(45 90 180 270)(40 20 60 30)(45) text={Bpanda 2} +# tile 1 +bpanda(493,1662,90,180,1,40,20,60,30,1,45) # bpanda=ignore +# tile 1 +bpanda(493,1662,180,270,1,40,20,60,30,1,45) # bpanda=ignore +# tile 3 +circle(1464,347,20) # color=pink width=3 font="times 10 normal roman" text={Circle} tag={foo} tag={foo bar} This is a Comment +# tile 3 +-ellipse(1546,330,40,20,45) # color=#0ff font="helvetica 10 normal italic" text={Ellipse} background +# tile 3 +-box(1636,328,80,40,45) # color=yellow font="helvetica 10 bold roman" text={Box} +# tile 3 +polygon(1705.2472,339,1743,376.75275,1780.7528,339,1743,301.24723) # font="courier 10 normal roman" text={Polygon} edit=0 rotate=0 +# tile 3 +-line(1807,314,1867,365) # line=1 1 color=cyan text={Line} +# tile 3 +# vector(1901,336,40,45) vector=1 color=red text={Vector} +# tile 3 +# text(1956,322) color=magenta font="helvetica 14 bold roman" text={Region} +# tile 3 +# ruler(1685,203,1749,262) ruler=physical physical color=white font="helvetica 12 normal roman" text={Ruler} +# tile 3 +annulus(1464,235,10,20,30) # color=magenta font="helvetica 10 bold roman" text={Annulus} +# tile 3 +ellipse(1549,231,15,7.5,30,15,45) # color=red width=3 font="helvetica 10 bold roman" text={Ellipse Annulus} +# tile 3 +box(1636,230,40,20,60,30,45) # font="helvetica 10 bold roman" text={Box Annulus} +# tile 3 +point(1457,142) # point=circle text={Circle Point} +# tile 3 +point(1546,140) # point=box color=red width=3 text={Box Point} +# tile 3 +point(1627,142) # point=diamond text={Diamond Point} +# tile 3 +point(1472,93) # point=cross color=blue text={Cross Point} +# tile 3 +point(1548,94) # point=x text={X Point} +# tile 3 +point(1625,91) # point=arrow color=magenta text={Arrow Point} +# tile 3 +point(1550,42) # point=boxcircle text={BoxCircle Point} +# tile 3 +# projection(1789,193,1882,259,20) text={Projection} +# tile 3 +panda(1726,142,0,270,3,0,30,2) # text={Panda} +# tile 3 +panda(1728,51,51.5819,90,1,0,15,1) # panda=(51.5819 90 180 270)(0 15 30) text={Panda 2} +# tile 3 +panda(1728,51,51.5819,90,1,15,30,1) # panda=ignore +# tile 3 +panda(1728,51,90,180,1,0,15,1) # panda=ignore +# tile 3 +panda(1728,51,90,180,1,15,30,1) # panda=ignore +# tile 3 +panda(1728,51,180,270,1,0,15,1) # panda=ignore +# tile 3 +panda(1728,51,180,270,1,15,30,1) # panda=ignore +# tile 3 +# compass(1911,214,40) compass=physical {N} {E} 1 1 text={Compass} +# tile 3 +epanda(1808,134,0,270,3,15,7.5,30,15,1,45) # text={Epanda} +# tile 3 +epanda(1811,45,45,90,1,15,7.5,30,15,1,45) # epanda=(45 90 180 270)(15 7.5 30 15)(45) text={Epanda 2} +# tile 3 +epanda(1811,45,90,180,1,15,7.5,30,15,1,45) # epanda=ignore +# tile 3 +epanda(1811,45,180,270,1,15,7.5,30,15,1,45) # epanda=ignore +# tile 3 +bpanda(1895,134,0,270,3,40,20,60,30,1,45) # text={Bpanda} +# tile 3 +bpanda(1891,46,45,90,1,40,20,60,30,1,45) # bpanda=(45 90 180 270)(40 20 60 30)(45) text={Bpanda 2} +# tile 3 +bpanda(1891,46,90,180,1,40,20,60,30,1,45) # bpanda=ignore +# tile 3 +bpanda(1891,46,180,270,1,40,20,60,30,1,45) # bpanda=ignore diff --git a/regions/io/tests/test_ds9_language.py b/regions/io/tests/test_ds9_language.py index 7c9f612d..f8ac2c67 100644 --- a/regions/io/tests/test_ds9_language.py +++ b/regions/io/tests/test_ds9_language.py @@ -2,9 +2,15 @@ unicode_literals from ..read_ds9 import read_ds9 from ..write_ds9 import objects_to_ds9_string -from astropy.utils.data import get_pkg_data_filename +from astropy.utils.data import get_pkg_data_filename, get_pkg_data_filenames from astropy.tests.helper import pytest +def test_read(): + #Check that all test files including reference files are readable + files = get_pkg_data_filenames('data') + for f in files: + read_ds9(f) + @pytest.mark.parametrize('filename', ['data/ds9.fk5.reg', From 4a89ad36e52ca95113d167cce1fc44e41b45deed Mon Sep 17 00:00:00 2001 From: Johannes King Date: Fri, 25 Mar 2016 04:10:30 +0100 Subject: [PATCH 26/30] add meta data to objects --- regions/io/read_ds9.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/regions/io/read_ds9.py b/regions/io/read_ds9.py index 83efa966..80fe8326 100644 --- a/regions/io/read_ds9.py +++ b/regions/io/read_ds9.py @@ -85,17 +85,18 @@ def strip_paren(string_rep): return paren.sub("", string_rep) -viz_keywords = ['color', 'dashed', 'width', 'point', 'font'] def region_list_to_objects(region_list): + viz_keywords = ['color', 'dashed', 'width', 'point', 'font', 'text'] + output_list = [] for region_type, coord_list, meta in region_list: #print("region_type, region_type is 'circle', type(region_type), type('circle'), id(region_type), id('circle'), id(str(region_type))") #print(region_type, region_type is 'circle', type(region_type), type('circle'), id(region_type), id('circle'), id(str(region_type))) if region_type == 'circle': if isinstance(coord_list[0], coordinates.SkyCoord): - output_list.append(circle.CircleSkyRegion(coord_list[0], coord_list[1])) + reg = circle.CircleSkyRegion(coord_list[0], coord_list[1]) elif isinstance(coord_list[0], PixCoord): - output_list.append(circle.CirclePixelRegion(coord_list[0], coord_list[1])) + reg = circle.CirclePixelRegion(coord_list[0], coord_list[1]) else: raise ValueError("No central coordinate") elif region_type == 'ellipse': @@ -103,25 +104,29 @@ def region_list_to_objects(region_list): if len(coord_list) > 4: continue if isinstance(coord_list[0], coordinates.SkyCoord): - output_list.append(ellipse.EllipseSkyRegion(coord_list[0], coord_list[1], coord_list[2], coord_list[3])) + reg = ellipse.EllipseSkyRegion(coord_list[0], coord_list[1], coord_list[2], coord_list[3]) elif isinstance(coord_list[0], PixCoord): - output_list.append(ellipse.EllipsePixelRegion(coord_list[0], coord_list[1], coord_list[2], coord_list[3])) + reg = ellipse.EllipsePixelRegion(coord_list[0], coord_list[1], coord_list[2], coord_list[3]) else: raise ValueError("No central coordinate") elif region_type == 'polygon': if isinstance(coord_list[0], coordinates.SkyCoord): - output_list.append(polygon.PolygonSkyRegion(coord_list[0])) + reg = polygon.PolygonSkyRegion(coord_list[0]) elif isinstance(coord_list[0], PixCoord): - output_list.append(polygon.PolygonPixelRegion(coord_list[0])) + reg = polygon.PolygonPixelRegion(coord_list[0]) else: raise ValueError("No central coordinate") elif region_type == 'rectangle': if isinstance(coord_list[0], coordinates.SkyCoord): - output_list.append(rectangle.RectangleSkyRegion(coord_list[0], coord_list[1], coord_list[2], coord_list[3])) + reg = rectangle.RectangleSkyRegion(coord_list[0], coord_list[1], coord_list[2], coord_list[3]) elif isinstance(coord_list[0], PixCoord): - output_list.append(rectangle.RectanglePixelRegion(coord_list[0], coord_list[1], coord_list[2], coord_list[3])) + reg = rectangle.RectanglePixelRegion(coord_list[0], coord_list[1], coord_list[2], coord_list[3]) else: raise ValueError("No central coordinate") + + reg.vizmeta = {key: meta[key] for key in meta.keys() if key in viz_keywords} + reg.meta = {key: meta[key] for key in meta.keys() if key not in viz_keywords} + output_list.append(reg) return output_list From 2a68201671a0e8a7bea2c2532cbb7fc19911ea7b Mon Sep 17 00:00:00 2001 From: Johannes King Date: Fri, 25 Mar 2016 04:27:43 +0100 Subject: [PATCH 27/30] add profiling scripts --- regions/io/tests/profile_ds9_parser.py | 15 +++++++++++++++ regions/io/tests/profile_pyregion.py | 26 ++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 regions/io/tests/profile_ds9_parser.py create mode 100644 regions/io/tests/profile_pyregion.py diff --git a/regions/io/tests/profile_ds9_parser.py b/regions/io/tests/profile_ds9_parser.py new file mode 100644 index 00000000..7678252b --- /dev/null +++ b/regions/io/tests/profile_ds9_parser.py @@ -0,0 +1,15 @@ +from regions.io import read_ds9 +import glob + +l = glob.glob('data/*.reg') + +for f in l: + print(f) + if 'strip' in f or 'comment' in f: + continue + + read_ds9(str(f)) + + + + diff --git a/regions/io/tests/profile_pyregion.py b/regions/io/tests/profile_pyregion.py new file mode 100644 index 00000000..21dbf603 --- /dev/null +++ b/regions/io/tests/profile_pyregion.py @@ -0,0 +1,26 @@ +import pyregion +import glob + +l = glob.glob('data/*.reg') + +for f in l: +# print(f) + if 'strip' in f or 'comment' in f: + continue + s = pyregion.open(str(f)) + + + + + + + + + + + + + + + + From ae9e62422ca6bf01a9e428deb9fe363ee44bb18f Mon Sep 17 00:00:00 2001 From: Johannes King Date: Fri, 25 Mar 2016 04:50:12 +0100 Subject: [PATCH 28/30] fix build error --- regions/io/read_ds9.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/regions/io/read_ds9.py b/regions/io/read_ds9.py index 80fe8326..87d07a88 100644 --- a/regions/io/read_ds9.py +++ b/regions/io/read_ds9.py @@ -123,7 +123,8 @@ def region_list_to_objects(region_list): reg = rectangle.RectanglePixelRegion(coord_list[0], coord_list[1], coord_list[2], coord_list[3]) else: raise ValueError("No central coordinate") - + else: + continue reg.vizmeta = {key: meta[key] for key in meta.keys() if key in viz_keywords} reg.meta = {key: meta[key] for key in meta.keys() if key not in viz_keywords} output_list.append(reg) From f9883a35ae37826cc3311851af6456ab65258c23 Mon Sep 17 00:00:00 2001 From: Johannes King Date: Fri, 25 Mar 2016 19:14:39 +0100 Subject: [PATCH 29/30] add xfail to tests --- regions/io/tests/test_ds9_language.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/regions/io/tests/test_ds9_language.py b/regions/io/tests/test_ds9_language.py index f8ac2c67..587b2e16 100644 --- a/regions/io/tests/test_ds9_language.py +++ b/regions/io/tests/test_ds9_language.py @@ -4,7 +4,14 @@ from ..write_ds9 import objects_to_ds9_string from astropy.utils.data import get_pkg_data_filename, get_pkg_data_filenames from astropy.tests.helper import pytest +import distutils.version as v +import astropy.version as astrov +_ASTROPY_MINVERSION = v.StrictVersion('1.1') +_ASTROPY_VERSION = v.StrictVersion(astrov.version) + +@pytest.mark.xfail(_ASTROPY_VERSION < _ASTROPY_MINVERSION, + reason='Some coordinates systems not available in older version of astropy') def test_read(): #Check that all test files including reference files are readable files = get_pkg_data_filenames('data') From ab7a4c4fa7a8ced3fe520e84f238c7f49017c6e3 Mon Sep 17 00:00:00 2001 From: Johannes King Date: Fri, 25 Mar 2016 20:02:05 +0100 Subject: [PATCH 30/30] change to looseversion --- regions/io/tests/test_ds9_language.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/regions/io/tests/test_ds9_language.py b/regions/io/tests/test_ds9_language.py index 587b2e16..a94da480 100644 --- a/regions/io/tests/test_ds9_language.py +++ b/regions/io/tests/test_ds9_language.py @@ -7,8 +7,8 @@ import distutils.version as v import astropy.version as astrov -_ASTROPY_MINVERSION = v.StrictVersion('1.1') -_ASTROPY_VERSION = v.StrictVersion(astrov.version) +_ASTROPY_MINVERSION = v.LooseVersion('1.1') +_ASTROPY_VERSION = v.LooseVersion(astrov.version) @pytest.mark.xfail(_ASTROPY_VERSION < _ASTROPY_MINVERSION, reason='Some coordinates systems not available in older version of astropy')