Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96157256
mockimgs_fits_histogram
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Dec 23, 07:07
Size
1 KB
Mime Type
text/x-python
Expires
Wed, Dec 25, 07:07 (2 d)
Engine
blob
Format
Raw Data
Handle
23135873
Attached To
rARRAKIHS ARRAKIHS
mockimgs_fits_histogram
View Options
#!/usr/bin/python3
import argparse
from astropy.io import fits
import os
import numpy as np
import matplotlib.pyplot as plt
####################################################################
# option parser
####################################################################
description="subtract two fits files and create a new one with the difference"
epilog ="""
Examples:
--------
mockimgs_fits_substract image1.fits -o image.fits
"""
parser = argparse.ArgumentParser(description=description,epilog=epilog,formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument(action="store",
dest="files",
metavar='FILE',
type=str,
default=None,
nargs="*",
help='one files')
parser.add_argument("-o",
action="store",
type=str,
dest="outputfilename",
default=None,
help="Name of the output file")
####################################################################
# main
####################################################################
if __name__ == '__main__':
opt = parser.parse_args()
for f in opt.files:
hdu = fits.open(f)
data = np.ravel(hdu[0].data)
data = np.compress(data<100,data)
bins = np.linspace(26,31.5,50)
h,bins = np.histogram(data,bins)
plt.plot(bins[1:],h,label=f)
plt.legend()
plt.show()
Event Timeline
Log In to Comment