Skip to content

Commit

Permalink
Update files based on recent changes in master branch.
Browse files Browse the repository at this point in the history
  • Loading branch information
tskisner committed Feb 15, 2019
1 parent e09dc2c commit c027919
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 55 deletions.
53 changes: 8 additions & 45 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,50 +1,13 @@
===========
fiberassign
===========

Introduction
------------

This repository provides code for DESI fiber assignment, *i.e.* assigning
which fibers of which telescope pointings (tiles) should be assigned to
observe which objects in a target catalog.

Compiling
---------

To compile the code, set ``$PLATFORM`` to one of the recipes in the
``platforms/`` and then run ``make install``; *e.g.* at NERSC::

make PLATFORM=nersc_desiconda install

The version of fiberassign can be updated with::

make version

or::

make TAG=1.2.3 version

to set the version when tagging.

Running
-------
fiberassign
==============

The main executable ``fiberassign`` is a python wrapper around the
C++ ``fiberassign_exec`` code. Run ``fiberassign --help`` to see the
full set of command line options.
This repository contains code to plan the location of DESI fiber positioners. Given information about the instrument, a list of pointings (tiles), and catalogs of prioritized targets, fiber assignment computes the best positioner locations for each tile.

An example would be::
For full documentation, please visit `fiberassign on Read the Docs`_

fiberassign \
--mtl targets/mtl.fits \
--stdstar targets/standards-dark.fits \
--sky targets/sky.fits \
--surveytiles fiberassign/dark-tiles.txt \
--fibstatusfile fiberstatus.ecsv \
--outdir $SCRATCH/temp/
.. image:: https://readthedocs.org/projects/fiberassign/badge/?version=latest
:target: http://fiberassign.readthedocs.org/en/latest/
:alt: Documentation Status

``doc/Guide_to_FiberAssignment.tex`` contains more details about underlying
algorithms but is out of date for the details of running fiberassign.
A pdf snapshot is available to DESI collaborators at
https://desi.lbl.gov/DocDB/cgi-bin/private/ShowDocument?docid=2742 .
.. _`fiberassign on Read the Docs`: http://fiberassign.readthedocs.org/en/latest/
37 changes: 30 additions & 7 deletions bin/qa-fiberassign
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ fiberpos.sort('FIBER')
fiber_locations = sorted(zip(fiberpos['FIBER'], fiberpos['LOCATION']))

sky_mask = desi_mask.SKY
std_mask = (desi_mask.STD_FSTAR | desi_mask.STD_BRIGHT | desi_mask.STD_WD)
std_mask = 0
for name in ['STD', 'STD_FSTAR', 'STD_WD',
'STD_FAINT', 'STD_FAINT_BEST',
'STD_BRIGHT', 'STD_BRIGHT_BEST']:
if name in desi_mask.names():
std_mask |= desi_mask[name]

#- TODO: take hardcoded from src/global.h into config file
stuck_mask = 2**1
Expand All @@ -42,8 +47,13 @@ for filename in args.tilefiles:
fa = Table.read(filename, 'FIBERASSIGN')
fa.sort('FIBER')
assigned.append(fa)
tmp = Table.read(filename, 'POTENTIAL')['POTENTIALTARGETID']
covered.append(np.unique(tmp))
try:
potential = Table.read(filename, 'POTENTIAL_ASSIGNMENTS')
except KeyError:
potential = Table.read(filename, 'POTENTIAL')

covered.append(np.unique(potential['TARGETID']))

errors = list()

if len(np.unique(fa['FIBER'])) != 5000:
Expand All @@ -52,8 +62,21 @@ for filename in args.tilefiles:
if len(np.unique(fa['LOCATION'])) != 5000:
errors.append('Repeated location numbers')

is_stuck = ((fa['FIBERMASK'] & stuck_mask) != 0)
is_broken = ((fa['FIBERMASK'] & broken_mask) != 0)
#- There should be a faster way to do this
for fiber, targetid in zip(fa['FIBER'], fa['TARGETID']):
if targetid<0:
continue
ii = (potential['FIBER'] == fiber)
if targetid not in potential['TARGETID'][ii]:
errors.append('Assigned targets not in covered targets list')
break

num_no_desitarget = np.count_nonzero(fa['DESI_TARGET'] == 0)
if num_no_desitarget > 0:
errors.append('{} fibers with DESI_TARGET=0'.format(num_no_desitarget))

is_stuck = ((fa['FIBERSTATUS'] & stuck_mask) != 0)
is_broken = ((fa['FIBERSTATUS'] & broken_mask) != 0)
is_unassigned = (fa['TARGETID'] < 0)
n_good_unassigned = np.count_nonzero(is_unassigned & ~(is_stuck | is_broken))
if n_good_unassigned > 0:
Expand All @@ -68,8 +91,8 @@ for filename in args.tilefiles:
errors.append('fiber:location map incorrect')

ii = fa['TARGETID'] >= 0
dx = (fa['XFOCAL_DESIGN'][ii] - fiberpos['X'][ii])
dy = (fa['YFOCAL_DESIGN'][ii] - fiberpos['Y'][ii])
dx = (fa['DESIGN_X'][ii] - fiberpos['X'][ii])
dy = (fa['DESIGN_Y'][ii] - fiberpos['Y'][ii])
r = np.sqrt(dx**2 + dy**2)
if np.max(r) > 6:
errors.append('Fibers assigned to more than 6mm from positioner center')
Expand Down
7 changes: 4 additions & 3 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
# General information about the project.
project = 'fiberassign'
copyright = '2014-2019, DESI Collaboration'
author = 'Robert Cahn, Jaime E. Forero-Romero, Ted Kisner'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down Expand Up @@ -249,7 +250,7 @@
# author, documentclass [howto, manual, or own class]).
latex_documents = [
('index', 'fiberassign.tex', 'fiberassign Documentation',
'DESI', 'manual'),
'DESI Collaboration', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -279,7 +280,7 @@
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'fiberassign', 'fiberassign Documentation',
['DESI'], 1)
['DESI Collaboration'], 1)
]

# If true, show URL addresses after external links.
Expand All @@ -293,7 +294,7 @@
# dir menu entry, description, category)
texinfo_documents = [
('index', 'fiberassign', 'fiberassign Documentation',
'DESI', 'fiberassign', 'One line description of project.',
'DESI Collaboration', 'fiberassign', 'One line description of project.',
'Miscellaneous'),
]

Expand Down

0 comments on commit c027919

Please sign in to comment.