;+ ; NAME: ; smei_star_list ; PURPOSE: ; Reads content of star catalogues used for star subtraction in SMEI frames ; CATEGORY: ; camera ; CALLING SEQUENCE: FUNCTION smei_star_list , $ root = root , $ silent = silent , $ count = count , $ name = name , $ catalogues = catalogues, $ get_format = get_format, $ rmstar = rmstar ; OPTIONAL INPUT PARAMETERS: ; root=root scalar; type: string ; directory where star catalogue files are located. ; By default, this is the directory where this ; file is located. ; name=name array; type: string ; list of star names; only the data for the ; specified stars are returned. These MUST be names ; present in the SMEI star catalogues. ; catalogues scalar or array; type: string; ; default: ['brightstars','variables_4th','big_variables','duhstars'] ; list of catalogues to be used. Must be one or more of ; the entries on the defaults list (lowercase! and NO typos!). ; /silent suppresses informational messages ; ; /get_format if set, return the format used for the bright star catalogue ; OUTPUTS: ; star array; type: SMEI_STAR_LIST structure ; if 'name' NOT specified: ; all stars in the selected catalogues ; if 'name' specified: ; array of length n_elements(name) ; OPTIONAL OUTPUT PARAMETERS: ; count=count scalar; type: integer ; # stars in return array 'star' ; rmstar=rmstar array; type: byte ; 0: star should be fitted but not subtracted from skymap ; 1: star should be fitted and subtracted from skymap ; INCLUDE: @compile_opt.pro ; On error, return to caller ; CALLS: ; InitVar, IsType, txt_read, who_am_i, where_common, smei_star_info ; SIDE EFFECT: ; If one or more of the stars on the input list 'name' are not present ; in the catalogue the procedure will abort (after printing the names ; of the offending stars). ; EXTERNAL: ; smei_star_list__define ; RESTRICTIONS: ; Small declinations (-1 0 reads, cstar, tmp, format=all_frmts rmtmp = replicate(all_rmstar[i],nrec) CASE count OF 0 : BEGIN star = tmp rmstar = rmtmp END ELSE: BEGIN star = [star ,tmp ] rmstar = [rmstar,rmtmp] END ENDCASE count += nrec ENDIF ENDFOR CASE count OF 0 : BEGIN star = one_star destroyvar, rmstar END ELSE: BEGIN ; Remove duplicate entries by removing duplicate names names = smei_star_info(star, /get_name) tmp = uniq(names,sort(names)) n_duplicate = count-n_elements(tmp) IF n_duplicate NE 0 THEN BEGIN message, /info, 'removed '+strcompress(n_duplicate,/rem)+' duplicate stars (same name)' nn = where_common(indgen(count),tmp,absent=absent) IF absent[0] NE -1 THEN print, 'Duplicate names: '+strjoin(strtrim(names[absent]),', ') ENDIF star = star [tmp] rmstar = rmstar[tmp] count = n_elements(star) ; If names of stars were specified as input, extract them from the full catalogue IF IsType(name, /defined) THEN BEGIN ; tmp : indices into array 'name' for stars present in catalogues ; inref: indices in catalogue array 'cat' tmp = where_common( $ strlowcase(strtrim(smei_star_alias(name) )) , $ strlowcase(strtrim(smei_star_info(star,/get_name))) , $ count=count, inref=inref, absent=absent) ; Abort if some of the stars on the input list are not in ; in the catalogue IF absent[0] NE -1 THEN BEGIN message, /info, 'Star(s) not in catalogue: '+strjoin(strtrim(name[absent]),', ') message, 'either remove these stars from the input, or add them to the star catalogue' ENDIF ; Extract the stars from the input list. ; Note that since we made sure that all input stars are in the catalogue ; 'star' will contain the same number of elements as input 'name'. CASE count OF 0: BEGIN star = one_star destroyvar, rmstar END ELSE: BEGIN star = star [inref] rmstar = rmstar[inref] END ENDCASE ENDIF END ENDCASE RETURN, star & END