Skip to main content

A Python package for the fetching (and some processing) of eCallisto data based on request and pandas.

Project description

Ecallisto NG

Ecallisto NG is a comprehensive Python package tailored for interacting with Ecallisto data. It focuses on facilitating efficient data manipulation, processing, and visualization, leveraging the power of Pandas for data handling and PyTorch for advanced computations. The package is particularly optimized for dealing with large datasets, providing tools for slicing, filtering, and resampling data to make spectogram plotting more manageable.

Table of Contents

Background

he package is built with Python 3.9 and primarily uses the Pandas library for data manipulation. While it initially offered a direct interaction with the Ecallisto Rest API (now deprecated), its current functionality is centered around efficient data processing and visualization.

Note: The REST API is now deprecated. However, you can still access it via https://v000792.fhnw.ch/api/redoc for a while. This was done because with help of pandas and multiprocessing, the download of the data is much faster and more efficient when directly accessing the files.

PyPI

Available on PyPI: https://pypi.org/project/ecallisto-ng/

Dev Installation

To install this package, clone this repository and use pip for installation. Execute the following command in your terminal: pip install -e .

Creation of the virtual Antenna

Requires PyTorch installation.

Pandas

Pandas is an open-source data analysis and manipulation tool, pivotal to Ecallisto NG. Learning Pandas is essential for effectively using Ecallisto NG, as it allows for sophisticated data slicing, filtering, and aggregation. More on Pandas: https://pandas.pydata.org/docs/

Examples and Usage

Please have a look at the jupyter notebook under example.

Getting data

get_ecallisto_data Function

This function fetches e-Callisto data within a specified date range and optional instrument regex pattern. It's suitable for smaller datasets. For larger datasets, consider using the get_ecallisto_data_generator function.

Parameters

  • start_datetime (datetime-like): The start date for the file search.
  • end_datetime (datetime-like): The end date for the file search.
  • instrument_string (str, List[str] or None): Instrument name(s) for file URL matching. If None, all files are considered.
  • freq_start (float or None): The start frequency for filtering.
  • freq_end (float or None): The end frequency for filtering.
  • base_url (str): Base URL of the remote file directory.

Returns

  • (dict of str: pandas.DataFrame) or pandas.DataFrame: A dictionary of instrument names and their corresponding dataframes. If only one instrument is found, it returns a single dataframe.

Example

from ecallisto_ng.data_fetching import get_ecallisto_data
from datetime import datetime

start = datetime(2021, 3, 1, 6, 30, 0)
end = datetime(2021, 3, 7, 23, 30, 0)
instrument_name = "austria_unigraz_01"

df = get_ecallisto_data(start, end, instrument_name)

Getting data via a generator

get_ecallisto_data_generator Function

A generator function that yields e-Callisto data one file at a time within a date range. It's ideal for handling large datasets or when working with limited memory.

Parameters

  • start_datetime (datetime-like): The start date for the file search.
  • end_datetime (datetime-like): The end date for the file search.
  • instrument_name (List[str], str, or None): Instrument name(s) for file URL matching. If None, all files are considered.
  • freq_start (float or None): The start frequency for filtering.
  • freq_end (float or None): The end frequency for filtering.
  • base_url (str): Base URL of the remote file directory.

Yields

  • (str, pandas.DataFrame): A tuple containing the instrument name and its corresponding DataFrame.

Example

from ecallisto_ng.data_fetching import get_ecallisto_data_generator
from datetime import datetime

start = datetime(2021, 3, 1, 6, 30, 0)
end = datetime(2021, 3, 7, 23, 30, 0)
instrument_name = ["austria_unigraz_01", "another_instrument"]

data_generator = get_ecallisto_data_generator(start, end, instrument_name)
for instrument_name, data_frame in data_generator:
    process_data(instrument_name, data_frame)  # Replace with your processing function

Plotting

Ecallisto NG provides basic plotting capabilities. Here's an example of how to generate a spectogram:

from ecallisto_ng.plotting.utils import plot_spectogram

plot_spectogram(df)

Spectogram editing

We also provide some basic functionalities to edit the spectogram. Here's how you can do it:

from ecallisto_ng.data_processing.utils import elimwrongchannels, subtract_constant_background, subtract_rolling_background

df = elimwrongchannels(df)
df = fill_missing_timesteps_with_nan(df)
df = subtract_constant_background(df)
df = subtract_rolling_background(df)

# Filter keep frequencies only between 40 and 70 MHz
df = df.loc[:, 40:70]

plot_spectogram(df)

Additional Information

Note on .attrs and FITS Header

The function utilizes DataFrames with the .attrs attribute to store FITS header information. This attribute is a dictionary-like object and contains metadata about the FITS file, including header details. Accessing .attrs is essential for understanding the context of the data:

print(df.attrs)

These simple commands allow you to easily manipulate spectogram data, enabling effective use of the Ecallisto API for your needs.

Contributing

Contributions to Ecallisto NG are very welcome! If you have an idea for an improvement or have found a bug, please feel free to contribute. The preferred way to contribute is by submitting a Pull Request (PR) or creating an issue on our GitHub repository. This way, we can discuss potential changes or fixes and maintain the quality of the project.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ecallisto_ng-0.5.0.tar.gz (24.6 kB view details)

Uploaded Source

Built Distribution

ecallisto_ng-0.5.0-py3-none-any.whl (27.0 kB view details)

Uploaded Python 3

File details

Details for the file ecallisto_ng-0.5.0.tar.gz.

File metadata

  • Download URL: ecallisto_ng-0.5.0.tar.gz
  • Upload date:
  • Size: 24.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for ecallisto_ng-0.5.0.tar.gz
Algorithm Hash digest
SHA256 48601874730d32476ebc475352cd867877c858bd4fd3ec14b498f7e6607d57a0
MD5 99fdb0e1dfb94df6e0be853d0fe2818a
BLAKE2b-256 ec11943d870c2e75dd92bd8ce60ca04c2f4ec4b087e1164949dc0c04d42b4d1a

See more details on using hashes here.

File details

Details for the file ecallisto_ng-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: ecallisto_ng-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 27.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for ecallisto_ng-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d83de946a56ada6f6f4dc3170cea73b11813e407027d0be47b869ee5c5c10101
MD5 64d02a420096345b32a3caa26d3557a3
BLAKE2b-256 08c1f68e5ff229b63eff31d8aaf34d05ab8ba31a7ef621557f8e38bfb87a4885

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page