returns a bool list if the coordinate is within the aperture (list)
        :param ra:
        :param dec:
        :return:
163915
def aperture_select(self, ra, dec, kwargs_aperture):
        
        if self._aperture_type == 'shell':
            bool_list = self.shell_select(ra, dec, **kwargs_aperture)
        elif self._aperture_type == 'slit':
            bool_list = self.slit_select(ra, dec, **kwargs_aperture)
        else:
            raise ValueError("aperture type %s not implemented!" % self._aperture_type)
        return bool_list
141086
def inMicrolensRegion_main(args=None):
    """"""
    import argparse
    parser = argparse.ArgumentParser(
                    description="Check if a celestial coordinate is "
                                "inside the K2C9 microlensing superstamp.")
    parser.add_argument('ra', nargs=1, type=float,
                        help="Right Ascension in decimal degrees (J2000).")
    parser.add_argument('dec', nargs=1, type=float,
                        help="Declination in decimal degrees (J2000).")
    args = parser.parse_args(args)
    if inMicrolensRegion(args.ra[0], args.dec[0]):
        print("Yes! The coordinate is inside the K2C9 superstamp.")
    else:
        print("Sorry, the coordinate is NOT inside the K2C9 superstamp.")
268004
def computePointing(self, ra_deg, dec_deg, roll_deg, cartesian=False):
        """"""
        # Roll FOV
        Rrotate = r.rotateInXMat(roll_deg)  # Roll

        # Slew from ra/dec of zero
        Ra = r.rightAscensionRotationMatrix(ra_deg)
        Rd = r.declinationRotationMatrix(dec_deg)
        Rslew = np.dot(Ra, Rd)

        R = np.dot(Rslew, Rrotate)

        slew = self.origin*1
        for i, row in enumerate(self.origin):
            slew[i, 3:6] = np.dot(R, row[3:6])

        if cartesian is False:
            slew = self.getRaDecs(slew)
        return slew
979954
def _get_c_valid_arr(self, x):
        
        orig_shape = x.shape
        x = np.ascontiguousarray(x.reshape(orig_shape[0], -1).T)
        return orig_shape, x
668769
def within(self, lat, lon, radius):
		''''''
		return self.filter(filter_helpers.within_(lat, lon, radius))
1220553
def deg2HMS(ra='', dec='', round=False):
    
    RA, DEC, rs, ds = '', '', '', ''
    if dec:
        if str(dec)[0] == '-':
            ds, dec = '-', abs(dec)
        deg = int(dec)
        decM = abs(int((dec-deg)*60))
        if round:
            decS = int((abs((dec-deg)*60)-decM)*60)
        else:
            decS = (abs((dec-deg)*60)-decM)*60
        DEC = '{0}{1} {2} {3}'.format(ds, deg, decM, decS)
  
    if ra:
        if str(ra)[0] == '-':
            rs, ra = '-', abs(ra)
        raH = int(ra/15)
        raM = int(((ra/15)-raH)*60)
        if round:
            raS = int(((((ra/15)-raH)*60)-raM)*60)
        else:
            raS = ((((ra/15)-raH)*60)-raM)*60
        RA = '{0}{1} {2} {3}'.format(rs, raH, raM, raS)
  
    if ra and dec:
        return (RA, DEC)
    else:
        return RA or DEC
150881
def _get_list_axis(self, key, axis=None):
        
        if axis is None:
            axis = self.axis or 0
        try:
            return self.obj._take(key, axis=axis)
        except IndexError:
            # re-raise with different error message
            raise IndexError("positional indexers are out-of-bounds")
355226
def get_dec(self):
        

        try:

            return self.dec.value

        except AttributeError:

            # Transform from L,B to R.A., Dec

            return self.sky_coord.transform_to('icrs').dec.value
1323301
def isPositiveMap(self):
        
        x0, y0 = self.skyToPix(self.ra0_deg, self.dec0_deg)
        x1, y1 = self.skyToPix(self.ra0_deg + 1/3600., self.dec0_deg)

        if x1 > x0:
            return True
        return False
1368615
def pointlist(points, sr):
    """"""
    assert all(isinstance(pt, Point) or len(pt) == 2 
               for pt in points), "Point(s) not in [x, y] form"
    return [coord if isinstance(coord, Point) 
                  else Point(coord[0], coord[1], sr)
            for coord in points]
394030
def parameters(self):
        

        if self._coord_type == 'galactic':

            return collections.OrderedDict((('l', self.l), ('b', self.b)))

        else:

            return collections.OrderedDict((('ra', self.ra), ('dec', self.dec)))
946293
def __get_ra_index_indices(self):
        
        fragment_indices = []
        for idx, cumlen in enumerate(self._cumulative_lengths):
            cumlen_prev = self._cumulative_lengths[idx - 1] if idx > 0 else 0
            fragment_indices.append([np.argwhere(
                np.logical_and(self.ra_indices >= cumlen_prev, self.ra_indices < cumlen)
            )])
        return fragment_indices
1265983
def getAngle(self, mode='deg'):
        
        if self.refresh is True:
            self.getMatrix()

        try:
            if self.mflag:
                if mode == 'deg':
                    return self.bangle / np.pi * 180
                else:  # rad
                    return self.bangle
            else:
                return 0
        except AttributeError:
            print("Please execute getMatrix() first.")
742750
def pickAChannelList(self, ra_deg, dec_deg):
        
        try:
            from astropy.coordinates import SkyCoord
            from astropy import units as u
        except ImportError:
            raise ImportError("AstroPy needs to be installed to use this feature.")
        cRa = self.currentRaDec[:, 3]  # Ra of each channel corner
        cDec = self.currentRaDec[:, 4]  # dec of each channel corner
        catalog = SkyCoord(cRa*u.deg, cDec*u.deg)
        position = SkyCoord(ra_deg*u.deg, dec_deg*u.deg)
        idx, _, _ = position.match_to_catalog_sky(catalog)
        return self.currentRaDec[idx, 2]
190692
def ra_indices_for_traj(self, traj):
        
        assert not self.uniform_stride, "requested random access indices, but is in uniform stride mode"
        if traj in self.traj_keys:
            return self.ra_indices_for_traj_dict[traj]
        else:
            return np.array([])
45876
def take_complement(list_, index_list):
    
    mask = not_list(index_to_boolmask(index_list, len(list_)))
    return compress(list_, mask)
430758
def ensure_dtraj_list(dtrajs):
    

    """
    if isinstance(dtrajs, list):
        # elements are ints? then wrap into a list
        if is_list_of_int(dtrajs):
            return [np.array(dtrajs, dtype=int)]
        else:
            for i, dtraj in enumerate(dtrajs):
                dtrajs[i] = ensure_dtraj(dtraj)
            return dtrajs
    else:
        return [ensure_dtraj(dtrajs)]