Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F102890660
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
Tue, Feb 25, 06:14
Size
1 KB
Mime Type
text/x-python
Expires
Thu, Feb 27, 06:14 (1 d, 20 h)
Engine
blob
Format
Raw Data
Handle
24454021
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