fisspy/io/read.py
def raster(file, wv, hw=0.05, x1=0, x2=False, y1=0, y2=False,
           pca=True, smooth=False, absScale = False, **kwargs):
    """
    Make raster images for a given file at wv of wavelength within width hw
    
    Parameters
    ----------
    file : str
        A string of file name to be read.
    wv   : float or 1d ndarray
        Referenced wavelengths.
    hw   : float
        A half-width of wavelength integration in unit of Angstrom.
        Default is 0.05
    x1   : (optional) int
        A starting index of the frame along the scanning direction.
    x2   : (optional) int
        An ending index of the frame along the scanning direction.
        If not, x2 is set to the maximum end point of the frame.
    y1   : (optional) int
        A starting index of the frame along the slit position.
    y2   : (optional0 int
        A ending index of the frame along the slit position.
    pca  : (optional) bool
        If True, the frame is read from the PCA file.
        Default is True, but the function automatically check
        the existance of the pca file.
    absScale : (optional) bool
        If True, the wavelength should be given in absolute scale.
        If Flase, the wavelength should be given in relative scale. 
    smooth : (optional) bool
        If True, apply the Savitzky-Golay filter to increase the signal to
        noise without greatly distorting the signal of the given fts file.
            * Default is False.
    kwargs
        Any additional keyword arguments to read frame.
        See the docstring of `fisspy.io.read.frame`
        
    Returns
    -------
    Raster : ~numpy.ndarray
        Raster image at given wavelengths.
        
    Notes
    -----
        This function is based on the IDL code FISS_RASTER.PRO
        written by J. Chae, 2013.
        This function automatically check the existance of the pca file by
        reading the fts header.
    
    Example
    -------
    .. plot::
        :include-source:
            
        import matplotlib.pyplot as plt
        from fisspy.io import read
        from fisspy import cm
        import fisspy.data.sample
        raster=read.raster(fisspy.data.sample.FISS_IMAGE,0.3)
        plt.imshow(raster, cmap=cm.ca, origin='lower', interpolation='bilinear')
        plt.title(r"GST/FISS 8542+0.3 $\AA$ Spectrogram")
        plt.show()
    """
    header = getheader(file,pca)
    ny = header['NAXIS2']
    nx = header['NAXIS3']
    dldw = header['CDELT1']
    
    if not file:
        raise ValueError('Empty filename')
    if x2 and x2 <= x1+1:
        raise ValueError('x2 must be larger than x1+1')
    
    try:
        num = wv.shape[0]    
    except:
        num = 1
        wv = np.array([wv])
    
    if not x2:
        x2 = int(nx)
    if not y2:
        y2 = int(ny)
    
    wl = simple_wvcalib(header, absScale= absScale)
    if hw < abs(dldw)/2.:
        hw = abs(dldw)/2.
    
    s = np.abs(wl-wv[:,None])<=hw
    sp = frame(file,x1,x2,pca=pca,smooth=smooth,**kwargs)
    leng = s.sum(1)
    if num == 1:
        img = sp[y1:y2,:,s[0,:]].sum(2)/leng[0]
        return img.reshape((y2-y1,x2-x1))
    else:
        img=np.array([sp[y1:y2,:,s[i,:]].sum(2)/leng[i] for i in range(num)])
        return img.reshape((num,y2-y1,x2-x1))

    Make raster images for a given file at wv of wavelength within width hw
    
    Parameters
    ----------
    file : str
        A string of file name to be read.
    wv   : float or 1d ndarray
        Referenced wavelengths.
    hw   : float
        A half-width of wavelength integration in unit of Angstrom.
        Default is 0.05
    x1   : (optional) int
        A starting index of the frame along the scanning direction.
    x2   : (optional) int
        An ending index of the frame along the scanning direction.
        If not, x2 is set to the maximum end point of the frame.
    y1   : (optional) int
        A starting index of the frame along the slit position.
    y2   : (optional0 int
        A ending index of the frame along the slit position.
    pca  : (optional) bool
        If True, the frame is read from the PCA file.
        Default is True, but the function automatically check
        the existance of the pca file.
    absScale : (optional) bool
        If True, the wavelength should be given in absolute scale.
        If Flase, the wavelength should be given in relative scale. 
    smooth : (optional) bool
        If True, apply the Savitzky-Golay filter to increase the signal to
        noise without greatly distorting the signal of the given fts file.
            * Default is False.
    kwargs
        Any additional keyword arguments to read frame.
        See the docstring of `fisspy.io.read.frame`
        
    Returns
    -------
    Raster : ~numpy.ndarray
        Raster image at given wavelengths.
        
    Notes
    -----
        This function is based on the IDL code FISS_RASTER.PRO
        written by J. Chae, 2013.
        This function automatically check the existance of the pca file by
        reading the fts header.
    
    Example
    -------
    .. plot::
        :include-source:
            
        import matplotlib.pyplot as plt
        from fisspy.io import read
        from fisspy import cm
        import fisspy.data.sample
        raster=read.raster(fisspy.data.sample.FISS_IMAGE,0.3)
        plt.imshow(raster, cmap=cm.ca, origin='lower', interpolation='bilinear')
        plt.title(r"GST/FISS 8542+0.3 $\AA$ Spectrogram")
        plt.show()
    
Make raster images for a given file at wv of wavelength within width hw
Parameters

file : str
A string of file name to be read.
wv   : float or 1d ndarray
Referenced wavelengths.
hw   : float
A half-width of wavelength integration in unit of Angstrom.
Default is 0.05
x1   : (optional) int
A starting index of the frame along the scanning direction.
x2   : (optional) int
An ending index of the frame along the scanning direction.
If not, x2 is set to the maximum end point of the frame.
y1   : (optional) int
A starting index of the frame along the slit position.
y2   : (optional0 int
A ending index of the frame along the slit position.
pca  : (optional) bool
If True, the frame is read from the PCA file.
Default is True, but the function automatically check
the existance of the pca file.
absScale : (optional) bool
If True, the wavelength should be given in absolute scale.
If Flase, the wavelength should be given in relative scale.
smooth : (optional) bool
If True, apply the Savitzky-Golay filter to increase the signal to
noise without greatly distorting the signal of the given fts file.
Default is False.
kwargs
Any additional keyword arguments to read frame.
See the docstring of `fisspy.io.read.frame`

Returns

Raster : ~numpy.ndarray
Raster image at given wavelengths.

Notes

This function is based on the IDL code FISS_RASTER.PRO
written by J.

Example

:
:include-source.


Make raster images for a given file at wv of wavelength within width hw Parameters file : str A string of file name to be read . wv : float or 1d ndarray Referenced wavelengths . hw : float A half - width of wavelength integration in unit of Angstrom . Default is 0 . 05 x1 : ( optional ) int A starting index of the frame along the scanning direction . x2 : ( optional ) int An ending index of the frame along the scanning direction . If not x2 is set to the maximum end point of the frame . y1 : ( optional ) int A starting index of the frame along the slit position . y2 : ( optional0 int A ending index of the frame along the slit position . pca : ( optional ) bool If True the frame is read from the PCA file . Default is True but the function automatically check the existance of the pca file . absScale : ( optional ) bool If True the wavelength should be given in absolute scale . If Flase the wavelength should be given in relative scale . smooth : ( optional ) bool If True apply the Savitzky - Golay filter to increase the signal to noise without greatly distorting the signal of the given fts file . Default is False . kwargs Any additional keyword arguments to read frame . See the docstring of ` fisspy . io . read . frame ` Returns Raster : ~numpy . ndarray Raster image at given wavelengths . Notes This function is based on the IDL code FISS_RASTER . PRO written by J . Example : : include - source .
def raster(file, wv, hw=0.05, x1=0, x2=False, y1=0, y2=False,
           pca=True, smooth=False, absScale = False, **kwargs):
    header = getheader(file,pca)
    ny = header['NAXIS2']
    nx = header['NAXIS3']
    dldw = header['CDELT1']
    if not file:
        raise ValueError('Empty filename')
    if x2 and x2 <= x1+1:
        raise ValueError('x2 must be larger than x1+1')
    try:
        num = wv.shape[0]    
    except:
        num = 1
        wv = np.array([wv])
    if not x2:
        x2 = int(nx)
    if not y2:
        y2 = int(ny)
    wl = simple_wvcalib(header, absScale= absScale)
    if hw < abs(dldw)/2.:
        hw = abs(dldw)/2.
    s = np.abs(wl-wv[:,None])<=hw
    sp = frame(file,x1,x2,pca=pca,smooth=smooth,**kwargs)
    leng = s.sum(1)
    if num == 1:
        img = sp[y1:y2,:,s[0,:]].sum(2)/leng[0]
        return img.reshape((y2-y1,x2-x1))
    else:
        img=np.array([sp[y1:y2,:,s[i,:]].sum(2)/leng[i] for i in range(num)])
        return img.reshape((num,y2-y1,x2-x1))
def raster ( file , wv , hw = 0.05 , x1 = 0 , x2 = False , y1 = 0 , y2 = False , pca = True , smooth = False , absScale = False , ** kwargs ) : header = getheader ( file , pca ) ny = header [ 'NAXIS2' ] nx = header [ 'NAXIS3' ] dldw = header [ 'CDELT1' ] if not file : raise ValueError ( 'Empty filename' ) if x2 and x2 <= x1 + 1 : raise ValueError ( 'x2 must be larger than x1+1' ) try : num = wv . shape [ 0 ] except : num = 1 wv = np . array ( [ wv ] ) if not x2 : x2 = int ( nx ) if not y2 : y2 = int ( ny ) wl = simple_wvcalib ( header , absScale = absScale ) if hw < abs ( dldw ) / 2. : hw = abs ( dldw ) / 2. s = np . abs ( wl - wv [ : , None ] ) <= hw sp = frame ( file , x1 , x2 , pca = pca , smooth = smooth , ** kwargs ) leng = s . sum ( 1 ) if num == 1 : img = sp [ y1 : y2 , : , s [ 0 , : ] ] . sum ( 2 ) / leng [ 0 ] return img . reshape ( ( y2 - y1 , x2 - x1 ) ) else : img = np . array ( [ sp [ y1 : y2 , : , s [ i , : ] ] . sum ( 2 ) / leng [ i ] for i in range ( num ) ] ) return img . reshape ( ( num , y2 - y1 , x2 - x1 ) )
Make raster images for a given file at wv of wavelength within width hw
Parameters
Make raster images for a given file at wv of wavelength within width hw Parameters
"""
    Make raster images for a given file at wv of wavelength within width hw
    
    Parameters
    ----------
    file : str
        A string of file name to be read.
    wv   : float or 1d ndarray
        Referenced wavelengths.
    hw   : float
        A half-width of wavelength integration in unit of Angstrom.
        Default is 0.05
    x1   : (optional) int
        A starting index of the frame along the scanning direction.
    x2   : (optional) int
        An ending index of the frame along the scanning direction.
        If not, x2 is set to the maximum end point of the frame.
    y1   : (optional) int
        A starting index of the frame along the slit position.
    y2   : (optional0 int
        A ending index of the frame along the slit position.
    pca  : (optional) bool
        If True, the frame is read from the PCA file.
        Default is True, but the function automatically check
        the existance of the pca file.
    absScale : (optional) bool
        If True, the wavelength should be given in absolute scale.
        If Flase, the wavelength should be given in relative scale. 
    smooth : (optional) bool
        If True, apply the Savitzky-Golay filter to increase the signal to
        noise without greatly distorting the signal of the given fts file.
            * Default is False.
    kwargs
        Any additional keyword arguments to read frame.
        See the docstring of `fisspy.io.read.frame`
        
    Returns
    -------
    Raster : ~numpy.ndarray
        Raster image at given wavelengths.
        
    Notes
    -----
        This function is based on the IDL code FISS_RASTER.PRO
        written by J. Chae, 2013.
        This function automatically check the existance of the pca file by
        reading the fts header.
    
    Example
    -------
    .. plot::
        :include-source:
            
        import matplotlib.pyplot as plt
        from fisspy.io import read
        from fisspy import cm
        import fisspy.data.sample
        raster=read.raster(fisspy.data.sample.FISS_IMAGE,0.3)
        plt.imshow(raster, cmap=cm.ca, origin='lower', interpolation='bilinear')
        plt.title(r"GST/FISS 8542+0.3 $\AA$ Spectrogram")
        plt.show()
    """
file
wv
hw
x1
x2
y1
y2
pca
smooth
absScale