Skip to content

Commit

Permalink
reads some columns
Browse files Browse the repository at this point in the history
  • Loading branch information
forero committed Nov 24, 2020
1 parent 2ac8314 commit 718f958
Showing 1 changed file with 28 additions and 3 deletions.
31 changes: 28 additions & 3 deletions py/fiberassign/assign.py
Original file line number Diff line number Diff line change
Expand Up @@ -1270,7 +1270,31 @@ def merge_results(targetfiles, skyfiles, tiles, result_dir=".",
skyhead = dict()

survey = None


some_dt = np.dtype([('BRICKID', '>i4'), ('BRICKNAME', 'S8'), ('BRICK_OBJID', '>i4'),
('MORPHTYPE', 'S4'),
('RA', '>f8'), ('DEC', '>f8'),
('EBV', '>f4'),
('FLUX_G', '>f4'), ('FLUX_R', '>f4'), ('FLUX_Z', '>f4'),
('FLUX_IVAR_G', '>f4'), ('FLUX_IVAR_R', '>f4'), ('FLUX_IVAR_Z', '>f4'),
('FLUX_W1', '>f4'), ('FLUX_W2', '>f4'),
('FIBERFLUX_G', '>f4'), ('FIBERFLUX_R', '>f4'), ('FIBERFLUX_Z', '>f4'),
('FIBERTOTFLUX_G', '>f4'), ('FIBERTOTFLUX_R', '>f4'), ('FIBERTOTFLUX_Z', '>f4'),
('REF_EPOCH', '>f4'), ('MASKBITS', '>i2'),
('FRACDEV', '>f4'),
('SHAPEDEV_R', '>f4'), ('SHAPEDEV_E1', '>f4'),
('SHAPEDEV_E2', '>f4'),
('SHAPEEXP_R', '>f4'), ('SHAPEEXP_E1', '>f4'),
('SHAPEEXP_E2', '>f4'),
('REF_ID', '>i8'), ('REF_CAT', 'S2'),
('GAIA_PHOT_G_MEAN_MAG', '>f4'), ('GAIA_PHOT_BP_MEAN_MAG', '>f4'),
('GAIA_PHOT_RP_MEAN_MAG', '>f4'),
('PARALLAX', '>f4'), ('PMRA', '>f4'), ('PMDEC', '>f4'),
('PHOTSYS', 'S1'), ('TARGETID', '>i8'),
('DESI_TARGET', '>i8'), ('BGS_TARGET', '>i8'), ('MWS_TARGET', '>i8'),
('SUBPRIORITY', '>f8'), ('OBSCONDITIONS', '>i8'), ('PRIORITY_INIT', '>i8'),
('NUMOBS_INIT', '>i8')])
some_columns = list(some_dt.fields.keys())
for tf in targetfiles:
tm = Timer()
tm.start()
Expand All @@ -1279,13 +1303,14 @@ def merge_results(targetfiles, skyfiles, tiles, result_dir=".",
# Allocate a shared memory buffer for the target data
tglen = fd[1].get_nrows()
tgshape[tf] = (tglen,)
tgdtype[tf], tempoff, tempisvararray = fd[1].get_rec_dtype()
#tgdtype[tf], tempoff, tempisvararray = fd[1].get_rec_dtype()
tgdtype[tf] = some_dt
tgbytes = tglen * tgdtype[tf].itemsize
tgdata[tf] = RawArray("B", tgbytes)
tgview = np.frombuffer(tgdata[tf],
dtype=tgdtype[tf]).reshape(tgshape[tf])
# Read data directly into shared buffer
tgview[:] = fd[1].read()
tgview[:] = fd[1].read(columns=some_columns)
if survey is None:
(survey, col, sciencemask, stdmask, skymask, suppskymask,
safemask, excludemask) = default_target_masks(tgview)
Expand Down

0 comments on commit 718f958

Please sign in to comment.