forked from spacetelescope/ramp_simulator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_galaxy_list.py
executable file
·54 lines (39 loc) · 1.55 KB
/
create_galaxy_list.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#! /usr/bin/env python
'''
Create an example file that lists input galaxies to be fed into the
data ramp simulator.
'''
import numpy as np
from astropy.table import Table
number_of_sources = 200
outfile = 'galaxies_single_detector_ra0dec0.list'
outtab = Table()
delta = 2048 * (np.sqrt(2) - 1) / 2
minx = 0 - delta
maxx = 2048 + delta
miny = minx
maxy = maxx
minra = 359.9917
maxra = 360.0083
mindec = -0.009
maxdec = 0.008
minmag = 27
maxmag = 18
minrad = 0.2
maxrad = 2
minellip = 0
maxellip = 0.75
minsersic = 1
maxsersic = 4
ras = np.random.uniform(minra,maxra,number_of_sources)
over = ras >= 360.
ras[over] = ras[over] - 360.
outtab['x_or_RA'] = ras
outtab['y_or_Dec'] = np.random.uniform(mindec,maxdec,number_of_sources)
outtab['radius'] = np.random.uniform(minrad,maxrad,number_of_sources)
outtab['ellipticity'] = np.random.uniform(minellip,maxellip,number_of_sources)
outtab['pos_angle'] = np.random.uniform(0,359,number_of_sources)
outtab['sersic_index'] = np.random.uniform(minsersic,maxsersic,number_of_sources)
outtab['magnitude'] = np.random.uniform(minmag,maxmag,number_of_sources)
outtab.meta['comments'] = ["","","x and y can be pixel values, or RA and Dec strings or floats. To differentiate, put 'pixels' in the top line if the inputs are pixel values.","radius can also be in units of pixels or arcseconds. Put 'radius_pixels' at top of file to specify radii in pixels.","position angle is given in degrees counterclockwise. A value of 0 will align the semimajor axis with the x axis of the detector."]
outtab.write(outfile,format='ascii',overwrite=True)