Plot requested profiles
434908
def _plot_rprof_list(sdat, lovs, rprofs, metas, stepstr, rads=None):
    """"""
    if rads is None:
        rads = {}
    for vfig in lovs:
        fig, axes = plt.subplots(ncols=len(vfig), sharey=True)
        axes = [axes] if len(vfig) == 1 else axes
        fname = 'rprof_'
        for iplt, vplt in enumerate(vfig):
            xlabel = None
            for ivar, rvar in enumerate(vplt):
                fname += rvar + '_'
                rad = rads[rvar] if rvar in rads else rprofs['r']
                if conf.rprof.depth:
                    rad = rprofs['bounds'][1] - rad
                axes[iplt].plot(rprofs[rvar], rad,
                                conf.rprof.style,
                                label=metas[rvar].description)
                if conf.rprof.depth:
                    axes[iplt].invert_yaxis()
                if xlabel is None:
                    xlabel = metas[rvar].kind
                elif xlabel != metas[rvar].kind:
                    xlabel = ''
            if ivar == 0:
                xlabel = metas[rvar].description
            if xlabel:
                _, unit = sdat.scale(1, metas[rvar].dim)
                if unit:
                    xlabel += ' ({})'.format(unit)
                axes[iplt].set_xlabel(xlabel)
            if vplt[0][:3] == 'eta':  # list of log variables
                axes[iplt].set_xscale('log')
            axes[iplt].set_xlim(left=conf.plot.vmin, right=conf.plot.vmax)
            if ivar:
                axes[iplt].legend()
        ylabel = 'Depth' if conf.rprof.depth else 'Radius'
        _, unit = sdat.scale(1, 'm')
        if unit:
            ylabel += ' ({})'.format(unit)
        axes[0].set_ylabel(ylabel)
        misc.saveplot(fig, fname + stepstr)
546298
def print_profiles(self, w=0, cutoff=0, **print3opts):
        '''
        '''
         # get the profiles with non-zero size or count
        t = [(v, k) for k, v in _items(self._profs) if v.total > 0 or v.number > 1]
        if (len(self._profs) - len(t)) < 9:  # just show all
            t = [(v, k) for k, v in _items(self._profs)]
        if t:
            s = ''
            if self._total:
                s = ' (% of grand total)'
                c = max(cutoff, self._cutoff)
                c = int(c * 0.01 * self._total)
            else:
                c = 0
            self._printf('%s%*d profile%s:  total%s, average, and largest flat size%s:  largest object',
                         linesep, w, len(t), _plural(len(t)), s, self._incl, **print3opts)
            r = len(t)
            for v, k in _sorted(t, reverse=True):
                s = 'object%(plural)s:  %(total)s, %(avg)s, %(high)s:  %(obj)s%(lengstr)s' % v.format(self._clip_, self._total)
                self._printf('%*d %s %s', w, v.number, self._prepr(k), s, **print3opts)
                r -= 1
                if r > 1 and v.total < c:
                    c = max(cutoff, self._cutoff)
                    self._printf('%+*d profiles below cutoff (%.0f%%)', w, r, c)
                    break
            z = len(self._profs) - len(t)
            if z > 0:
                self._printf('%+*d %r object%s', w, z, 'zero', _plural(z), **print3opts)
711183
def _profile(self, frame, event, arg):
        """"""
        # c = event.startswith('c_')
        if event.startswith('c_'):
            return
        time1 = self.timer()
        frames = self.frame_stack(frame)
        if frames:
            frames.pop()
        parent_stats = self.stats
        for f in frames:
            parent_stats = parent_stats.ensure_child(f.f_code, void)
        code = frame.f_code
        frame_key = id(frame)
        # if c:
        #     event = event[2:]
        #     code = mock_code(arg.__name__)
        #     frame_key = id(arg)
        # record
        time2 = self.timer()
        self.overhead += time2 - time1
        if event == 'call':
            time = time2 - self.overhead
            self.record_entering(time, code, frame_key, parent_stats)
        elif event == 'return':
            time = time1 - self.overhead
            self.record_leaving(time, code, frame_key, parent_stats)
        time3 = self.timer()
        self.overhead += time3 - time2
95071
def plotOneInferenceRun(stats,
                        fields,
                        basename,
                        itemType="",
                        plotDir="plots",
                        ymax=100,
                        trialNumber=0):
  
  if not os.path.exists(plotDir):
    os.makedirs(plotDir)

  plt.figure()

  # plot request stats
  for field in fields:
    fieldKey = field[0] + " C0"
    plt.plot(stats[fieldKey], marker='+', label=field[1])

  # format
  plt.legend(loc="upper right")
  plt.xlabel("Input number")
  plt.xticks(range(stats["numSteps"]))
  plt.ylabel("Number of cells")
  plt.ylim(-5, ymax)
  plt.title("Activity while inferring {}".format(itemType))

  # save
  relPath = "{}_exp_{}.pdf".format(basename, trialNumber)
  path = os.path.join(plotDir, relPath)
  plt.savefig(path)
  plt.close()
60821
def plot(ID, pipeline='everest2', show=True, campaign=None):
    '''
    

    '''

    # Get the data
    time, flux = get(ID, pipeline=pipeline, campaign=campaign)

    # Remove nans
    mask = np.where(np.isnan(flux))[0]
    time = np.delete(time, mask)
    flux = np.delete(flux, mask)

    # Plot it
    fig, ax = pl.subplots(1, figsize=(10, 4))
    fig.subplots_adjust(bottom=0.15)
    ax.plot(time, flux, "k.", markersize=3, alpha=0.5)

    # Axis limits
    N = int(0.995 * len(flux))
    hi, lo = flux[np.argsort(flux)][[N, -N]]
    pad = (hi - lo) * 0.1
    ylim = (lo - pad, hi + pad)
    ax.set_ylim(ylim)

    # Show the CDPP
    from .k2 import CDPP
    ax.annotate('%.2f ppm' % CDPP(flux),
                xy=(0.98, 0.975), xycoords='axes fraction',
                ha='right', va='top', fontsize=12, color='r', zorder=99)

    # Appearance
    ax.margins(0, None)
    ax.set_xlabel("Time (BJD - 2454833)", fontsize=16)
    ax.set_ylabel("%s Flux" % pipeline.upper(), fontsize=16)
    fig.canvas.set_window_title("%s: EPIC %d" % (pipeline.upper(), ID))

    if show:
        pl.show()
        pl.close()
    else:
        return fig, ax
1366750
async def profile(self, ctx, platform, name):
        ''''''

        player = await self.client.get_player(platform, name)
        solos = await player.get_solos()

        await ctx.send("# of kills in solos for {}: {}".format(name,solos.kills.value))
274790
def plot_filter_transmissions(log, filterList):
    
    ################ > IMPORTS ################
    ## STANDARD LIB ##
    ## THIRD PARTY ##
    import matplotlib.pyplot as plt
    import numpy as np
    ## LOCAL APPLICATION ##

    ################ > VARIABLE SETTINGS ######
    ################ >ACTION(S) ################
    for filterFile in filterList:
        data = np.genfromtxt(filterFile)
        plt.plot(data[:, 0], data[:, 1])

    plt.show()
    return
781132
def load_profile(self, profile_name):
        """"""
        data = self.storage.get_user_profiles(profile_name)

        for x in data.get_user_views():
            self._graph.add_edge(int(x[0]), int(x[1]), {'weight': float(x[2])})
            self.all_records[int(x[1])] += 1

        return self._graph
715114
def plotBrokerQueue(dataTask, filename):
    """"""
    print("Plotting broker queue length for {0}.".format(filename))
    plt.figure()

    # Queue length
    plt.subplot(211)
    for fichier, vals in dataTask.items():
        if type(vals) == list:
            timestamps = list(map(datetime.fromtimestamp, map(int, list(zip(*vals))[0])))
            # Data is from broker
            plt.plot_date(timestamps, list(zip(*vals))[2],
                          linewidth=1.0,
                          marker='o',
                          markersize=2,
                          label=fichier)
    plt.title('Broker queue length')
    plt.ylabel('Tasks')

    # Requests received
    plt.subplot(212)
    for fichier, vals in dataTask.items():
        if type(vals) == list:
            timestamps = list(map(datetime.fromtimestamp, map(int, list(zip(*vals))[0])))
            # Data is from broker
            plt.plot_date(timestamps, list(zip(*vals))[3],
                          linewidth=1.0,
                          marker='o',
                          markersize=2,
                          label=fichier)
    plt.title('Broker pending requests')
    plt.xlabel('time (s)')
    plt.ylabel('Requests')

    plt.savefig(filename)
1029213
def plotted_data(self):
        """"""
        return InteractiveList(
            [arr for arr, val in zip(self.iter_data,
                                     cycle(slist(self.value)))
             if val is not None])
1214203
def simple_profile(self, sex=None):
        
        SEX = ["F", "M"]
        if sex not in SEX:
            sex = self.random_element(SEX)
        if sex == 'F':
            name = self.generator.name_female()
        elif sex == 'M':
            name = self.generator.name_male()
        return {
            "username": self.generator.user_name(),
            "name": name,
            "sex": sex,
            "address": self.generator.address(),
            "mail": self.generator.free_email(),
            "birthdate": self.generator.date_of_birth(),
        }
839291
def make_profile(data, out_dir, args):
    
    safe_dirs(out_dir)
    main_table = []
    header = ['id', 'ann']
    n = len(data[0])
    bar = ProgressBar(maxval=n)
    bar.start()
    bar.update(0)
    for itern, c in enumerate(data[0]):
        bar.update(itern)
        logger.debug("creating cluser: {}".format(c))
        safe_dirs(os.path.join(out_dir, c))
        valid, ann, pos_structure = _single_cluster(c, data, os.path.join(out_dir, c, "maps.tsv"), args)
        data[0][c].update({'profile': pos_structure})
        loci = data[0][c]['loci']
        data[0][c]['precursor'] = {"seq": precursor_sequence(loci[0][0:5], args.ref)}
        data[0][c]['precursor']["colors"] = _parse(data[0][c]['profile'], data[0][c]['precursor']["seq"])
        data[0][c]['precursor'].update(run_rnafold(data[0][c]['precursor']['seq']))

    return data
175597
@RequestMapping(value = "/profiles", method = RequestMethod.GET)
    public String list(Model model) {
        Profile profiles = new Profile();
        model.addAttribute("addNewProfile", profiles);
        model.addAttribute("version", Constants.VERSION);
        logger.info("Loading initial page");

        return "profiles";
    }
866634
def plot (data, pconfig=None):
    
    # Don't just use {} as the default argument as it's mutable. See:
    # http://python-guide-pt-br.readthedocs.io/en/latest/writing/gotchas/
    if pconfig is None:
        pconfig = {}

    # Allow user to overwrite any given config for this plot
    if 'id' in pconfig and pconfig['id'] and pconfig['id'] in config.custom_plot_config:
        for k, v in config.custom_plot_config[pconfig['id']].items():
            pconfig[k] = v

    # Given one dataset - turn it into a list
    if type(data) is not list:
        data = [data]

    # Smooth dataset if requested in config
    if pconfig.get('smooth_points', None) is not None:
        sumcounts = pconfig.get('smooth_points_sumcounts', True)
        for i, d in enumerate(data):
            if type(sumcounts) is list:
                sumc = sumcounts[i]
            else:
                sumc = sumcounts
            data[i] = smooth_line_data(d, pconfig['smooth_points'], sumc)

    # Add sane plotting config defaults
    for idx, yp in enumerate(pconfig.get('yPlotLines', [])):
        pconfig['yPlotLines'][idx]["width"] = pconfig['yPlotLines'][idx].get("width", 2)

    # Add initial axis labels if defined in `data_labels` but not main config
    if pconfig.get('ylab') is None:
        try:
            pconfig['ylab'] = pconfig['data_labels'][0]['ylab']
        except (KeyError, IndexError):
            pass
    if pconfig.get('xlab') is None:
        try:
            pconfig['xlab'] = pconfig['data_labels'][0]['xlab']
        except (KeyError, IndexError):
            pass

    # Generate the data dict structure expected by HighCharts series
    plotdata = list()
    for data_index, d in enumerate(data):
        thisplotdata = list()

        for s in sorted(d.keys()):

            # Ensure any overwritting conditionals from data_labels (e.g. ymax) are taken in consideration
            series_config = pconfig.copy()
            if 'data_labels' in pconfig and type(pconfig['data_labels'][data_index]) is dict:  # if not a dict: only dataset name is provided
                series_config.update(pconfig['data_labels'][data_index])

            pairs = list()
            maxval = 0
            if 'categories' in series_config:
                pconfig['categories'] = list()
                for k in d[s].keys():
                    pconfig['categories'].append(k)
                    pairs.append(d[s][k])
                    maxval = max(maxval, d[s][k])
            else:
                for k in sorted(d[s].keys()):
                    if k is not None:
                        if 'xmax' in series_config and float(k) > float(series_config['xmax']):
                            continue
                        if 'xmin' in series_config and float(k) < float(series_config['xmin']):
                            continue
                    if d[s][k] is not None:
                        if 'ymax' in series_config and float(d[s][k]) > float(series_config['ymax']):
                            continue
                        if 'ymin' in series_config and float(d[s][k]) < float(series_config['ymin']):
                            continue
                    pairs.append([k, d[s][k]])
                    try:
                        maxval = max(maxval, d[s][k])
                    except TypeError:
                        pass
            if maxval > 0 or series_config.get('hide_empty') is not True:
                this_series = { 'name': s, 'data': pairs }
                try:
                    this_series['color'] = series_config['colors'][s]
                except:
                    pass
                thisplotdata.append(this_series)
        plotdata.append(thisplotdata)

    # Add on annotation data series
    try:
        if pconfig.get('extra_series'):
            extra_series = pconfig['extra_series']
            if type(pconfig['extra_series']) == dict:
                extra_series = [[ pconfig['extra_series'] ]]
            elif type(pconfig['extra_series']) == list and type(pconfig['extra_series'][0]) == dict:
                extra_series = [ pconfig['extra_series'] ]
            for i, es in enumerate(extra_series):
                for s in es:
                    plotdata[i].append(s)
    except (KeyError, IndexError):
        pass

    # Make a plot - template custom, or interactive or flat
    try:
        return get_template_mod().linegraph(plotdata, pconfig)
    except (AttributeError, TypeError):
        if config.plots_force_flat or (not config.plots_force_interactive and len(plotdata[0]) > config.plots_flat_numseries):
            try:
                return matplotlib_linegraph(plotdata, pconfig)
            except:
                logger.error("############### Error making MatPlotLib figure! Falling back to HighCharts.")
                return highcharts_linegraph(plotdata, pconfig)
        else:
            # Use MatPlotLib to generate static plots if requested
            if config.export_plots:
                matplotlib_linegraph(plotdata, pconfig)
            # Return HTML for HighCharts dynamic plot
            return highcharts_linegraph(plotdata, pconfig)
890930
def profile(self, fields=None, sex=None):
        
        if fields is None:
            fields = []

        d = {
            "job": self.generator.job(),
            "company": self.generator.company(),
            "ssn": self.generator.ssn(),
            "residence": self.generator.address(),
            "current_location": (self.generator.latitude(), self.generator.longitude()),
            "blood_group": "".join(self.random_element(list(itertools.product(["A", "B", "AB", "O"], ["+", "-"])))),
            "website": [self.generator.url() for _ in range(1, self.random_int(2, 5))],
        }

        d = dict(d, **self.generator.simple_profile(sex))
        # field selection
        if len(fields) > 0:
            d = {k: v for k, v in d.items() if k in fields}

        return d
96238
def plot_lines(it):
    
    data = [go.Scatter(mode='lines', **d) for d in it]
    return py.iplot(data, filename='scatter-mode')
1098329
def possible_target_profiles(nickname, server, all_profiles_dict,
                             org_vm, autonomous=True, output='path'):
    
    assert output in ['path', 'name']
    profiles_in_svr = get_profiles_in_svr(nickname, server,
                                          all_profiles_dict,
                                          org_vm)
    # list of possible autonomous profiles for testing
    possible_profiles = []

    for profile_inst in profiles_in_svr:
        profile_org_name = profile_name(org_vm, profile_inst, short=True)
        if autonomous:
            if all_profiles_dict[profile_org_name].type == 'autonomous':
                possible_profiles.append(profile_inst)
        else:
            if not all_profiles_dict[profile_org_name].type == 'component':
                possible_profiles.append(profile_inst)

    if output == 'path':
        possible_profiles = [inst.path for inst in possible_profiles]
    elif output == 'name':
        possible_profiles = [profile_name(org_vm, inst)
                             for inst in possible_profiles]

    return possible_profiles