Download an image from SDSS or DSS and make the plot
Largely copied from hetdexshuffle/visualize.py with some minor modifications
Todo
Improve the documentation.
ifu_centers: plotFocalPlaneQuicklook() and get_image() have a ifu_centers arguments, which is the center of the IFUs in the focal plane. This is confusing as in HETDEX jargon IFUCen refers to the fibers within one IFU.
Write tests.
Use io.StringIO instead of StringIO.StringIO in python2
The CD matrix could be substituted by astropy WCS:
Check if io.StringIO works for python2, if yes, we don’t need it pyhetdex.tools.six
Check if the position at ra, dec is within the SDSS footprint
Parameters: | ra, dec : float
|
---|---|
Returns: | bool
|
Create the SDSS image around the given coordinates
Todo
filename: is hard coded. Instead of the output directory pass the full output name in the function arguments
Rename the function: probably plot_image would be more appropriate
box, size_cut_out: they should not be hard coded
html size should not be hard code
Parameters: | ra, dec : float
pa : ?
size : float
ifu_centers : list
yflip : bool
outdir : string
|
---|---|
Returns: | outfile : string
|
Patrol circles collection
Plot the region of IFUs and patrol circle and return as a PatchCollection, which can be added to a plot using add_collection().
Todo
ifu_size is hard coded to 0.012. Move to optional argument
Rename the function: function does not plot!
Parameters: | dra, ddec : float
pa : float
scale : float
ifu_centers : list
ra, dec : flat
CD : ?
im_size : float
color : matplotlib color, optional
linewidth : float, optional
|
---|---|
Returns: | PatchCollection instance
|
Wrapper function for retrieving image from SDSS. If region outside SDSS converage, it uses DSS image instead.
Todo
either catch errors from urlopen() in retrieve_image_SDSS() and retrieve_image_DSS() or add the notion that it’s raised and do something about it in get_image()
Parameters: | ra, dec : float
size : float
yflip : bool
|
---|---|
Returns: | imarray : nd array
CD : numpy matrix
url : string
string
|
Retrieve a fits image from dss server and return the image array, the url, and the CD matrix (there is rotation in DSS images). CD matrix transforms the pixel position (x, y) to world coordinate (ra ,``dec``).
Parameters: | ra, dec, size, yflip : same as retrieve_image() |
---|---|
Returns: | same as retrieve_image() |
Retrieve image from SDSS-DR9 or dss server (jpeg) and returns the image array and the url. Note that the transformation from world coordinate (ra, dec) to pixel position (x, y) is simple projection without rotation:
x = -scale * (ra - ra0) * cos(dec) + x0
y = scale * (dec - dec0) + y0
Options for the query are described here
Parameters: | ra, dec, size, yflip : same as retrieve_image() scale : float, optional
|
---|---|
Returns: | same as retrieve_image() |
Convert world coordinates scale to pixels
Parameters: | ra, dec : float
ra0, dec0 : float
scale : float, optional
im_size : float, optional
CD : numpy.matrix, optional
|
---|---|
Returns: | x, y : float
|