-
Notifications
You must be signed in to change notification settings - Fork 0
Usage
JHaller27 edited this page Apr 18, 2019
·
12 revisions
After completing installation, there are a few ways to run python scripts:
- If using a venv, make sure you've first activated the venv with
astrodb$ . activate
, then use...-
astrodb/src$ ./<filename>.py <args>
or... -
astrodb/src$ python <filename>.py <args>
. - (Deactivate the venv either with
$ deactivate
or simply by closing the terminal)
-
- If not using a venv, use...
astrodb/src$ python3.7 <filename>.py <args>
Reads a data source file
(e.g. via AstroPy if a .fits
file)
and dumps all records in the file's table to a MongoDB server (via PyMongo).
Note: Can be displayed in a terminal with the -h
or --help
arguments.
Argument | Description | Example |
---|---|---|
source_path |
(required) Path to source data file | ~/Downloads/cos_merged_v1.1.fits |
-d, --db <text> |
(required) Name of the database where the data will be stored. If it does not exist, it will be created! Make sure you're following the naming restrictions. |
--db astrodb or -d MySuperCoolDatabase
|
-c, --coll <text> |
(required) Name of the collection in the database where the data will be stored (if it does not exist, it will be created!) Make sure you're following the naming restrictions. |
--coll maunakea-2019 or -d Stars
|
-u, --uri <text> |
Address of the database (defaults to localhost : a local MongoDB instance) |
--uri mongodb+srv://jsmith:<password>@astrodb-abc12.azure.mongodb.net/test or -u mongodb://localhost:27017/
|
--src <text> |
Use this to override the source name used in the actual records. If not specified, will default to the name of the file from source_path (ignoring everything before the last separator, usually a slash or backslash). |
--src "hubble-2019" or --src "RIT-observatory-2185"
|
-b, --buffer <integer> |
Number of records that will be stored in memory before they are uploaded to the database (defaults to 1). See here for notes on what to choose. |
--buffer 1 or -b 1000
|
-s, --sep <float> |
The maximum separation (in arc seconds) required for two objects to be merged (defaults to 0.0). Objects whose coordinates are below this threshold will be considered the same object and will be stored in the same Document. |
--sep 10 or -s 5.243157
|
-f, --format <text> |
Format of the source file (defaults to "fits"). Must be "fits" or one of the supported ascii file types. |
--format fits or -f sextractor
|
--delim <text> |
Delimiter used when parsing an ascii file. If not specified, will use the default delimiter for the specified format type. |
--delim " " for spaces, or --delim "\t" for tabs |
--coords "<RA>, <DEC>" |
Names of the fields containing the RA and DEC fields in the source file (defaults to "RA, DEC"). |
--coords "ra, dec" or --coords "hRA, hDEC"
|