pyfact

A python package with utils to work with the FACT Imaging Cerenkov Telescope
install with
$ pip install pyfact
This takes automatically care of the dependencies which are installable with pip.
However, if you want to use the GUI Event Viewer you will need to install Tk before you install matplotlib as it depends on the tkagg backend.
functions:
fact includes several functions to convert the times used in fact data to more standard formats and vice versa.
e.g. :
from fact import run2dt
# convert fact fNight format to python datetime object:
date = run2dt("20150101")
Submodules
io
To store pandas dataframes in column-oriented storage into hdf5 files, we created some helpfull wrappers around pandas and h5py:
from fact.io import read_h5py, to_h5py
import pandas as pd
df = pd.DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6]})
to_h5py(df, 'test.hdf5', key='events')
print(read_h5py('test.hdf5', key='events'))
plotting
Utils for plotting data into a FACT camera view. Based on matplotlib.
import matplotlib.pyplot as plt
from fact.plotting import camera
from numpy.random import normal
# create some pseudo data with shape (10, 1440):
data = normal(30, 5, (10, 1440))
camera(data[0])
plt.show()
There are also functions to get the camera_geometry from the delivered source file:
from fact.plotting import get_pixel_coords
pixel_x, pixel_y = get_pixel_coords()
factdb
This module contains peewee Models for our factdata MySQL database. These were automatically created by peewee and provide means to query this database in python without writing raw sql queries.
For example, to get the total number of runs take by FACT you can do:
from fact.factdb import connect_database, RunInfo
connect_database() # this uses the credentials module if no config is given
num_runs = RunInfo.select().count()
A few convenience functions are already implemented. To get a pandas.DataFrame containing the observation time per source and runtype, you can do:
from fact.factdb import connect_database, get_ontime_per_source_and_runtype
connect_database()
num_runs = RunInfo.select().count()
print(get_ontime_by_source_and_runtype())
To download the database and read it to Pandas dataframe without using peewee:
from fact import credentials
import pandas as pd
factDB = credentials.create_factdb_engine()
runInfo = pd.read_sql_table(table_name="RunInfo", con=factDB)
auxservices
Utilities to read in our aux fits files into pandas dataframes.
from fact.auxservices import MagicWeather
from datetime import date
weather = MagicWeather(auxdir='/fact/aux/')
df = weather.read_date(date(2016, 1, 1))
Metadata
Release files for pyfact 0.26.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyfact-0.26.2.tar.gz | 88.0 kB | Without provenance | Details for pyfact-0.26.2.tar.gz |
Release files / pyfact-0.26.2.tar.gz
| Download URL | pyfact-0.26.2.tar.gz |
|---|---|
| Size | 88.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c7fa0760281f02d476c69659200ab66f6b4dd00717cb411ad8c4b4389980d60c
|
|
BLAKE2b-256 checksum How to use checksums |
89d0640c963d7bde32d53e0d7848331553aba4b9d65c9f121cfa4f3dc9f87807
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.6.7
|
Security for pyfact 0.26.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.