NAME:
           _parse_hz
        PURPOSE:
           Parse the various input options for Sigma* functions
        HISTORY:
           2016-12-27 - Written - Bovy (UofT/CCA)
16915
def _parse_hz(self,hz,Hz,dHzdz):
        
        if isinstance(hz,dict):
            hz= [hz]
        try:
            nhz= len(hz)
        except TypeError:
            hz= [hz]
            Hz= [Hz]
            dHzdz= [dHzdz]
            nhz= 1
        if nhz != self._nsigma and nhz != 1:
            raise ValueError('Number of hz functions needs to be equal to the number of Sigma functions or to 1')
        if nhz == 1 and self._nsigma > 1:
            hz= [hz[0] for ii in range(self._nsigma)]
            if not isinstance(hz[0],dict):
                Hz= [Hz[0] for ii in range(self._nsigma)]
                dHzdz= [dHzdz[0] for ii in range(self._nsigma)]
        self._Hz= Hz
        self._hz= hz
        self._dHzdz= dHzdz       
        self._nhz= len(self._hz)
        if isinstance(hz[0],dict):
            self._hz_dict= copy.copy(hz)
            self._parse_hz_dict()
        else:
            self._hz_dict= None
        return None
28505
def _parse_name(name: str, as_qvm: bool, noisy: bool) -> Tuple[str, str, bool]:
    
    parts = name.split('-')
    if len(parts) >= 2 and parts[-2] == 'noisy' and parts[-1] in ['qvm', 'pyqvm']:
        if as_qvm is not None and (not as_qvm):
            raise ValueError("The provided qc name indicates you are getting a noisy QVM, "
                             "but you have specified `as_qvm=False`")

        if noisy is not None and (not noisy):
            raise ValueError("The provided qc name indicates you are getting a noisy QVM, "
                             "but you have specified `noisy=False`")

        qvm_type = parts[-1]
        noisy = True
        prefix = '-'.join(parts[:-2])
        return prefix, qvm_type, noisy

    if len(parts) >= 1 and parts[-1] in ['qvm', 'pyqvm']:
        if as_qvm is not None and (not as_qvm):
            raise ValueError("The provided qc name indicates you are getting a QVM, "
                             "but you have specified `as_qvm=False`")
        qvm_type = parts[-1]
        if noisy is None:
            noisy = False
        prefix = '-'.join(parts[:-1])
        return prefix, qvm_type, noisy

    if as_qvm is not None and as_qvm:
        qvm_type = 'qvm'
    else:
        qvm_type = None

    if noisy is None:
        noisy = False

    return name, qvm_type, noisy
1065018
function PC2Parser () {
  Dissolve.call(this)

  // Read header(32 bytes)
  this.string('cacheSignatureString', 11).tap(checkEqual('cacheSignatureString', 'POINTCACHE2'))
  this.uint8('zero').tap(checkEqual('zero', 0))
  this.uint32le('fileVersion').tap(checkEqual('fileVersion', 1))
  this.uint32le('numPoints') // Number of points per sample
  this.floatle('startFrame') // First sampled frame
  this.floatle('sampleRate') // How frequently to sample (or skip) the frames
  this.uint32le('numSamples') // How many samples are stored in this file

  // Read raw data for positions
  this.tap(function () {
    this.vars.numFrames = this.vars.numSamples / this.vars.sampleRate
    this.buffer('raw', this.vars.numFrames * this.vars.numPoints * 12)
  })

  // Organize positions as nested, anonymous arrays
  // (could not do it with "loop")
  this.tap(function () {
    var raw = this.vars.raw
    delete this.vars.raw

    // "for frame in range(startFrame, startFrame+numSamples, sampleRate)"
    this.vars.frames = []
    for (var idx = 0; idx < this.vars.numFrames; idx++) {
      this.vars.frames.push(pointsArray(raw, idx * this.vars.numPoints * 12, this.vars.numPoints))
    }
  })

  // Read from buffer "buf", starting at position "offset", an array of "numPoints" positions (arrays of 3 floats)
  function pointsArray (buf, offset, numPoints) {
    var pointsData = []
    for (var i = offset; i < offset + numPoints * 12; i += 12) {
      pointsData.push([buf.readFloatLE(i + 0), buf.readFloatLE(i + 4), buf.readFloatLE(i + 8)])
    }
    return pointsData
  }

  // Emit result ("this" is a Transform stream)
  this.tap(function () {
    this.push(this.vars)
  })
}
897167
function(read_wav_file_obj, wav_input_filename, spec, cb_when_done) {

    // console.log("TTT ___ read_16_bit_wav_file_into_32_bit_float_buffer ___ ");

    // ---

    var property_buffer_raw_input_file = "buffer_raw_input_file";
    var property_buffer_input_file     = "buffer_input_file";

    read_wav_file_obj.filename = wav_input_filename;

    read_wav_file_obj[property_buffer_raw_input_file] = new Buffer(0);

    // console.log("name cb cb_parse_buffer_as_wav_format ", cb_parse_buffer_as_wav_format.name);
    // console.log("name cb cb_when_done ", cb_when_done.name);

    read_file_into_buffer(read_wav_file_obj, property_buffer_raw_input_file,
                                    property_buffer_input_file,
                                    cb_parse_buffer_as_wav_format,
                                    cb_when_done);

    // console.log("BBB ___ read_16_bit_wav_file_into_32_bit_float_buffer ___ ");

}
767121
function parseChunk(expected, cursor) {
    var type, length;

    type = cursor.toString('ascii', 4);
    length = cursor.readUInt32BE();

    if (type !== expected) {
        throw new error.MIDIParserError(
            type,
            expected,
            cursor.tell()
        );
    }

    return cursor.slice(length);
}
896155
def parse(self, fo):
        
        motifs = []

        pwm = []
        info = {}
        for line in fo.readlines():
            if line.startswith("#"):
                vals =  line.strip()[1:].split(" = ")
                if len(vals) > 1:
                    info[vals[0]] = vals[1]
            elif len(line) > 1:
                pwm.append([float(x) for x in line.strip().split("\t")])
            else:
                motifs.append(Motif())
                motifs[-1].consensus = info["Consensus"]
                motifs[-1].width = info["W"]
                motifs[-1].id = info["ID"]
                motifs[-1].pwm = pwm[:]
                pwm = []
            
        return motifs
1126775
def _read(self, fh, fname):
        """"""
        if fname in self._timers:
            raise self.Error("Cannot overwrite timer associated to: %s " % fname)

        def parse_line(line):
            """Parse single line."""
            name, vals = line[:25], line[25:].split()
            try:
                ctime, cfract, wtime, wfract, ncalls, gflops = vals
            except ValueError:
                # v8.3 Added two columns at the end [Speedup, Efficacity]
                ctime, cfract, wtime, wfract, ncalls, gflops, speedup, eff = vals

            return AbinitTimerSection(name, ctime, cfract, wtime, wfract, ncalls, gflops)

        data = {}
        inside, has_timer = 0, False
        for line in fh:
            #print(line.strip())
            if line.startswith(self.BEGIN_TAG):
                has_timer = True
                sections = []
                info = {}
                inside = 1
                line = line[len(self.BEGIN_TAG):].strip()[:-1]

                info["fname"] = fname
                for tok in line.split(","):
                    key, val = [s.strip() for s in tok.split("=")]
                    info[key] = val

            elif line.startswith(self.END_TAG):
                inside = 0
                timer = AbinitTimer(sections, info, cpu_time, wall_time)
                mpi_rank = info["mpi_rank"]
                data[mpi_rank] = timer

            elif inside:
                inside += 1
                line = line[1:].strip()

                if inside == 2:
                    d = dict()
                    for tok in line.split(","):
                        key, val = [s.strip() for s in tok.split("=")]
                        d[key] = float(val)
                    cpu_time, wall_time = d["cpu_time"], d["wall_time"]

                elif inside > 5:
                    sections.append(parse_line(line))

                else:
                    try:
                        parse_line(line)
                    except:
                        parser_failed = True

                    if not parser_failed:
                        raise self.Error("line should be empty: " + str(inside) + line)

        if not has_timer:
            raise self.Error("%s: No timer section found" % fname)

        # Add it to the dict
        self._timers[fname] = data
818656
def _parse_siz_segment(cls, fptr):
        
        offset = fptr.tell() - 2

        read_buffer = fptr.read(2)
        length, = struct.unpack('>H', read_buffer)

        read_buffer = fptr.read(length - 2)
        data = struct.unpack_from('>HIIIIIIIIH', read_buffer)

        rsiz = data[0]
        if rsiz not in _KNOWN_PROFILES:
            msg = "Invalid profile: (Rsiz={rsiz}).".format(rsiz=rsiz)
            warnings.warn(msg, UserWarning)

        xysiz = (data[1], data[2])
        xyosiz = (data[3], data[4])
        xytsiz = (data[5], data[6])
        xytosiz = (data[7], data[8])

        # Csiz is the number of components
        Csiz = data[9]

        data = struct.unpack_from('>' + 'B' * (length - 36 - 2),
                                  read_buffer, offset=36)

        bitdepth = tuple(((x & 0x7f) + 1) for x in data[0::3])
        signed = tuple(((x & 0x80) > 0) for x in data[0::3])
        xrsiz = data[1::3]
        yrsiz = data[2::3]

        for j, subsampling in enumerate(zip(xrsiz, yrsiz)):
            if 0 in subsampling:
                msg = ("Invalid subsampling value for component {comp}: "
                       "dx={dx}, dy={dy}.")
                msg = msg.format(comp=j, dx=subsampling[0], dy=subsampling[1])
                warnings.warn(msg, UserWarning)

        try:
            num_tiles_x = (xysiz[0] - xyosiz[0]) / (xytsiz[0] - xytosiz[0])
            num_tiles_y = (xysiz[1] - xyosiz[1]) / (xytsiz[1] - xytosiz[1])
        except ZeroDivisionError:
            msg = ("Invalid tile specification:  "
                   "size of {num_tile_rows} x {num_tile_cols}, "
                   "offset of {row_offset} x {col_offset}.")
            msg = msg.format(num_tile_rows=xytsiz[1],
                             num_tile_cols=xytsiz[0],
                             row_offset=xytosiz[1],
                             col_offset=xytosiz[0])
            warnings.warn(msg, UserWarning)
        else:
            numtiles = math.ceil(num_tiles_x) * math.ceil(num_tiles_y)
            if numtiles > 65535:
                msg = "Invalid number of tiles: ({numtiles})."
                msg = msg.format(numtiles=numtiles)
                warnings.warn(msg, UserWarning)

        kwargs = {
            'rsiz': rsiz,
            'xysiz': xysiz,
            'xyosiz': xyosiz,
            'xytsiz': xytsiz,
            'xytosiz': xytosiz,
            'Csiz': Csiz,
            'bitdepth': bitdepth,
            'signed': signed,
            'xyrsiz': (xrsiz, yrsiz),
            'length': length,
            'offset': offset
        }
        segment = SIZsegment(**kwargs)

        # Need to keep track of the number of components from SIZ for
        # other segments.
        cls._csiz = Csiz

        return segment
405768
def parse_vhdl(text):
  '''
  '''
  lex = VhdlLexer
  
  name = None
  kind = None
  saved_type = None
  end_param_group = False
  cur_package = None

  metacomments = []
  parameters = []
  param_items = []

  generics = []
  ports = []
  sections = []
  port_param_index = 0
  last_item = None
  array_range_start_pos = 0

  objects = []
  
  for pos, action, groups in lex.run(text):
    if action == 'metacomment':
      realigned = re.sub(r'^#+', lambda m: ' ' * len(m.group(0)), groups[0])
      if last_item is None:
        metacomments.append(realigned)
      else:
        last_item.desc = realigned
    if action == 'section_meta':
      sections.append((port_param_index, groups[0]))

    elif action == 'function':
      kind = 'function'
      name = groups[0]
      param_items = []
      parameters = []
    elif action == 'procedure':
      kind = 'procedure'
      name = groups[0]
      param_items = []
      parameters = []
    elif action == 'param':
      if end_param_group:
        # Complete previous parameters
        for i in param_items:
          parameters.append(i)
        param_items = []
        end_param_group = False

      param_items.append(VhdlParameter(groups[1]))
    elif action == 'param_type':
      mode, ptype = groups
      
      if mode is not None:
        mode = mode.strip()
      
      for i in param_items: # Set mode and type for all pending parameters
        i.mode = mode
        i.data_type = ptype

      end_param_group = True

    elif action == 'param_default':
      for i in param_items:
        i.default_value = groups[0]

    elif action == 'end_subprogram':
      # Complete last parameters
      for i in param_items:
        parameters.append(i)
        
      if kind == 'function':
        vobj = VhdlFunction(name, cur_package, parameters, groups[0], metacomments)
      else:
        vobj = VhdlProcedure(name, cur_package, parameters, metacomments)
      
      objects.append(vobj)
    
      metacomments = []
      parameters = []
      param_items = []
      kind = None
      name = None

    elif action == 'component':
      kind = 'component'
      name = groups[0]
      generics = []
      ports = []
      param_items = []
      sections = []
      port_param_index = 0

    elif action == 'generic_param':
      param_items.append(groups[0])

    elif action == 'generic_param_type':
      ptype = groups[0]
      
      for i in param_items:
        generics.append(VhdlParameter(i, 'in', ptype))
      param_items = []
      last_item = generics[-1]

    elif action == 'port_param':
      param_items.append(groups[0])
      port_param_index += 1

    elif action == 'port_param_type':
      mode, ptype = groups

      for i in param_items:
        ports.append(VhdlParameter(i, mode, ptype))

      param_items = []
      last_item = ports[-1]

    elif action == 'port_array_param_type':
      mode, ptype = groups
      array_range_start_pos = pos[1]

    elif action == 'array_range_end':
      arange = text[array_range_start_pos:pos[0]+1]

      for i in param_items:
        ports.append(VhdlParameter(i, mode, ptype + arange))

      param_items = []
      last_item = ports[-1]

    elif action == 'end_component':
      vobj = VhdlComponent(name, cur_package, ports, generics, dict(sections), metacomments)
      objects.append(vobj)
      last_item = None
      metacomments = []

    elif action == 'package':
      objects.append(VhdlPackage(groups[0]))
      cur_package = groups[0]
      kind = None
      name = None

    elif action == 'type':
      saved_type = groups[0]

    elif action in ('array_type', 'file_type', 'access_type', 'record_type', 'range_type', 'enum_type', 'incomplete_type'):
      vobj = VhdlType(saved_type, cur_package, action, metacomments)
      objects.append(vobj)
      kind = None
      name = None
      metacomments = []

    elif action == 'subtype':
      vobj = VhdlSubtype(groups[0], cur_package, groups[1], metacomments)
      objects.append(vobj)
      kind = None
      name = None
      metacomments = []

    elif action == 'constant':
      vobj = VhdlConstant(groups[0], cur_package, groups[1], metacomments)
      objects.append(vobj)
      kind = None
      name = None
      metacomments = []

  return objects
218094
def retreive_sigma_mu_data(self):
        
        fle = h5py.File(os.path.join(BASE_PATH,
                                     "KothaEtAl2019_SigmaMu_Fixed.hdf5"), "r")
        self.mags = fle["M"][:]
        self.dists = fle["R"][:]
        self.periods = fle["T"][:]
        self.pga = fle["PGA"][:]
        self.pgv = fle["PGV"][:]
        self.s_a = fle["SA"][:]
        fle.close()
432603
def setInstrumentParameters(self,instrpars):
        
        pri_header = self._image[0].header

        if self._isNotValid (instrpars['gain'], instrpars['gnkeyword']):
            instrpars['gnkeyword'] = None
        if self._isNotValid (instrpars['rdnoise'], instrpars['rnkeyword']):
            instrpars['rnkeyword'] = None
        if self._isNotValid (instrpars['exptime'], instrpars['expkeyword']):
            instrpars['expkeyword'] = 'EXPTIME'

        # We need to treat Read Noise and Gain as a special case since it is
        # not populated in the SBC primary header for the MAMA
        for chip in self.returnAllChips(extname=self.scienceExt):
            chip._gain      = 1.0 #self.getInstrParameter("", pri_header,
                                  #                  instrpars['gnkeyword'])
            chip._rdnoise   = 0.0 #self.getInstrParameter("", pri_header,
                                  #                   instrpars['rnkeyword'])
            chip._exptime   = self.getInstrParameter(instrpars['exptime'], pri_header,
                                                     instrpars['expkeyword'])
            if chip._exptime is None:
                print('ERROR: invalid instrument task parameter')
                raise ValueError

        # We need to determine if the user has used the default readnoise/gain value
        # since if not, they will need to supply a gain/readnoise value as well
        usingDefaultGain = instrpars['gnkeyword'] is None
        usingDefaultReadnoise = instrpars['rnkeyword'] is None

        # Set the default readnoise or gain values based upon the amount of user input given.

        # Case 1: User supplied no gain or readnoise information
        if usingDefaultReadnoise and usingDefaultGain:
            # Set the default gain and readnoise values
            self._setSBCchippars()
        # Case 2: The user has supplied a value for gain
        elif usingDefaultReadnoise and not usingDefaultGain:
            # Set the default readnoise value
            self._setDefaultSBCReadnoise()
        # Case 3: The user has supplied a value for readnoise
        elif not usingDefaultReadnoise and usingDefaultGain:
            # Set the default gain value
            self._setDefaultSBCGain()
        else:
            # In this case, the user has specified both a gain and readnoise values.  Just use them as is.
            pass
1194566
def _get_stddevs(self, C, stddev_types, num_sites):
        
        assert all(stddev_type in self.DEFINED_FOR_STANDARD_DEVIATION_TYPES
                   for stddev_type in stddev_types)

        # Using a frequency independent value of sigma as recommended
        # in the caption of Table 2 of Atkinson (2010)
        stddevs = [0.26/np.log10(np.e) + np.zeros(num_sites)]

        return stddevs
1183628
def _parse_sensor_record(self, sensor_data_rec, sensor_info, rem_values):
        
        val_idx = 0

        # @TODO seems there is only a single field in each of these
        assert len(sensor_data_rec.field) == 1
        sensor_data_array = sensor_data_rec.field[0].content

        # there is probably not going to be a count in the def, it'll be in the data
        count = None
        count_text = sensor_data_array.elementCount.text
        if count_text:
            count = int(count_text.strip())

        if not count:
            count = int(rem_values[val_idx])
            val_idx += 1

        parsed = []

        for recnum in range(count):
            cur = []

            for f in sensor_data_array.elementType.field:
                cur_val = rem_values[val_idx]
                val_idx += 1

                m = Member(name=f.name, standard=f.content.definition)

                if hasattr(f.content, "uom"):
                    m["units"] = f.content.uom

                try:
                    m["value"] = float(cur_val)
                except ValueError:
                    m["value"] = cur_val

                if len(f.quality):
                    m["quality"] = []
                    for qual in f.quality:
                        cur_qual = rem_values[val_idx]
                        val_idx += 1

                        # @TODO check this against constraints
                        m["quality"].append(cur_qual)

                cur.append(m)

            parsed.append(cur)

        return parsed, val_idx
333512
def parse_vhdl_file(fname):
  '''
  '''
  with open(fname, 'rt') as fh:
    text = fh.read()
  return parse_vhdl(text)
937284
def _parse_pi_par_names(self):
        
        if self.prior_information.shape[0] == 0:
            return
        if "names" in self.prior_information.columns:
            self.prior_information.pop("names")
        if "rhs" in self.prior_information.columns:
            self.prior_information.pop("rhs")
        def parse(eqs):
            raw = eqs.split('=')
            rhs = float(raw[1])
            raw = [i for i in re.split('[###]',
                    raw[0].lower().strip().replace(' + ','###').replace(' - ','###')) if i != '']
            # in case of a leading '-' or '+'
            if len(raw[0]) == 0:
                raw = raw[1:]
            # pnames = []
            # for r in raw:
            #     if '*' not in r:
            #         continue
            #     pname =  r.split('*')[1].replace("log(", '').replace(')', '').strip()
            #     pnames.append(pname)
            # return pnames
            return [r.split('*')[1].replace("log(",'').replace(')','').strip() for r in raw if '*' in r]

        self.prior_information.loc[:,"names"] =\
            self.prior_information.equation.apply(lambda x: parse(x))
469422
def _get_stddevs(self, coeffs, stddev_types, num_sites):
        
        stddevs = []
        for stddev_type in stddev_types:
            assert stddev_type in self.DEFINED_FOR_STANDARD_DEVIATION_TYPES
            stddevs.append(coeffs['sigma'] + np.zeros(num_sites))
        return np.array(stddevs)
375341
def parse_cutadapt_logs(self, f):
        
        fh = f['f']
        regexes = {
            '1.7': {
                'bp_processed': "Total basepairs processed:\s*([\d,]+) bp",
                'bp_written': "Total written \(filtered\):\s*([\d,]+) bp",
                'quality_trimmed': "Quality-trimmed:\s*([\d,]+) bp",
                'r_processed': "Total reads processed:\s*([\d,]+)",
                'r_with_adapters': "Reads with adapters:\s*([\d,]+)"
            },
            '1.6': {
                'r_processed': "Processed reads:\s*([\d,]+)",
                'bp_processed': "Processed bases:\s*([\d,]+) bp",
                'r_trimmed': "Trimmed reads:\s*([\d,]+)",
                'quality_trimmed': "Quality-trimmed:\s*([\d,]+) bp",
                'bp_trimmed': "Trimmed bases:\s*([\d,]+) bp",
                'too_short': "Too short reads:\s*([\d,]+)",
                'too_long': "Too long reads:\s*([\d,]+)",
            }
        }
        s_name = None
        cutadapt_version = '1.7'
        log_section = None
        for l in fh:
            # New log starting
            if 'cutadapt' in l:
                s_name = None
                c_version = re.match(r'This is cutadapt ([\d\.]+)', l)
                if c_version:
                    try:
                        assert(StrictVersion(c_version.group(1)) <= StrictVersion('1.6'))
                        cutadapt_version = '1.6'
                    except:
                        cutadapt_version = '1.7'
                c_version_old = re.match(r'cutadapt version ([\d\.]+)', l)
                if c_version_old:
                    try:
                        assert(StrictVersion(c_version.group(1)) <= StrictVersion('1.6'))
                        cutadapt_version = '1.6'
                    except:
                        # I think the pattern "cutadapt version XX" is only pre-1.6?
                        cutadapt_version = '1.6'
            # Get sample name from end of command line params
            if l.startswith('Command line parameters'):
                s_name = l.split()[-1]
                # Manage case where sample name is '-' (reading from stdin)
                if s_name == '-':
                    s_name = f['s_name']
                else:
                    s_name = self.clean_s_name(s_name, f['root'])
                if s_name in self.cutadapt_data:
                    log.debug("Duplicate sample name found! Overwriting: {}".format(s_name))
                self.cutadapt_data[s_name] = dict()

            if s_name is not None:
                self.add_data_source(f, s_name)

                # Search regexes for overview stats
                for k, r in regexes[cutadapt_version].items():
                    match = re.search(r, l)
                    if match:
                        self.cutadapt_data[s_name][k] = int(match.group(1).replace(',', ''))

                # Starting a new section
                if '===' in l:
                    log_section = l.strip().strip('=').strip()

                # Histogram showing lengths trimmed
                if 'length' in l and 'count' in l and 'expect' in l:
                    plot_sname = s_name
                    if log_section is not None:
                        plot_sname = '{} - {}'.format(s_name, log_section)
                    self.cutadapt_length_counts[plot_sname] = dict()
                    self.cutadapt_length_exp[plot_sname] = dict()
                    self.cutadapt_length_obsexp[plot_sname] = dict()
                    # Nested loop to read this section while the regex matches
                    for l in fh:
                        r_seqs = re.search("^(\d+)\s+(\d+)\s+([\d\.]+)", l)
                        if r_seqs:
                            a_len = int(r_seqs.group(1))
                            self.cutadapt_length_counts[plot_sname][a_len] = int(r_seqs.group(2))
                            self.cutadapt_length_exp[plot_sname][a_len] = float(r_seqs.group(3))
                            if float(r_seqs.group(3)) > 0:
                                self.cutadapt_length_obsexp[plot_sname][a_len] = float(r_seqs.group(2)) / float(r_seqs.group(3))
                            else:
                                # Cheating, I know. Infinity is difficult to plot.
                                self.cutadapt_length_obsexp[plot_sname][a_len] = float(r_seqs.group(2))
                        else:
                            break

        # Calculate a few extra numbers of our own
        for s_name, d in self.cutadapt_data.items():
            if 'bp_processed' in d and 'bp_written' in d:
                self.cutadapt_data[s_name]['percent_trimmed'] = (float(d['bp_processed'] - d['bp_written']) / d['bp_processed']) * 100
            elif 'bp_processed' in d and 'bp_trimmed' in d:
                self.cutadapt_data[s_name]['percent_trimmed'] = ((float(d.get('bp_trimmed', 0)) + float(d.get('quality_trimmed', 0))) / d['bp_processed']) * 100