def load_unknown_list(lines, unknwn_file=None, all=False): """ Parameters ---------- lines : list Restricted lines; use all=True for all unknwn_file : str, optional all : bool, optional Returns ------- unknwn_lines : Table """ line_dict = defs.lines() # Load line_path = arclines.__path__[0] + '/data/lists/' if unknwn_file is None: unknwn_file = line_path + 'UNKNWNs.dat' line_list = load_line_list(unknwn_file) # Cut on input lamps? if all: return line_list else: msk = np.array([False] * len(line_list)) for line in lines: line_flag = line_dict[line] match = line_list['line_flag'] % (2 * line_flag) >= line_flag msk[match] = True # Finish return line_list[msk]
def get_line_flag(ions): """ Parameters ---------- ions Returns ------- """ line_dict = defs.lines() line_flag = 0 for uion in ions: line_flag += line_dict[uion] # Return return line_flag
def purge_unknowns(line_list, write=False, tol_llist=2., verbose=True): line_dict = defs.lines() # Load unknwns = arcl_io.load_unknown_list([], all=True) mask = np.array([True] * len(unknwns)) updated = False # Loop for ss, row in enumerate(unknwns): dwv = np.abs(line_list['wave'] - row['wave']) imin = np.argmin(np.abs(dwv)) # Match? if dwv[imin] < tol_llist: line_flag = line_dict[line_list['ion'][imin]] if row['line_flag'] % (2 * line_flag) >= line_flag: mask[ss] = False updated = True if verbose: print("Will purge UNKNOWN line \n {}".format(row)) print("Matched to \n {}".format(line_list[imin])) # Write? if write and updated: arcl_io.write_line_list(unknwns[mask], unk_file)
import json import pdb from astropy.table import Table import arclines # For path src_path = arclines.__path__[0] + '/data/sources/' from arclines import plots as arcl_plots from arclines import utils as arcl_utils # Hard-coded string lengths, and more from arclines import defs str_len_dict = defs.str_len() instr_dict = defs.instruments() line_dict = defs.lines() def load(source, **kwargs): """ Parameters ---------- src_file format Returns ------- """ # Parse src_file = source['File']