def read_file(cls,filename='fake_data',tel_id=1,attribute='closed'):
        """
        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, if no file name is given, faked data is produced
        tel_id: int
            ID of the telescope whose optics information should be loaded
        attribute: if file is closed, the attribute 'close' is given, else
            the astropy table with the whole data read from the file is given
        """
        ext = uf.get_file_type(filename)

        if attribute == 'closed':
            load = getattr(uf,"load_%s" % ext)
            instr_table = load(filename)
        else:
            instr_table = attribute
        
        (cam_class,cam_fov,pix_id,pix_posX,pix_posY,pix_area,pix_type,
         pix_neighbors,fadc_pulsshape) = CD.get_data(instr_table,tel_id)
        cam = cls(cam_class,cam_fov,pix_id,pix_posX,pix_posY,pix_area,
                pix_type,pix_neighbors,fadc_pulsshape)
        
        return cam,instr_table
Ejemplo n.º 2
0
    def read_file(cls, filename='fake_data', tel_id=1, attribute='closed'):
        """
        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, if no file name is given, faked data is produced
        tel_id: int
            ID of the telescope whose optics information should be loaded
        attribute: if file is closed, the attribute 'close' is given, else
            the astropy table with the whole data read from the file is given
        """
        ext = uf.get_file_type(filename)

        if attribute == 'closed':
            load = getattr(uf, "load_%s" % ext)
            instr_table = load(filename)
        else:
            instr_table = attribute

        (cam_class, cam_fov, pix_id, pix_posX, pix_posY, pix_area, pix_type,
         pix_neighbors, fadc_pulsshape) = CD.get_data(instr_table, tel_id)
        cam = cls(cam_class, cam_fov, pix_id, pix_posX, pix_posY, pix_area,
                  pix_type, pix_neighbors, fadc_pulsshape)

        return cam, instr_table