Esempio n. 1
0
def core_parameters(lines, dataFile):
    """ Given a list of data base records (one entry per transition) return python lists of the most important spectrocopic line parameters. """
    # column start/stop for all types of parameters
    if 'hit' in dataFile.lower() or 'sao' in dataFile.lower():
        iw, lw, iS, lS, iE, lE, iA, lA, isw, lsw, iT, lT, iI, lI = 3, 15, 15, 25, 45, 55, 35, 40, 40, 45, 55, 59, 2, 3
    else:
        from geisa import set_geisa_fields
        fields = set_geisa_fields(dataFile)
        for key, val in fields.items():
            exec key + '=' + repr(val)

    # now extract columns, convert to appropriate type (int/float)
    linedata = {}
    linedata['position'] = np.array([float(line[iw:lw]) for line in lines])
    #    linedata['strength'] = [float(replace(line[iS:lS],'D','e')) for line in lines]
    linedata['strength'] = np.array(
        [float(line[iS:lS].replace('D', 'e')) for line in lines])
    linedata['energy'] = np.array([float(line[iE:lE]) for line in lines])
    linedata['airWidth'] = np.array([float(line[iA:lA]) for line in lines])
    linedata['Tdep'] = np.array([float(line[iT:lT]) for line in lines])

    #    isoNr     = [int(line[iI:lI]) for line in lines]
    if 'hit' in dataFile.lower() or 'geisa' in dataFile.lower():
        linedata['selfWidth'] = np.array(
            [float(line[isw:lsw]) for line in lines])
    else:
        linedata['selfWidth'] = len(lines) * np.array(
            [0])  # a list with nLines zeros
    return linedata
Esempio n. 2
0
def core_parameters (lines, dataFile):
    """ Given a list of data base records (one entry per transition) return python lists of the most important spectrocopic line parameters. """
    # column start/stop for all types of parameters
    if 'hit' in dataFile.lower() or 'sao' in dataFile.lower():
        iw,lw, iS,lS, iE, lE, iA,lA, isw, lsw, iT,lT, iI,lI = 3,15, 15,25, 45,55, 35,40, 40,45, 55,59, 2,3
    else:
        from geisa import set_geisa_fields
        fields = set_geisa_fields (dataFile)
        for key,val in fields.items(): exec key + '=' + repr(val)

    # now extract columns, convert to appropriate type (int/float)
    linedata = {}
    linedata['position'] = np.array([float(line[iw:lw]) for line in lines])
#    linedata['strength'] = [float(replace(line[iS:lS],'D','e')) for line in lines]
    linedata['strength'] = np.array([float(line[iS:lS].replace('D','e')) for line in lines])
    linedata['energy']   = np.array([float(line[iE:lE]) for line in lines])
    linedata['airWidth'] = np.array([float(line[iA:lA]) for line in lines])
    linedata['Tdep']     = np.array([float(line[iT:lT]) for line in lines])

#    isoNr     = [int(line[iI:lI]) for line in lines]
    if 'hit' in dataFile.lower() or 'geisa' in dataFile.lower():
        linedata['selfWidth'] = np.array([float(line[isw:lsw]) for line in lines])
    else:
        linedata['selfWidth'] = len(lines)*np.array([0]) # a list with nLines zeros
    return linedata
Esempio n. 3
0
def core_parameters(lines, dataFile):
    """ Given a list of data base records (one entry per transition) return python lists of the most important spectrocopic line parameters. """
    # column start/stop for all types of parameters
    if "hit" in dataFile.lower() or "sao" in dataFile.lower():
        iw, lw, iS, lS, iE, lE, iA, lA, isw, lsw, iT, lT, iI, lI = 3, 15, 15, 25, 45, 55, 35, 40, 40, 45, 55, 59, 2, 3
    else:
        from geisa import set_geisa_fields

        fields = set_geisa_fields(dataFile)
        for key, val in fields.items():
            exec key + "=" + repr(val)
        # now extract columns, convert to appropriate type (int/float)
    positions = [float(line[iw:lw]) for line in lines]
    strengths = [float(replace(line[iS:lS], "D", "e")) for line in lines]
    energies = [float(line[iE:lE]) for line in lines]
    airWidths = [float(line[iA:lA]) for line in lines]
    tempDeps = [float(line[iT:lT]) for line in lines]
    isoNr = [int(line[iI:lI]) for line in lines]
    if "hit" in dataFile.lower() or "geisa" in dataFile.lower():
        selfWidths = [float(line[isw:lsw]) for line in lines]
    else:
        selfWidths = len(lines) * [0]  # a list with nLines zeros
    return positions, strengths, energies, airWidths, selfWidths, tempDeps, isoNr
Esempio n. 4
0
def split_molecules(lines, dataFile):
    """ Given the list of database records extracted from Hitran/Geisa, distribute the entries in separate lists for each molecule. """
    # initialize dictionary
    lineLists = {}
    if "hit" in dataFile.lower():
        mol_id = get_mol_id_nr(molecules, "hitran")  # translation dictionary: hitran molecular ID numbers --> names
        im, lm = 0, 2  # set indices for molecular id
    elif "geisa" in dataFile.lower():
        from geisa import set_geisa_fields

        fields = set_geisa_fields(dataFile)
        im, lm = fields["iM"], fields["lM"]
        mol_id = get_mol_id_nr(molecules, "geisa")  # translation dictionary: geisa molecular ID numbers --> names
        # split list of lines
    for line in lines:
        molNr = int(line[im:lm])
        molec = mol_id.get(molNr)
        if molec in lineLists:
            lineLists[molec].append(line)
        elif molec > 0:
            lineLists[molec] = [line]
        else:
            raise SystemExit, "ERROR --- extract:  unknown molecule with ID number " + ` molNr `
    return lineLists