Example #1
0
def which_obs_mjd(filename):
    """ Read to filename and return the observation time of the given data file.
    
    Parameters
    ----------
    filename: [string]
        location of the data file to open (a fits file)

    Return
    ------
    float (MJD)
    """
    # - SDSS 
    if sdss.is_sdss_file(filename):
        return sdss.which_obs_mjd(filename)

    # - SDSS 
    if snifs.is_snifs_file(filename):
        return snifs.which_obs_mjd(filename)

    # - HST     
    if hst.is_hst_file(filename):
        return hst.which_obs_mjd(filename)
    
    # - STELLA
    if stella.is_stella_file(filename):
        return stella.which_obs_mjd(filename)

    # - PTF
    if ptf.is_ptf_file(filename):
        return ptf.which_obs_mjd(filename)
    
    # - Nothing else...
    raise ValueError("'filename' does not belong to a known instrument "+"\n"+\
                     "these are:"+", ".join(KNOWN_INSTRUMENTS))
Example #2
0
def get_instrument_wcs(filename):
    """
    This function enables to load the wcs solution only, not opening the
    full image. This might be useful to avoid opening large images
    """
    from ..  import astrometry
    # - SDSS 
    if sdss.is_sdss_file(filename):
        index = sdss.DATAINDEX

    # - SNIFS
    elif snifs.is_snifs_file(filename):
        index = snifs.DATAINDEX
    
    # - HST     
    elif hst.is_hst_file(filename):
        index = hst.DATAINDEX
    # - STELLA
    elif stella.is_stella_file(filename):
        index = stella.DATAINDEX
    # - PTF
    elif ptf.is_ptf_file(filename):
        index = ptf.DATAINDEX
        
    else:
        # - Nothing else...
        raise ValueError("'filename' does not belong to a known instrument "+"\n"+\
                        "these are:"+", ".join(KNOWN_INSTRUMENTS))
    # -- good to go
    return astrometry.wcs(filename,extension=index)
Example #3
0
def get_instrument_wcs(filename):
    """
    This function enables to load the wcs solution only, not opening the
    full image. This might be useful to avoid opening large images
    """
    from ..  import astrometry
    # - SDSS 
    if sdss.is_sdss_file(filename):
        index = sdss.DATAINDEX

    # - SNIFS
    elif snifs.is_snifs_file(filename):
        index = snifs.DATAINDEX
    
    # - HST     
    elif hst.is_hst_file(filename):
        index = hst.DATAINDEX
    # - STELLA
    elif stella.is_stella_file(filename):
        index = stella.DATAINDEX
    # - PTF
    elif ptf.is_ptf_file(filename):
        index = ptf.DATAINDEX
        
    else:
        # - Nothing else...
        raise ValueError("'filename' does not belong to a known instrument "+"\n"+\
                        "these are:"+", ".join(KNOWN_INSTRUMENTS))
    # -- good to go
    return astrometry.wcs(filename,extension=index)
Example #4
0
def which_obs_mjd(filename):
    """ Read to filename and return the observation time of the given data file.
    
    Parameters
    ----------
    filename: [string]
        location of the data file to open (a fits file)

    Return
    ------
    float (MJD)
    """
    # - SDSS 
    if sdss.is_sdss_file(filename):
        return sdss.which_obs_mjd(filename)

    # - SDSS 
    if snifs.is_snifs_file(filename):
        return snifs.which_obs_mjd(filename)

    # - HST     
    if hst.is_hst_file(filename):
        return hst.which_obs_mjd(filename)
    
    # - STELLA
    if stella.is_stella_file(filename):
        return stella.which_obs_mjd(filename)

    # - PTF
    if ptf.is_ptf_file(filename):
        return ptf.which_obs_mjd(filename)
    
    # - Nothing else...
    raise ValueError("'filename' does not belong to a known instrument "+"\n"+\
                     "these are:"+", ".join(KNOWN_INSTRUMENTS))
Example #5
0
def get_instrument(filename,astrotarget=None,**kwargs):
    """ Reads the given file and open its corresponding Instrument object.
    Known instruments are (might not be exhaustive): SDSS / HST / PTF  

    Parameters
    ----------
    filename: [string]
        location of the data file to open (a fits file)

    astrotarget: [AstroTarget] -optional-
        Target associated to the image. The target should be within the
        image's boundaries.

    Return
    ------
    Instrument (the corresponding Child's object)
    """
    # - SDSS 
    if sdss.is_sdss_file(filename):
        return sdss.sdss(filename,astrotarget=astrotarget,
                    **kwargs)
    # - SNIFS
    if snifs.is_snifs_file(filename):
        return snifs.snifs(filename,astrotarget=astrotarget,
                    **kwargs)
    # - HST     
    if hst.is_hst_file(filename):
        return hst.hst(filename,astrotarget=astrotarget,
                    **kwargs)
    # - STELLA
    if stella.is_stella_file(filename):
        return stella.stella(filename,astrotarget=astrotarget,
                    **kwargs)
    # - PTF
    if ptf.is_ptf_file(filename):
        return ptf.ptf(filename,astrotarget=astrotarget,
                    **kwargs)
    
    # - Nothing else...
    raise ValueError("'filename' does not belong to a known instrument "+"\n"+\
                     "these are:"+", ".join(KNOWN_INSTRUMENTS))
Example #6
0
def get_instrument(filename,astrotarget=None,**kwargs):
    """ Reads the given file and open its corresponding Instrument object.
    Known instruments are (might not be exhaustive): SDSS / HST / PTF  

    Parameters
    ----------
    filename: [string]
        location of the data file to open (a fits file)

    astrotarget: [AstroTarget] -optional-
        Target associated to the image. The target should be within the
        image's boundaries.

    Return
    ------
    Instrument (the corresponding Child's object)
    """
    # - SDSS 
    if sdss.is_sdss_file(filename):
        return sdss.sdss(filename,astrotarget=astrotarget,
                    **kwargs)
    # - SNIFS
    if snifs.is_snifs_file(filename):
        return snifs.snifs(filename,astrotarget=astrotarget,
                    **kwargs)
    # - HST     
    if hst.is_hst_file(filename):
        return hst.hst(filename,astrotarget=astrotarget,
                    **kwargs)
    # - STELLA
    if stella.is_stella_file(filename):
        return stella.stella(filename,astrotarget=astrotarget,
                    **kwargs)
    # - PTF
    if ptf.is_ptf_file(filename):
        return ptf.ptf(filename,astrotarget=astrotarget,
                    **kwargs)
    
    # - Nothing else...
    raise ValueError("'filename' does not belong to a known instrument "+"\n"+\
                     "these are:"+", ".join(KNOWN_INSTRUMENTS))
Example #7
0
def which_band_is_file(filename):
    """ Read to filename and return the name of the photometric
    band associated to the given data file.
    Known instruments are (might not be exhaustive): SDSS / HST / PTF
    
    Parameters
    ----------
    filename: [string]
        location of the data file to open (a fits file)

    Return
    ------
    String (name of the photometric band)
    """
    # - SDSS 
    if sdss.is_sdss_file(filename):
        return sdss.which_band_is_file(filename)

    # - SDSS 
    if snifs.is_snifs_file(filename):
        return snifs.which_band_is_file(filename)

    # - HST     
    if hst.is_hst_file(filename):
        return hst.which_band_is_file(filename)
    
    # - STELLA
    if stella.is_stella_file(filename):
        return stella.which_band_is_file(filename)

    # - PTF
    if ptf.is_ptf_file(filename):
        return ptf.which_band_is_file(filename)
    
    # - Nothing else...
    raise ValueError("'filename' does not belong to a known instrument "+"\n"+\
                     "these are:"+", ".join(KNOWN_INSTRUMENTS))
Example #8
0
def which_band_is_file(filename):
    """ Read to filename and return the name of the photometric
    band associated to the given data file.
    Known instruments are (might not be exhaustive): SDSS / HST / PTF
    
    Parameters
    ----------
    filename: [string]
        location of the data file to open (a fits file)

    Return
    ------
    String (name of the photometric band)
    """
    # - SDSS 
    if sdss.is_sdss_file(filename):
        return sdss.which_band_is_file(filename)

    # - SDSS 
    if snifs.is_snifs_file(filename):
        return snifs.which_band_is_file(filename)

    # - HST     
    if hst.is_hst_file(filename):
        return hst.which_band_is_file(filename)
    
    # - STELLA
    if stella.is_stella_file(filename):
        return stella.which_band_is_file(filename)

    # - PTF
    if ptf.is_ptf_file(filename):
        return ptf.which_band_is_file(filename)
    
    # - Nothing else...
    raise ValueError("'filename' does not belong to a known instrument "+"\n"+\
                     "these are:"+", ".join(KNOWN_INSTRUMENTS))