def initialize_camera(filename, tel_id, file_closed=True):
    if file_closed:
        ld.clear_lists_camera()
        ld.clear_lists_telescope()
    else:
        pass

    if 'simtel.gz' in filename:
        CD.initialize_hessio(filename, tel_id, file_closed)
    elif 'fits' in filename:
        CD.initialize_fits(filename, tel_id, 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)
 def initialize(cls,filename,tel_id,item):
     """
     Load all the information about the camera of a given telescope with
     ID `tel_id` from an open file with name `filename`.
     
     Parameters
     ----------
     filename: string
         name of the file
     tel_id: int
         ID of the telescope whose optics information should be loaded
     item: of various type depending on the file extension
         return value of the opening/loading process of the file
     """
     (cam_class,cam_fov,pix_id,pix_posX,pix_posY,pix_posZ,pix_area,pix_type,
      pix_neighbors,fadc_pulsshape) = CD.initialize(filename,tel_id,item)
     cam = cls(cam_class,cam_fov,pix_id,pix_posX,pix_posY,pix_posZ,pix_area,
             pix_type,pix_neighbors,fadc_pulsshape)
     return cam
 def rotate(cls,angle):
     """
     rotates the camera coordinates about the center of the camera by
     specified angle. Modifies the CameraGeometry in-place (so
     after this is called, the pix_x and pix_y arrays are
     rotated).
     
     Note:
     -----
     This is intended only to correct simulated data that are
     rotated by a fixed angle.  For the more general case of
     correction for camera pointing errors (rotations,
     translations, skews, etc), you should use a true coordinate
     transformation defined in `ctapipe.coordinates`.      
     
     Parameters
     ----------
     cls: give the name of the class whose pixel positions should be rotated
     angle: value convertable to an `astropy.coordinates.Angle`
         rotation angle with unit (e.g. 12 * u.deg), or "12d" 
     """
     cls.pix_posX, cls.pix_posY = CD.rotate(cls.pix_posX,cls.pix_posY,angle)
    print('{0:.2f}'.format(cam1.cam_fov))
    print('{0:.2f}'.format(cam2.cam_fov))
    print('Rotate the Camera by 180 degree, i.e. the x- & y-positions will be',
          'rotated by 190 degree:')
    print('x-position of the camera before using the rotate method:')
    print(cam1.pix_posX)
    print('x-position of the camera after using the rotate method:')
    cam1.rotate(cam1, 180 * u.degree)
    print(cam1.pix_posX)
    print('FADC pulse shape over time of ASCII file')
    plt.plot(cam3.fadc_pulsshape[0], cam3.fadc_pulsshape[1], '+')
    plt.show()
    print('----------------------------')

    print('Print imported camera data as a table:')
    table = CD.write_table(1, cam1.cam_class, cam1.pix_id[:1], cam1.pix_posX,
                           cam1.pix_posY, cam1.pix_area, cam1.pix_type)
    print(table)
    print('---------------------------')

    opt1 = ID.Optics.initialize(filename1, 1, item1)
    opt2 = ID.Optics.initialize(filename2, 18, item2)
    opt3 = ID.Optics.initialize(filename3, 1, item3)
    print('Mirror Area of the first (18th) telescope of fits (hessio) file.',
          'Returned, when only the optics data is read from the file:')
    print('{0:.2f}'.format(opt1.mir_area))
    print('{0:.2f}'.format(opt2.mir_area))
    print('Mirror reflection over wavelength [nm]')
    plt.plot(opt3.mir_reflection[0], opt3.mir_reflection[1], '+')
    plt.show()
    print('----------------------------')