diff --git a/README.rst b/README.rst index dccc8b43..41c2f375 100644 --- a/README.rst +++ b/README.rst @@ -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/ diff --git a/bin/qa-fiberassign b/bin/qa-fiberassign index cb24cf08..64f4f100 100755 --- a/bin/qa-fiberassign +++ b/bin/qa-fiberassign @@ -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 @@ -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: @@ -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: @@ -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') diff --git a/doc/conf.py b/doc/conf.py index 54608c38..3aa303ec 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -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 @@ -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 @@ -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. @@ -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'), ]