From ea44b248faa78f3186b77a2655271987490fca0f Mon Sep 17 00:00:00 2001 From: "Adam Ginsburg (keflavich)" Date: Thu, 23 Oct 2014 12:40:54 +0200 Subject: [PATCH 1/4] fix bug introduced in 4c5a6432be45b9878b1df84ba38aa4186ca6712b: 'structures' can be an int (since plot_tree accepts singular 'structure' which intuitively should be an int) --- astrodendro/plot.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/astrodendro/plot.py b/astrodendro/plot.py index 83de7dd..7298d46 100644 --- a/astrodendro/plot.py +++ b/astrodendro/plot.py @@ -190,7 +190,9 @@ def get_lines(self, structures=None, subtree=True, **kwargs): # Case 2: one structure is selected, and subtree is True else: if subtree: - if type(structures[0]) is int: + if type(structures) is int: + structure = self.dendrogram[structures] + elif type(structures[0]) is int: structure = self.dendrogram[structures[0]] else: structure = structures[0] From a747cbf7abc291b8e8118aa2fe97232ea65fa851 Mon Sep 17 00:00:00 2001 From: "Adam Ginsburg (keflavich)" Date: Wed, 27 May 2015 10:01:41 +0200 Subject: [PATCH 2/4] import Structure so that it can be isinstance'd --- astrodendro/plot.py | 1 + 1 file changed, 1 insertion(+) diff --git a/astrodendro/plot.py b/astrodendro/plot.py index 7298d46..a05aa5c 100644 --- a/astrodendro/plot.py +++ b/astrodendro/plot.py @@ -1,6 +1,7 @@ # Licensed under an MIT open source license - see LICENSE import numpy as np +from .structure import Structure class DendrogramPlotter(object): From 641c1657cf05cb9d148fbf5f4eec1143717926ce Mon Sep 17 00:00:00 2001 From: "Adam Ginsburg (keflavich)" Date: Wed, 27 May 2015 10:06:25 +0200 Subject: [PATCH 3/4] issubclass should be isinstance and typechecking should be done with isinstance rather than type(x) is... Conflicts: astrodendro/plot.py --- astrodendro/plot.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/astrodendro/plot.py b/astrodendro/plot.py index a05aa5c..4b7a1f0 100644 --- a/astrodendro/plot.py +++ b/astrodendro/plot.py @@ -191,9 +191,11 @@ def get_lines(self, structures=None, subtree=True, **kwargs): # Case 2: one structure is selected, and subtree is True else: if subtree: - if type(structures) is int: + if isinstance(strucutres, int): structure = self.dendrogram[structures] - elif type(structures[0]) is int: + elif isinstance(structures, Structure): + structure = structures + elif isinstance(structures[0], int): structure = self.dendrogram[structures[0]] else: structure = structures[0] From eda7eace0ddc2af1b53afb824019c843477ef8d2 Mon Sep 17 00:00:00 2001 From: "Adam Ginsburg (keflavich)" Date: Wed, 27 May 2015 10:13:57 +0200 Subject: [PATCH 4/4] typo --- astrodendro/plot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/astrodendro/plot.py b/astrodendro/plot.py index 4b7a1f0..77bdd10 100644 --- a/astrodendro/plot.py +++ b/astrodendro/plot.py @@ -191,7 +191,7 @@ def get_lines(self, structures=None, subtree=True, **kwargs): # Case 2: one structure is selected, and subtree is True else: if subtree: - if isinstance(strucutres, int): + if isinstance(structures, int): structure = self.dendrogram[structures] elif isinstance(structures, Structure): structure = structures