-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
41 lines (30 loc) · 1.05 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import click
from pathlib import Path
from astropy.table import Table
from mesk.merge import merge_tables
"""
Program that merges two fits tables containing photometrical data into one table.
Example:
python main.py \
-f1 /run/media/jorge/BLUE/DATA/phd/vvvx/jhk0512.fits \
-f2 /run/media/jorge/BLUE/DATA/phd/vvvx/jhk0511.fits \
-o results.fits
"""
@click.command()
@click.option("-f1", help="File of the input fits table 1", required=True)
@click.option("-f2", help="File of the input fits table 2", required=True)
@click.option("-o", help="Output file for the merged table", required=True)
def main(f1, f2, o):
"""
Program that merges two fits tables containing photometrical data into one table.
"""
file1 = Path(f1)
file2 = Path(f2)
output_file = Path(o)
table1 = Table.read(file1)
table2 = Table.read(file2)
print(f"Processing tables {file1} and {file2}...")
merged_table = merge_tables(table1, table2)
merged_table.write(output_file, format="fits", overwrite=True)
if __name__ == "__main__":
main()