GithubHelp home page GithubHelp logo

astrodbtoolkit / astrodb_utils Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 2.0 279 KB

Home Page: https://astrodb-template-db.readthedocs.io/en/latest/

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%

astrodb_utils's Introduction

astrodb-utils

Test astrodb-utils Documentation Status PyPI version

The following tables are expected by AstroDB Toolkit and the AstroDB_scripts package:

  • Sources
  • Publications
  • Names
  • Telescopes
  • Instruments You may modify these tables, but doing so may decrease the interoperability of your database with other tools.

Developer Setup Instructions

  • Make new environment with Python=3.10
  • Install dependencies using an editable install:
    pip install -e ".[test]"
    
  • In the astrodb_utils/tests/ directory, clone the astrodb-template-db repo:
    git clone https://github.com/astrodbtoolkit/astrodb-template-db.git
    
  • Be sure to run tests from the top level directory.

astrodb_utils's People

Contributors

arjunsavel avatar dr-rodriguez avatar kelle avatar

Watchers

 avatar

astrodb_utils's Issues

Make example scripts for ingesting many things

Remove all functions which handle ingesting multiple things (eg spectra/spectrum). Instead, give examples which demonstrate how to do make the loops and use the single item functions.

Focus on scripts which ingest ONE thing.

calling structure of functions with many inputs

Right now, we are using positional arguments for functions ingesting data. For functions with a lot of inputs, this becomes quite unwieldy. Should we have a different method? maybe a dictionary?

Add units expectations to ingest functions

In SIMPLE, we assume units and note what the expectation is in the docs. This is extremely error prone. Other options

  • Include units in the column name. e.g., parallax_mas, parallax_error_mas
  • Include units as a column in all tables with a measurement. We could then have a test to make sure that that string corresponds to a astropy unit.

Change filter width column to `effective_width_angstroms`

In the PhotometryFilters table, we ingest the filter width provided by the SVO service. SVO provides both the FWHM and the effective width. Does anyone have strong or informed opinions about which ones of these we should use for "width"?

RTD organization

I have some questions about how we want to organize the readthedocs. A few classic pages are:

  • Installation
  • Getting started โ€” this is what I have the most questions about, I guess. What does a "quickstart" look like for this project? Maybe #31 goes here?
  • API (auto-generated docstrings, etc.)

We could also have:

  • developer information (#11 could go here)
  • FAQ

What do y'all think?

Improve `find_publication` function

Right now, the find_publication function does not find Gaia and Gaia23, it only finds Gaia. It should find both. There is currently a skipped test.

Fix test configuration

For some reason, running pytest doesn't work. Error is
ModuleNotFoundError: No module named 'tests.test_utils'.

Probably something not quite right to pyproject.toml and might be related to src layout.

How to add/where to put test data

in order to test these scripts, we need a database. Gotta figure out how that all fits in. Would be nice to have a folder structure which makes it clear that the data in here is for testing only. Maybe nested under tests/?

Rename this package and repo `astrodb_utils`

In SIMPLE, we decided that scripts are "one-off" scripts and utils are the helper functions. In keeping consistent with that thinking, this package should be named astrodb_utils.

Write helper function to check for values

A lot of the ingest scripts contain similar code to look to see if values already exist in the database. (e.g., telescope, instrument, filter, etc.) I think we could use a helper function here. Something like this

def in_database(db, value, table, field):
       match = (
            db.query(db.table)
            .filter(db.table.c.field == value)
            .table()
        )

        if len(match) == 0:
            msg = f"Value {value} not found in {table} table."
            return false
        else
            return true

I'm not exactly sure how to compose the pointers in the query (f"db.{table}.c.{field}?) but I think the answer is in here: https://docs.sqlalchemy.org/en/20/faq/sqlexpressions.html

Question re:"*" usage in functions

What is * supposed to be in:

def find_source_in_db(db, source, *, ra=None, dec=None, search_radius=60.0):

That's used throughout several functions, but it's not clear to me what it represents or how it's meant to be used. If this is meant to be *args isn't it missing the args part of it so it can be referred to in the code?

hyphen vs. underscore?

Hyphen is more consistent with, e.g., SIMPLE-db, but we can't import modules with a hyphen without importlib I believe...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.