:param curr_frag:
481414
def zoom_out_frag(self, curr_frag):
        
        level = curr_frag[1]
        frag = curr_frag[0]
        output = []
        if level > 0:
            str_level = str(level)
            high_frag = self.spec_level[str_level]["fragments_dict"][frag][
                "super_index"
            ]
            new_level = level + 1
            output = (high_frag, new_level)
        else:
            output = curr_frag
        return output
369900
def read(self, obj):
        
        path, frag = [], obj
        for part in self.parts:
            path.append(part)
            if isinstance(frag, dict):
                try:
                    frag = frag[part]
                except KeyError as error:
                    raise NotFound(':'.join(path)) from error
            elif isinstance(frag, (list, tuple)):
                try:
                    frag = frag[int(part)]
                except IndexError as error:
                    raise NotFound(':'.join(path)) from error
                except ValueError as error:
                    raise WrongType(':'.join(path)) from error
            elif isinstance(frag, (str, int)):
                raise WrongType(':'.join(path))
            else:
                raise NotFound(':'.join(path))
        return frag
157632
def proc_modscag(fn_list, extent=None, t_srs=None):
    
    #Use cubic spline here for improve upsampling 
    ds_list = warplib.memwarp_multi_fn(fn_list, res='min', extent=extent, t_srs=t_srs, r='cubicspline')
    stack_fn = os.path.splitext(fn_list[0])[0] + '_' + os.path.splitext(os.path.split(fn_list[-1])[1])[0] + '_stack_%i' % len(fn_list) 
    #Create stack here - no need for most of mastack machinery, just make 3D array
    #Mask values greater than 100% (clouds, bad pixels, etc)
    ma_stack = np.ma.array([np.ma.masked_greater(iolib.ds_getma(ds), 100) for ds in np.array(ds_list)], dtype=np.uint8)

    stack_count = np.ma.masked_equal(ma_stack.count(axis=0), 0).astype(np.uint8)
    stack_count.set_fill_value(0)
    stack_min = ma_stack.min(axis=0).astype(np.uint8)
    stack_min.set_fill_value(0)
    stack_max = ma_stack.max(axis=0).astype(np.uint8)
    stack_max.set_fill_value(0)
    stack_med = np.ma.median(ma_stack, axis=0).astype(np.uint8)
    stack_med.set_fill_value(0)

    out_fn = stack_fn + '_count.tif'
    iolib.writeGTiff(stack_count, out_fn, ds_list[0])
    out_fn = stack_fn + '_max.tif'
    iolib.writeGTiff(stack_max, out_fn, ds_list[0])
    out_fn = stack_fn + '_min.tif'
    iolib.writeGTiff(stack_min, out_fn, ds_list[0])
    out_fn = stack_fn + '_med.tif'
    iolib.writeGTiff(stack_med, out_fn, ds_list[0])

    ds = gdal.Open(out_fn)
    return ds
773446
function toy(frag, cb) {
  const canvas = document.body.appendChild(document.createElement('canvas'))
  const gl     = context(canvas, render)
  const shader = Shader(gl, vert, frag)
  const fitter = fit(canvas)

  render.update = update
  render.resize = fitter
  render.shader = shader
  render.canvas = canvas
  render.gl     = gl

  window.addEventListener('resize', fitter, false)
  return render

  function render() {
    const width  = gl.drawingBufferWidth
    const height = gl.drawingBufferHeight
    gl.viewport(0, 0, width, height)

    shader.bind()
    cb(gl, shader)
    triangle(gl)
  }

  function update(frag) {
    shader.update(vert, frag)
  }
}
590911
def write(self, obj, value, merge=False):
        
        full = deepcopy(obj)
        frag = full

        parts, last = self.parts[:-1], self.parts[-1]
        for part in parts:
            if isinstance(frag, dict):
                frag = frag[part]
            elif isinstance(frag, (list, tuple)):
                frag = frag[int(part)]

        if isinstance(frag, dict):
            if last in frag and merge:
                frag[last].update(value)
            else:
                frag[last] = value
        elif isinstance(frag, list):
            if last == '-':
                frag.append(value)
            else:
                frag[int(last)] = value

        return full
522369
function afterManip( elem, fragClone, callback ) {
		// Provides cloned fragment ready for fixup prior to and after insertion into DOM
		var content = fragClone.nodeType === 11 ?
			jQuery.makeArray(fragClone.childNodes) :
			fragClone.nodeType === 1 ? [fragClone] : [];

		// Return fragment to original caller (e.g. append) for DOM insertion
		callback.call( elem, fragClone );

		// Fragment has been inserted:- Add inserted nodes to tmplItem data structure. Replace inserted element annotations by jQuery.data.
		storeTmplItems( content );
		cloneIndex++;
	}
1252628
def _sameFrag(f, g):
    

    if (hasattr(f, 'cbDefn') or hasattr(g, 'cbDefn')
        or hasattr(f, 'lineBreak') or hasattr(g, 'lineBreak')): return 0
    for a in ('fontName', 'fontSize', 'textColor', 'backColor', 'rise', 'underline', 'strike', 'link'):
        if getattr(f, a, None) != getattr(g, a, None): return 0
    return 1
752434
def round(unit = :sec)
      next_unit = self.ceil(unit)
      this_unit = self.floor(unit)
      (self - this_unit) < (next_unit - self) ? this_unit : next_unit
    end
492311
def run_qc(_, data, out_dir):
    
    if cwlutils.is_cwl_run(data):
        qc_data = run_peddy([data], out_dir)
        if tz.get_in(["summary", "qc", "peddy"], qc_data):
            return tz.get_in(["summary", "qc", "peddy"], qc_data)
351414
def parse_info_frags(info_frags):
    

    new_scaffolds = {}
    with open(info_frags, "r") as info_frags_handle:
        current_new_contig = None
        for line in info_frags_handle:
            if line.startswith(">"):
                current_new_contig = str(line[1:-1])
                new_scaffolds[current_new_contig] = []
            elif line.startswith("init_contig"):
                pass
            else:
                (init_contig, id_frag, orientation, pos_start, pos_end) = str(
                    line[:-1]
                ).split("\t")
                start = int(pos_start)
                end = int(pos_end)
                ori = int(orientation)
                fragid = int(id_frag)
                assert start < end
                assert ori in {-1, 1}
                new_scaffolds[current_new_contig].append(
                    [init_contig, fragid, start, end, ori]
                )

    return new_scaffolds
1294308
def wrapModel(self, model):
        
        res = IResource(model, None)
        if res is None:
            frag = INavigableFragment(model)
            fragmentName = getattr(frag, 'fragmentName', None)
            if fragmentName is not None:
                fragDocFactory = self._getDocFactory(fragmentName)
                if fragDocFactory is not None:
                    frag.docFactory = fragDocFactory
            if frag.docFactory is None:
                raise CouldNotLoadFromThemes(frag, self._preferredThemes())
            useAthena = isinstance(frag, (athena.LiveFragment, athena.LiveElement))
            return self._wrapNavFrag(frag, useAthena)
        else:
            return res
1258046
def frac(x, context=None):
    
    return _apply_function_in_current_context(
        BigFloat,
        mpfr.mpfr_frac,
        (BigFloat._implicit_convert(x),),
        context,
    )
392217
def hrepr_with_resources(self, obj, **cfg):
        
        res = self(obj, **cfg)
        res.resources = self.resources
        return res
865271
def fragment(self, fragsize=1392):
        """"""
        fnb = 0
        fl = self
        lst = list()
        while fl.underlayer is not None:
            fnb += 1
            fl = fl.underlayer

        for p in fl:
            s = raw(p[fnb].payload)
            nb = (len(s) + fragsize) // fragsize
            for i in range(nb):
                q = p.copy()
                del q[fnb].payload
                q[fnb].len = SOMEIP.LEN_OFFSET_TP + \
                    len(s[i * fragsize:(i + 1) * fragsize])
                q[fnb].more_seg = 1
                if i == nb - 1:
                    q[fnb].more_seg = 0
                q[fnb].offset += i * fragsize // 16
                r = conf.raw_layer(load=s[i * fragsize:(i + 1) * fragsize])
                r.overload_fields = p[fnb].payload.overload_fields.copy()
                q.add_payload(r)
                lst.append(q)

        return lst
192435
def urldefragauth(url):
    
    scheme, netloc, path, params, query, fragment = urlparse(url)

    # see func:`prepend_scheme_if_needed`
    if not netloc:
        netloc, path = path, netloc

    netloc = netloc.rsplit('@', 1)[-1]

    return urlunparse((scheme, netloc, path, params, query, ''))
342786
def setup_multiifo_interval_coinc_inj(workflow, hdfbank, full_data_trig_files, inj_trig_files,
                                      stat_files, background_file, veto_file, veto_name,
                                      out_dir, pivot_ifo, fixed_ifo, tags=None):
    
    if tags is None:
        tags = []
    make_analysis_dir(out_dir)
    logging.info('Setting up coincidence for injections')

    if len(hdfbank) != 1:
        raise ValueError('Must use exactly 1 bank file for this coincidence '
                         'method, I got %i !' % len(hdfbank))
    hdfbank = hdfbank[0]

    # Wall time knob and memory knob
    factor = int(workflow.cp.get_opt_tags('workflow-coincidence', 'parallelization-factor', tags))

    ffiles = {}
    ifiles = {}
    for ifo, ffi in zip(*full_data_trig_files.categorize_by_attr('ifo')):
        ffiles[ifo] = ffi[0]
    for ifo, ifi in zip(*inj_trig_files.categorize_by_attr('ifo')):
        ifiles[ifo] = ifi[0]

    injinj_files = FileList()
    injfull_files = FileList()
    fullinj_files = FileList()
    # For the injfull and fullinj separation we take the pivot_ifo on one side,
    # and the rest that are attached to the fixed_ifo on the other side
    for ifo in ifiles:  # ifiles is keyed on ifo
        if ifo == pivot_ifo:
            injinj_files.append(ifiles[ifo])
            injfull_files.append(ifiles[ifo])
            fullinj_files.append(ffiles[ifo])
        else:
            injinj_files.append(ifiles[ifo])
            injfull_files.append(ffiles[ifo])
            fullinj_files.append(ifiles[ifo])

    combo = [(injinj_files, "injinj"),
             (injfull_files, "injfull"),
             (fullinj_files, "fullinj"),
            ]
    bg_files = {'injinj':[], 'injfull':[], 'fullinj':[]}

    for trig_files, ctag in combo:
        findcoinc_exe = PyCBCFindMultiifoCoincExecutable(workflow.cp,
                                                         'multiifo_coinc',
                                                         ifos=ifiles.keys(),
                                                         tags=tags + [ctag],
                                                         out_dir=out_dir)
        for i in range(factor):
            group_str = '%s/%s' % (i, factor)
            coinc_node = findcoinc_exe.create_node(trig_files, hdfbank,
                                                   stat_files,
                                                   veto_file, veto_name,
                                                   group_str,
                                                   pivot_ifo,
                                                   fixed_ifo,
                                                   tags=[veto_name, str(i)])

            bg_files[ctag] += coinc_node.output_files
            workflow.add_node(coinc_node)

    logging.info('...leaving coincidence for injections')

    return setup_multiifo_statmap_inj(workflow, ifiles.keys(), bg_files, background_file, out_dir, tags=tags + [veto_name])
177334
def fix_sec_nseg(secs, dL):
    

    for secName in secs:
        secs[secName]['geom']['nseg'] = 1 + 2 * int(secs[secName]['geom']['L'] / (2*dL))