Skip to content

Commit

Permalink
Merge pull request #407 from kosack/rename_reco
Browse files Browse the repository at this point in the history
normalized the names of reconstruction classes
  • Loading branch information
kosack authored May 9, 2017
2 parents 50c7785 + fae936d commit e2c4d8b
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 20 deletions.
2 changes: 1 addition & 1 deletion ctapipe/plotting/tests/test_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import numpy as np
from ctapipe.utils import get_dataset

from ctapipe.reco.FitGammaHillas import FitGammaHillas, GreatCircle
from ctapipe.reco.HillasReconstructor import HillasReconstructor, GreatCircle
from ctapipe.image.hillas import hillas_parameters, HillasParameterizationError
from ctapipe.image.cleaning import tailcuts_clean, dilate

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""

from ctapipe.utils import linalg
from ctapipe.reco.reco_algorithms import RecoShowerGeomAlgorithm
from ctapipe.reco.reco_algorithms import Reconstructor
from ctapipe.io.containers import ReconstructedShowerContainer

from astropy.utils.decorators import deprecated
Expand All @@ -20,7 +20,7 @@
u.dimless = u.dimensionless_unscaled


__all__ = ['FitGammaHillas',
__all__ = ['HillasReconstructor',
'TooFewTelescopesException',
'dist_to_traces', 'MEst', 'GreatCircle']

Expand Down Expand Up @@ -180,7 +180,7 @@ def neg_angle_sum(origin, circles, weights):
return -np.sum(weights * sin_ang)


class FitGammaHillas(RecoShowerGeomAlgorithm):
class HillasReconstructor(Reconstructor):
'''
class that reconstructs the direction of an atmospheric shower
using a simple hillas parametrisation of the camera images it
Expand Down
7 changes: 3 additions & 4 deletions ctapipe/reco/ImPACT.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@
from ctapipe.image import poisson_likelihood_gaussian
from ctapipe.io.containers import (ReconstructedShowerContainer,
ReconstructedEnergyContainer)
from ctapipe.reco.reco_algorithms import RecoShowerGeomAlgorithm
from ctapipe.reco.reco_algorithms import Reconstructor
from ctapipe.reco.shower_max import ShowerMaxEstimator
from ctapipe.utils import TableInterpolator
from ctapipe import instrument

__all__ = ['ImPACTReconstructor']

__all__ = ['ImPACTFitter']

class ImPACTFitter(RecoShowerGeomAlgorithm):
class ImPACTReconstructor(Reconstructor):
"""This class is an implementation if the impact_reco Monte Carlo
Template based image fitting method from [parsons14]_. This method uses a
comparision of the predicted image from a library of image
Expand Down
2 changes: 1 addition & 1 deletion ctapipe/reco/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from .FitGammaHillas import *
from .HillasReconstructor import *
from .reco_algorithms import *
from .ImPACT import *
4 changes: 2 additions & 2 deletions ctapipe/reco/reco_algorithms.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from ctapipe.core import Component
from ctapipe.io.containers import ReconstructedShowerContainer

__all__ = ['RecoShowerGeomAlgorithm']
__all__ = ['Reconstructor']


class RecoShowerGeomAlgorithm(Component):
class Reconstructor(Component):
"""This is the base class from which all direction reconstruction
algorithms should inherit from"""

Expand Down
8 changes: 4 additions & 4 deletions ctapipe/reco/tests/test_FitGammaHillas.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from ctapipe.utils import get_dataset

from ctapipe.reco.FitGammaHillas import FitGammaHillas, GreatCircle
from ctapipe.reco.HillasReconstructor import HillasReconstructor, GreatCircle
from ctapipe.image.hillas import hillas_parameters, HillasParameterizationError
from ctapipe.image.cleaning import tailcuts_clean, dilate

Expand Down Expand Up @@ -36,7 +36,7 @@ def test_fit_core():
circle4.trace = [0, 1, 0]

# creating the fit class and setting the the great circle member
fit = FitGammaHillas()
fit = HillasReconstructor()
fit.circles = {1: circle1, 2: circle2, 3: circle3, 4: circle4}

# performing the position fit with the minimisation algorithm
Expand Down Expand Up @@ -79,7 +79,7 @@ def test_fit_origin():
circle4.trace = [0, 1, 0]

# creating the fit class and setting the the great circle member
fit = FitGammaHillas()
fit = HillasReconstructor()
fit.circles = {1: circle1, 2: circle2, 3: circle3, 4: circle4}

# performing the direction fit with the minimisation algorithm
Expand Down Expand Up @@ -111,7 +111,7 @@ def test_FitGammaHillas():

filename = get_dataset("gamma_test.simtel.gz")

fit = FitGammaHillas()
fit = HillasReconstructor()

cam_geom = {}
tel_phi = {}
Expand Down
10 changes: 5 additions & 5 deletions ctapipe/reco/tests/test_ImPACT.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import numpy as np
from ctapipe.reco.ImPACT import ImPACTFitter
from ctapipe.reco.ImPACT import ImPACTReconstructor
from ctapipe.utils import get_dataset
import astropy.units as u
from numpy.testing import assert_allclose
Expand All @@ -10,7 +10,7 @@ class TestImPACT():

@classmethod
def setup_class(self):
self.impact_reco = ImPACTFitter(root_dir=".", fit_xmax=True)
self.impact_reco = ImPACTReconstructor(root_dir=".", fit_xmax=True)

@pytest.mark.skip('need a dataset for this to work')
def test_brightest_mean_average(self):
Expand Down Expand Up @@ -54,11 +54,11 @@ def test_rotation(self):
x = np.array([1])
y = np.array([0])

xt, yt = ImPACTFitter.rotate_translate(x,y,0,0,np.deg2rad(90))
xt, yt = ImPACTReconstructor.rotate_translate(x, y, 0, 0, np.deg2rad(90))
assert_allclose(xt, 0, rtol=0, atol=0.001)
assert_allclose(yt, 1, rtol=0, atol=0.001)

xt, yt = ImPACTFitter.rotate_translate(x,y,0,0,np.deg2rad(180))
xt, yt = ImPACTReconstructor.rotate_translate(x, y, 0, 0, np.deg2rad(180))
assert_allclose(xt, -1, rtol=0, atol=0.001)
assert_allclose(yt, 0, rtol=0, atol=0.001)

Expand All @@ -67,7 +67,7 @@ def test_translation(self):
x = np.array([0])
y = np.array([0])

xt, yt = ImPACTFitter.rotate_translate(x, y, 1, 1, 0)
xt, yt = ImPACTReconstructor.rotate_translate(x, y, 1, 1, 0)
assert_allclose(xt, -1, rtol=0, atol=0.001)
assert_allclose(yt, -1, rtol=0, atol=0.001)

Expand Down

0 comments on commit e2c4d8b

Please sign in to comment.