Exemple #1
0
def test_telescope_from_name(optics_name, camera_name):
    """ Check we can construct all telescopes from their names """
    tel = TelescopeDescription.from_name(optics_name, camera_name)
    assert optics_name in str(tel)
    assert camera_name in str(tel)
    assert tel.camera.geometry.pix_x.shape[0] > 0
    assert tel.optics.equivalent_focal_length.to("m") > 0
    assert tel.type in ["MST", "SST", "LST", "UNKNOWN"]
def initialize_telescope(filename, file_closed = True):
    ld.clear_lists_telescope()
    ld.clear_lists_camera()
    ld.clear_lists_optics()

    if 'simtel.gz' in filename:
        file_closed = TD.initialize_hessio(filename,file_closed)
        for tel in ld.telescope_id:
            CD.initialize_hessio(filename,tel,file_closed)
            OD.initialize_hessio(filename,tel,file_closed)
        util_functions.close_hessio()

    elif 'fits' in filename:
        file_closed = TD.initialize_fits(filename,file_closed)
        for tel in ld.telescope_id:
            CD.initialize_fits(filename,tel,file_closed)
            OD.initialize_fits(filename,tel,file_closed)
        util_functions.close_fits(file_closed)
def initialize_telescope(filename, file_closed=True):
    ld.clear_lists_telescope()
    ld.clear_lists_camera()
    ld.clear_lists_optics()

    if 'simtel.gz' in filename:
        file_closed = TD.initialize_hessio(filename, file_closed)
        for tel in ld.telescope_id:
            CD.initialize_hessio(filename, tel, file_closed)
            OD.initialize_hessio(filename, tel, file_closed)
        util_functions.close_hessio()

    elif 'fits' in filename:
        file_closed = TD.initialize_fits(filename, file_closed)
        for tel in ld.telescope_id:
            CD.initialize_fits(filename, tel, file_closed)
            OD.initialize_fits(filename, tel, file_closed)
        util_functions.close_fits(file_closed)
Exemple #4
0
def test_hash():

    types = ["LST", "MST", "SST"]
    names = ["LST", "MST", "SST-1M"]
    cameras = ["LSTCam", "FlashCam", "DigiCam"]

    telescopes = []
    for name, type, camera in zip(names, types, cameras):
        for i in range(3):

            telescopes.append(
                TelescopeDescription(name=name,
                                     tel_type=type,
                                     optics=OpticsDescription.from_name(name),
                                     camera=CameraGeometry.from_name(camera)))

    assert len(telescopes) == 9
    assert len(set(telescopes)) == 3
Exemple #5
0
def test_hash():
    from ctapipe.instrument.telescope import TelescopeDescription
    from ctapipe.instrument.optics import OpticsDescription
    from ctapipe.instrument.camera import CameraGeometry

    types = ['LST', 'MST', 'SST']
    names = ['LST', 'MST', 'SST-1M']
    cameras = ['LSTCam', 'FlashCam', 'DigiCam']

    telescopes = []
    for name, type, camera in zip(names, types, cameras):
        for i in range(3):

            telescopes.append(
                TelescopeDescription(name=name,
                                     type=type,
                                     optics=OpticsDescription.from_name(name),
                                     camera=CameraGeometry.from_name(camera)))

    assert len(telescopes) == 9
    assert len(set(telescopes)) == 3
    def initialize(cls,filename,item):
        """
        Load all the information about the telescope and its components
        (= parameters of the inherited classes) from an open file with
        name `filename`.

        Parameters
        ----------
        filename: string
            name of the file
        item: of various type depending on the file extension
            return value of the opening/loading process of the file
        """
        tel_id, tel_num,tel_posX,tel_posY,tel_posZ = TD.initialize(filename,
                                                                   item)
        tel = cls(tel_num,tel_id,tel_posX,tel_posY,tel_posZ)

        opt = []
        cam = []
        for i in range(len(tel_id)):
            opt.append(Optics.initialize(filename,tel_id[i],item))
            cam.append(Camera.initialize(filename,tel_id[i],item))
        
        return tel,opt,cam