def from_name(cls, camera_id='NectarCam', version=None): """ Construct a CameraGeometry using the name of the camera and array. This expects that there is a resource in the `ctapipe_resources` module called "[array]-[camera].camgeom.fits.gz" or "[array]-[camera]-[ version].camgeom.fits.gz" Parameters ---------- camera_id: str name of camera (e.g. 'NectarCam', 'LSTCam', 'GCT', 'SST-1M') version: camera version id (currently unused) Returns ------- new CameraGeometry """ if version is None: verstr = '' else: verstr = "-{:03d}".format(version) tabname = "{camera_id}{verstr}.camgeom".format(camera_id=camera_id, verstr=verstr) table = get_table_dataset(tabname, role='dl0.tel.svc.camera') return CameraGeometry.from_table(table)
def from_name(cls, camera_id='NectarCam', version=None): """ Construct a CameraGeometry using the name of the camera and array. This expects that there is a resource in the `ctapipe_resources` module called "[array]-[camera].camgeom.fits.gz" or "[array]-[camera]-[ version].camgeom.fits.gz" Parameters ---------- camera_id: str name of camera (e.g. 'NectarCam', 'LSTCam', 'GCT', 'SST-1M') version: camera version id (currently unused) Returns ------- new CameraGeometry """ if version is None: verstr = '' else: verstr = f"-{version:03d}" tabname = "{camera_id}{verstr}.camgeom".format(camera_id=camera_id, verstr=verstr) table = get_table_dataset(tabname, role='dl0.tel.svc.camera') return CameraGeometry.from_table(table)
def from_name(cls, camera_name="NectarCam", version=None): """Construct a CameraReadout using the name of the camera and array. This expects that there is a resource accessible ``ctapipe_resources`` via `~ctapipe.utils.get_table_dataset` called ``"[array]-[camera].camreadout.fits.gz"`` or ``"[array]-[camera]-[version].camgeom.fits.gz"``. Parameters ---------- camera_name: str Camera name (e.g. NectarCam, LSTCam, ...) version: camera version id (currently unused) Returns ------- new CameraReadout """ if version is None: verstr = "" else: verstr = f"-{version:03d}" tabname = "{camera_name}{verstr}.camreadout".format( camera_name=camera_name, verstr=verstr) table = get_table_dataset(tabname, role="dl0.tel.svc.camera") return CameraReadout.from_table(table)
def from_name(cls, camera_name="NectarCam", version=None): """ Construct a CameraGeometry using the name of the camera and array. This expects that there is a resource in the `ctapipe_resources` module called "[array]-[camera].camgeom.fits.gz" or "[array]-[camera]-[ version].camgeom.fits.gz" Parameters ---------- camera_name: str Camera name (e.g. NectarCam, LSTCam, ...) version: camera version id (currently unused) Returns ------- new CameraGeometry """ if version is None: verstr = "" else: verstr = f"-{version:03d}" tabname = "{camera_name}{verstr}.camgeom".format( camera_name=camera_name, verstr=verstr) table = get_table_dataset(tabname, role="dl0.tel.svc.camera") return CameraGeometry.from_table(table)
def get_bright_stars(pointing=None, radius=None, magnitude_cut=None): """ Returns an astropy table containing star positions above a given magnitude within a given radius around a position in the sky, using the Yale bright star catalog which needs to be present in the ctapipe-extra package. The included Yale bright star catalog contains all 9096 stars, excluding the Nova objects present in the original catalog from Hoffleit & Jaschek (1991), http://adsabs.harvard.edu/abs/1991bsc..book.....H, and is complete down to magnitude ~6.5, while the faintest included star has mag=7.96. Parameters ---------- pointing: astropy Skycoord pointing direction in the sky (if none is given, full sky is returned) radius: astropy angular units Radius of the sky region around pointing position. Default: full sky magnitude_cut: float Return only stars above a given magnitude. Default: None (all entries) Returns ------- Astropy table: List of all stars after cuts with names, catalog numbers, magnitudes, and coordinates """ from ctapipe.utils import get_table_dataset catalog = get_table_dataset("yale_bright_star_catalog5", role="bright star catalog") starpositions = SkyCoord( ra=Angle(catalog["RAJ2000"], unit=u.deg), dec=Angle(catalog["DEJ2000"], unit=u.deg), frame="icrs", copy=False, ) catalog["ra_dec"] = starpositions if magnitude_cut is not None: catalog = catalog[catalog["Vmag"] < magnitude_cut] if radius is not None: if pointing is None: raise ValueError("Sky pointing, pointing=SkyCoord(), must be " "provided if radius is given.") separations = catalog["ra_dec"].separation(pointing) catalog["separation"] = separations catalog = catalog[separations < radius] catalog.remove_columns(["RAJ2000", "DEJ2000"]) return catalog
def get_atmosphere_profile_table(atmosphere_name="paranal"): """ Get an atmosphere profile table Parameters ---------- atmosphere_name: str identifier of atmosphere profile Returns ------- astropy.table.Table containing atmosphere profile with at least columns 'altitude' (m), and 'thickness' (g cm-2) as well as others. """ table_name = f"{atmosphere_name}.atmprof" table = get_table_dataset(table_name=table_name, role="dl0.arr.svc.atmosphere") return table
def get_atmosphere_profile_table(atmosphere_name='paranal'): """ Get an atmosphere profile table Parameters ---------- atmosphere_name: str identifier of atmosphere profile Returns ------- astropy.table.Table containing atmosphere profile with at least columns 'altitude' (m), and 'thickness' (g cm-2) as well as others. """ table_name = '{}.atmprof'.format(atmosphere_name) table = get_table_dataset(table_name=table_name, role='dl0.arr.svc.atmosphere') return table
def from_name(cls, camera_name='NectarCam', version=None): """Construct a CameraReadout using the name of the camera and array. This expects that there is a resource in the `ctapipe_resources` module called "[array]-[camera].camreadout.fits.gz" or "[array]-[camera]-[ version].camgeom.fits.gz". Parameters ---------- camera_name: str Camera name (e.g. NectarCam, LSTCam, ...) version: camera version id (currently unused) Returns ------- new CameraReadout """ if version is None: verstr = '' else: verstr = f"-{version:03d}" try: tabname = "{camera_name}{verstr}.camreadout".format( camera_name=camera_name, verstr=verstr ) table = get_table_dataset(tabname, role='dl0.tel.svc.camera') return CameraReadout.from_table(table) except FileNotFoundError: # TODO: remove case when files have been generated logger.warning(f"Resorting to default CameraReadout," f" File does not exist: ({tabname})") reference_pulse_shape = np.array([norm.pdf(np.arange(96), 48, 6)]) return cls( camera_name=camera_name, sampling_rate=u.Quantity(1, u.GHz), reference_pulse_shape=reference_pulse_shape, reference_pulse_sample_width=u.Quantity(1, u.ns), )
def test_optics_from_name_user_supplied_table(): table = get_table_dataset("optics", role="") optics = OpticsDescription.from_name("SST-GCT", optics_table=table) assert optics.name == "SST-GCT" assert optics.mirror_area > 1.0 * u.m**2