Extract objects from a Gaia DR2 table.
962767
def standardize_table(cls, table):
        '''
        
        '''

        print(cls)
        identifiers = {n+'-id':table[n] for n in cls.identifier_keys}

        # create skycoord objects
        N = len(table)
        coordinates = dict(  ra=table['_RAJ2000'].data.data*u.deg,
                             dec=table['_DEJ2000'].data.data*u.deg,
                             pm_ra_cosdec=table['pmRA'].data.data*u.arcsec/u.year,
                             pm_dec=table['pmDE'].data.data*u.arcsec/u.year,
                             radial_velocity=np.nan*np.ones(N)*u.km/u.s,
                             distance=np.nan*np.ones(N)*u.pc,#distance=1000*u.pc/table['parallax'].data, # weirdly, messed with RA + Dec signs if parallax is zero
                             obstime=cls.epoch*np.ones(N)*u.year)#Time(, format='decimalyear'))
        for k in coordinates:
            print(k, coordinates[k])
        magnitudes = {f+'-mag':table[f+'mag'].data for f in cls.filters}

        standardized = hstack([Table(identifiers),
                               Table(coordinates),
                               Table(magnitudes)])
        standardized.meta['catalog'] = 'Gaia'

        return standardized
706618
def relations_of(self, target, include_object=False):
        '''  '''
        if include_object:
            _ = self._execute('''
                select relations.name, ob2.code from relations, objects as ob1, objects as ob2 where relations.src=ob1.id and ob2.id=relations.dst and ob1.code=?
            ''', (self.serialize(target),))
            for i in _:
                yield i[0], self.deserialize(i[1])
        else:

            _ = self._execute('''
                select distinct relations.name from relations, objects where relations.src=objects.id and objects.code=?
            ''', (self.serialize(target),))
            for i in _:
                yield i[0]
492903
public List extract(ResultSet rs) throws Exception {
		ResultSetMetaData meta = rs.getMetaData();
		int count = meta.getColumnCount();
		List ret = new ArrayList();
		while (rs.next()) {
			Map map = new LinkedHashMap(count);
			for (int i = 1; i <= count; i++) {
				map.put(meta.getColumnName(i), rs.getObject(i));
			}
			ret.add(map);
		}
		return ret;
	}
951247
private static List<UberData> extractProperties(Object obj) {

		if (PRIMITIVE_TYPES.contains(obj.getClass())) {
			return Collections.singletonList(new UberData().withValue(obj));
		}

		return PropertyUtils.findProperties(obj).entrySet().stream()
				.map(entry -> new UberData().withName(entry.getKey()).withValue(entry.getValue())).collect(Collectors.toList());
	}
1211604
def final_objects(self):
        """"""
        return [obj for obj in self.database_objects
                if obj.status in [obj.known_statuses.COMPLETED]]
1178195
def getobjects(bunchdt, data, commdct, key, places=7, **kwargs):
    """"""
    idfobjects = bunchdt[key]
    allobjs = []
    for obj in idfobjects:
        if __objecthasfields(
                bunchdt, data, commdct,
                obj, places=places, **kwargs):
            allobjs.append(obj)
    return allobjs
162496
def plantloopfields(data, commdct):
    """"""
    fieldlists = plantloopfieldlists(data)
    objkey = 'plantloop'.upper()
    return extractfields(data, commdct, objkey, fieldlists)
1187356
def __extract_bbox(arr, bb_old):
    ""
    hole = ndimage.binary_fill_holes(arr)- arr
    bb_list = ndimage.find_objects(ndimage.binary_dilation(hole, iterations = 1))
    if 0 == len(bb_list): return bb_old
    else: bb = bb_list[0]
    
    if not bb_old: return list(bb)
    
    for i in range(len(bb_old)):
        bb_old[i] = slice(min(bb_old[i].start, bb[i].start),
                          max(bb_old[i].stop, bb[i].stop))
    return bb_old
1272867
def extract_entity(found):
    """"""
    obj = dict()
    for prop in found.entity.property:
        obj[prop.name] = prop.value.string_value
    return obj
405625
def get_records_with_attachments(attachment_table, rel_object_field="REL_OBJECTID"):
    """"""
    if arcpyFound == False:
        raise Exception("ArcPy is required to use this function")
    OIDs = []
    with arcpy.da.SearchCursor(attachment_table,
                               [rel_object_field]) as rows:
        for row in rows:
            if not str(row[0]) in OIDs:
                OIDs.append("%s" % str(row[0]))
            del row
    del rows
    return OIDs
364089
def getIndexes(cls) :
		""
		con = RabaConnection(cls._raba_namespace)
		idxs = []
		for idx in con.getIndexes(rabaOnly = True) :
			if idx[2] == cls.__name__ :
				idxs.append(idx)
			else :
				for k in cls.columns :
					if RabaFields.isRabaListField(getattr(cls, k)) and idx[2] == con.makeRabaListTableName(cls.__name__, k) :
						idxs.append(idx)
		return idxs
613254
def extract_indexes(coords):
    """"""
    for name, variable in coords.items():
        variable = as_variable(variable, name=name)
        if variable.dims == (name,):
            yield name, variable.to_index()
925456
def each_object_id(collection):
    """"""
    c_path = collection_path(collection)
    paths = glob('%s/*.%s' % (c_path, _ext))
    for path in paths:
        match = regex.match(r'.+/(.+)\.%s$' % _ext, path)
        yield match.groups()[0]
793050
def _get_django_objects(model):
    '''
    
    '''
    model_name = model.__class__.__name__
    model_objects = [i for i in model.objects.all()]
    logger.debug('Found {} {} objects in DB'.format(len(model_objects), model_name))
    return model_objects
211684
def read_associations(assoc_fn, anno_type='id2gos', **kws):
    """"""
    # kws get_objanno: taxids hdr_only prt allow_missing_symbol
    obj = get_objanno(assoc_fn, anno_type, **kws)
    # kws get_id2gos: ev_include ev_exclude keep_ND keep_NOT b_geneid2gos go2geneids
    return obj.get_id2gos(**kws)
580595
def __get_table_pairs(self):
        
        try:
            for _idx, _p in enumerate(self.data_paleos):
                _c = {}
                try:
                    _c = self.data_chrons[_idx]
                except IndexError:
                    pass
                # create entry in self object collection of data tables
                self.noaa_data_sorted["Data"].append({"paleo": _p, "chron": _c})
        except KeyError:
            logger_lpd_noaa.warning("lpd_noaa: get_meas_table: 0 paleo data tables")

        self.output_file_ct = len(self.noaa_data_sorted["Data"])
        return
220307
def data_frame_to_astropy_table (dataframe):
    
    from astropy.utils import OrderedDict
    from astropy.table import Table, Column, MaskedColumn
    from astropy.extern import six

    out = OrderedDict()

    for name in dataframe.columns:
        column = dataframe[name]
        mask = np.array (column.isnull ())
        data = np.array (column)

        if data.dtype.kind == 'O':
            # If all elements of an object array are string-like or np.nan
            # then coerce back to a native numpy str/unicode array.
            string_types = six.string_types
            if six.PY3:
                string_types += (bytes,)
            nan = np.nan
            if all(isinstance(x, string_types) or x is nan for x in data):
                # Force any missing (null) values to b''.  Numpy will
                # upcast to str/unicode as needed.
                data[mask] = b''

                # When the numpy object array is represented as a list then
                # numpy initializes to the correct string or unicode type.
                data = np.array([x for x in data])

        if np.any(mask):
            out[name] = MaskedColumn(data=data, name=name, mask=mask)
        else:
            out[name] = Column(data=data, name=name)

    return Table(out)