-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from stevenstetzler/arcsat_fixes
Support ARCSAT observatory images and add console script
- Loading branch information
Showing
4 changed files
with
69 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
from setuptools import setup | ||
|
||
setup() | ||
setup( | ||
entry_points={ | ||
"console_scripts": [ | ||
"koffi = koffi.script:main" | ||
] | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
from .koffi import ImageMetadata, skybot_search_frame, jpl_search_frame | ||
from astropy.table import QTable | ||
from astropy import units as u | ||
import argparse | ||
import sys | ||
|
||
|
||
def main(): | ||
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) | ||
parser.add_argument("filename", type=str, help="The fits filts to open") | ||
parser.add_argument("--query", type=str, default="JPL", help="The service to query, JPL or SkyBot") | ||
parser.add_argument("--format", type=str, default="QTable", help="The output format to use") | ||
|
||
args = parser.parse_args() | ||
|
||
image = ImageMetadata(args.filename) | ||
|
||
if args.query == "JPL": | ||
search = jpl_search_frame | ||
elif args.query == "SkyBot": | ||
search = skybot_search_frame | ||
|
||
objects = search(image) | ||
names = [] | ||
ras = [] | ||
decs = [] | ||
xs = [] | ||
ys = [] | ||
for name, coord in objects: | ||
names.append(name) | ||
ras.append(coord.ra.degree * u.degree) | ||
decs.append(coord.dec.degree * u.degree) | ||
x, y = image.wcs.world_to_pixel(coord) | ||
xs.append(x) | ||
ys.append(y) | ||
|
||
table = QTable( | ||
data=[names, ras, decs, xs, ys], | ||
names=["Object Name", "RA", "Dec", "x", "y"], | ||
) | ||
if args.format == "QTable": | ||
print(table) | ||
else: | ||
table.write(sys.stdout, format=args.format) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters