gcr

A common reader interface for accessing generic catalogs

https://github.com/yymao/generic-catalog-reader

Science Score: 10.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    2 of 4 committers (50.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.5%) to scientific vocabulary

Keywords

abstract-class catalog-api data-access python reader
Last synced: 6 months ago · JSON representation

Repository

A common reader interface for accessing generic catalogs

Basic Info
Statistics
  • Stars: 7
  • Watchers: 2
  • Forks: 8
  • Open Issues: 1
  • Releases: 27
Topics
abstract-class catalog-api data-access python reader
Created over 8 years ago · Last pushed over 2 years ago
Metadata Files
Readme License

README.md

Generic Catalog Reader (GCR)

Conda Version PyPIVversion

A ready-to-use, abstract base class for creating a common reader interface that accesses generic table-like catalogs.

This project was started in response to the need of the DESCQA framework. It is now used in the LSST DESC GCR Catalogs.

Installation

You can install GCR from conda-forge:

bash conda install gcr --channel conda-forge

Or from PyPI:

bash pip install GCR

Concept

The reader should specify: (1) how to translate (assemble) requested quantities from the native quantities; and (2) how to access native quantities from the underlying data format.

Concept

Usage

You can find API documentation here. However, looking at some real examples is probably more useful.

Basically, you will subclass GCR.BaseGenericCatalog and then set the member dict _quantity_modifiers inside _subclass_init, and implement the member methods _generate_native_quantity_list and _iter_native_dataset. Here's an minimal example.

```python import h5py import GCR

class YourCatalogReader(GCR.BaseGenericCatalog):

def _subclass_init(self, **kwargs):
    self._file = kwargs['filename']

    self._quantity_modifiers = {
        'galaxy_id' :    'galaxyID',
        'ra':            (lambda x: x/3600.0, 'ra'),
        'dec':           (lambda x: x/3600.0, 'dec'),
        'is_central':    (lambda x, y: x == y, 'haloId', 'parentHaloId'),
    }

def _generate_native_quantity_list(self):
    """
    Must return an iterable of all native quantity names.
    """
    with h5py.File(self._file, 'r') as fh:
        return fh.keys()

def _iter_native_dataset(self, native_filters=None):
    """
    Must be a generator.
    Must yield a callable, *native_quantity_getter*.
    This function must iterate over subsets of rows, not columns!
    Below are specifications of *native_quantity_getter*
    ---
    Must take a single argument of a native quantity name.
    Should assume the argument is valid.
    Must return a numpy 1d array.
    """
    assert not native_filters, '*native_filters* is not supported'
    with h5py.File(self._file, 'r') as fh:
        def native_quantity_getter(native_quantity):
            return fh[native_quantity].value
        yield native_quantity_getter

```

Owner

  • Name: Yao-Yuan Mao
  • Login: yymao
  • Kind: user
  • Location: Salt Lake City, UT, USA
  • Company: University of Utah

茅耀元. Astrophysicist at U of Utah studying dark matter & galaxies with astronomical surveys & simulations. Programmer. they/he

GitHub Events

Total
Last Year

Committers

Last synced: about 2 years ago

All Time
  • Total Commits: 128
  • Total Committers: 4
  • Avg Commits per committer: 32.0
  • Development Distribution Score (DDS): 0.063
Past Year
  • Commits: 10
  • Committers: 2
  • Avg Commits per committer: 5.0
  • Development Distribution Score (DDS): 0.4
Top Committers
Name Email Commits
Yao-Yuan Mao y****o@g****m 120
P Larsen p****n@a****v 6
Yao-Yuan Mao y****o 1
Michael Wood-Vasey w****v@p****u 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 6
  • Total pull requests: 34
  • Average time to close issues: 2 days
  • Average time to close pull requests: 11 days
  • Total issue authors: 5
  • Total pull request authors: 4
  • Average comments per issue: 0.83
  • Average comments per pull request: 0.26
  • Merged pull requests: 33
  • Bot issues: 0
  • Bot pull requests: 4
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • evevkovacs (2)
  • danielsf (1)
  • wmwv (1)
  • joezuntz (1)
  • yymao (1)
Pull Request Authors
  • yymao (27)
  • github-actions[bot] (4)
  • patricialarsen (2)
  • wmwv (1)
Top Labels
Issue Labels
bug (1) enhancement (1)
Pull Request Labels
enhancement (6) bug (3)

Packages

  • Total packages: 2
  • Total downloads:
    • pypi 1,029 last-month
  • Total dependent packages: 1
    (may contain duplicates)
  • Total dependent repositories: 1
    (may contain duplicates)
  • Total versions: 32
  • Total maintainers: 1
pypi.org: gcr

Generic Catalog Reader: A common reader interface for accessing generic catalogs

  • Versions: 27
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 1,029 Last month
Rankings
Downloads: 7.9%
Dependent packages count: 10.1%
Forks count: 11.9%
Average: 14.4%
Stargazers count: 20.4%
Dependent repos count: 21.6%
Maintainers (1)
Last synced: 6 months ago
conda-forge.org: gcr
  • Versions: 5
  • Dependent Packages: 1
  • Dependent Repositories: 0
Rankings
Dependent packages count: 28.8%
Dependent repos count: 34.0%
Average: 39.9%
Forks count: 43.4%
Stargazers count: 53.5%
Last synced: 6 months ago

Dependencies

setup.py pypi
  • easyquery >=0.1.3
  • numpy *