# Path: PySpectrograph/Spectrograph/CCD.py
# class CCD:
# 
#     """Defines a CCD by x and y position, size, and pixel size.  The x and y position are
#        set such that they are zero relative to the detector position.  This assumes that
#        the x and y positions are in the center of the pixels and that the ccd is symmetric.
# 
#        pix_size is in mm
#     """
# 
#     def __init__(self, name='', height=0, width=0, xpos=0, ypos=0,
#                  pix_size=0.015, xpix=2048, ypix=2048):
#         # set the variables
#         self.xpos = xpos
#         self.ypos = ypos
#         self.pix_size = pix_size
#         self.xpix = xpix
#         self.ypix = ypix
#         self.height = self.set_height(height)
#         self.width = self.set_width(width)
# 
#     def set_width(self, w):
#         """If the width  is less than the number of pixels, then the width is
#            given by the number of pixels
#         """
#         min = self.xpix * self.pix_size
#         return max(w, min)
# 
#     def set_height(self, h):
#         """If the height is less than the number of pixels, then the height is
#            given by the number of pixels
#         """
#         min = self.ypix * self.pix_size
#         return max(h, min)
# 
#     def find_corners(self):
#         """Return the corners of the ccd"""
#         x1 = self.xpos - 0.5 * self.width
#         x2 = self.xpos + 0.5 * self.width
#         y1 = self.ypos - 0.5 * self.height
#         y2 = self.ypos + 0.5 * self.height
#         return x1, x2, y1, y2


import numpy as np
from .CCD import CCD


class Detector(CCD):

    """A class that describing the Detector.  It inherets from the CCD class as there could be
       multiple ccds at each position.

       name--Name of the detector
       ccd--a CCD class or list describing the CCDs in the detecfor
       xpos--Offset of the x center of the ccd from the central ray in mm
       ypos--Offset of the y center of the ccd from the central ray in mm
       zpos--Offset of the z center of the ccd from the central ray in mm
       xbin--ccd binning in x-direction
       ybin--ccd binning in y-direction
       plate_scale--plate scale in mm/"
    """


# Path: PySpectrograph/Spectrograph/CCD.py
# class CCD:
# 
#     """Defines a CCD by x and y position, size, and pixel size.  The x and y position are
#        set such that they are zero relative to the detector position.  This assumes that
#        the x and y positions are in the center of the pixels and that the ccd is symmetric.
# 
#        pix_size is in mm
#     """
# 
#     def __init__(self, name='', height=0, width=0, xpos=0, ypos=0,
#                  pix_size=0.015, xpix=2048, ypix=2048):
#         # set the variables
#         self.xpos = xpos
#         self.ypos = ypos
#         self.pix_size = pix_size
#         self.xpix = xpix
#         self.ypix = ypix
#         self.height = self.set_height(height)
#         self.width = self.set_width(width)
# 
#     def set_width(self, w):
#         """If the width  is less than the number of pixels, then the width is
#            given by the number of pixels
#         """
#         min = self.xpix * self.pix_size
#         return max(w, min)
# 
#     def set_height(self, h):
#         """If the height is less than the number of pixels, then the height is
#            given by the number of pixels
#         """
#         min = self.ypix * self.pix_size
#         return max(h, min)
# 
#     def find_corners(self):
#         """Return the corners of the ccd"""
#         x1 = self.xpos - 0.5 * self.width
#         x2 = self.xpos + 0.5 * self.width
#         y1 = self.ypos - 0.5 * self.height
#         y2 = self.ypos + 0.5 * self.height
#         return x1, x2, y1, y2


# Path: PySpectrograph/Spectrograph/Detector.py
import numpy as np
from .CCD import CCD



class Detector(CCD):

    """A class that describing the Detector.  It inherets from the CCD class as there could be
       multiple ccds at each position.

       name--Name of the detector
       ccd--a CCD class or list describing the CCDs in the detecfor
       xpos--Offset of the x center of the ccd from the central ray in mm
       ypos--Offset of the y center of the ccd from the central ray in mm
       zpos--Offset of the z center of the ccd from the central ray in mm
       xbin--ccd binning in x-direction
       ybin--ccd binning in y-direction
       plate_scale--plate scale in mm/"
    """


    def __init__(self, name='', ccd=CCD(), zpos=0, xpos=0, ypos=0, xbin=2, ybin=2, plate_scale=0.224):