text:
.. -*- mode: rst -*-

Figures and Axes
================

This document is an open letter to the PyData community, particularly those that are involved in matplotlib development. We'd like to get some advice on the API choice we've made and thoughts about our use of the matplotlib Axes objects.

One of the most complex parts of designing a visualization library around matplotlib is working with figures and axes. As defined in `The Lifecycle of a Plot <https://matplotlib.org/tutorials/introductory/lifecycle.html>`_, these central objects of matplotlib plots are as follows:

- A Figure is the final image that may contain 1 or more Axes.
- An Axes represents an individual plot

Based on these definitions and and the advice to "try to use the object-oriented interface over the pyplot interface", the Yellowbrick interface is designed to wrap a matplotlib ``axes.Axes``. We propose the following general use case for most visualizers:

.. code:: python

    import matplotlib.pyplot as plt
    from yellowbrick import Visualizer, quick_visualizer

    fig, ax = plt.subplots()

    # Object oriented approach
    viz = Visualizer(ax=ax)
    viz.fit(X, y)
    viz.poof()

    # Quick method approach
    viz = quick_visualizer(X, y, ax=ax)
    viz.poof()

This design allows users to more directly control the size, style, and interaction with the plot (though YB does provide some helpers for these as well). For example, if a user wanted to generate a report with multiple visualizers for a classification problem, it may looks something like:

.. code:: python

    import matplotlib.pyplot as plt

    from yellowbrick.features import FeatureImportances
    from yellowbrick.classifier import ConfusionMatrix, ClassificationReport, ROCAUC
    from sklearn.linear_model import LogisticRegression

    fig, axes = plot.subplots(2, 2)

    model = LogisticRegression()
    visualgrid = [
        FeatureImportances(ax=axes[0][0]),
        ConfusionMatrix(model, ax=axes[0][1]),
        ClassificationReport(model, ax=axes[1][0]),
        ROCAUC(model, ax=axes[1][1]),
    ]

    for viz in visualgrid:
        viz.fit(X_train, y_train)
        viz.score(X_test, y_test)
        viz.finalize()

    plt.show()

This is a common use case and we're working on the idea of "visual pipelines" to support this type of development because, for machine learning, users generally want a suite of visualizers or a report, not just a single visualization. The API requirement to support this has therefore been that visualizers use the ``ax`` object passed to them and not ``plt``. If the user does not pass a specific ``ax`` then the global current axes is used via ``plt.gca``. Generally, visualizers should behave as though they are a plot that as part of a larger figure.

Visualizers are getting more complex, however, and some are becoming multi-axes plots in their own right. For example:

- The ResidualsPlot has a scatter plot axes and a histogram axes
- The JointPlot has a scatter plot and two histogram axes
- Data driven scatter plot axes often have colorbar axes
- The PCA plot has scatter plot, color bar, and heatmap axes
- The confusion matrix probability histogram is a grid of axes for each class pair
- The ICDM has an inset axes that acts as a dynamic legend

Although it would have been easier to simply embed the figure into the visualizer and use a ``GridSpec`` or other layout tool, the focus on ensuring visualizers are individual plots that wrap an Axes has made us bend over backward to adjust the plot inside of the axes area that was originally supplied, primarily by using ``make_axes_locateable``, which is part of the AxesGrid toolkit.

Generally, it appears that the `AxesGrid Toolkit <https://matplotlib.org/mpl_toolkits/axes_grid/users/overview.html#imagegrid>`_ is the right tool for Yellowbrick - many of the examples shown are similar to the things that Yellowbrick is trying to do. However, this package is not fully documented with examples and some helper utilities that would be useful, for example the ``ImageGrid``, still require a ``figure.Figure`` object.

At this point we are left with some important questions about Yellowbrick's development roadmap:

1. Like Seaborn, should YB have two classes of visualizer, one that wraps an axes and one that wraps a figure?
2. Should we go all in on the AxesGrid toolkit and continue to restrict our use of the figure, will this method be supported in the long run?

Other notes and discussion:

- `Create equal aspect (square) plot with multiple axes when data limits are different? <https://stackoverflow.com/questions/54545758/create-equal-aspect-square-plot-with-multiple-axes-when-data-limits-are-differ>`_


text:
/** @method StoreMigrator.prototype.perform Perform the next step of the migration as specified by the action option
 * @public
 * @param {FS.Store} oldStore The store to be migrated
 * @param {FS.Store} newStore The new store
 * @returns {undefined} The migration will continue asynchronously after this method has returned
 */

FS.Collection.StoreMigrator.prototype.perform = function (oldStore, newStore) {

  var self = this;

  if(!self.collection())
    throw new Meteor.Error('FS.Collection.StoreMigrator.perform no bound collection');

  var collection = self.collection(),
      debug = self.debug;

  if(debug) {
    console.log('StoreMigrator.perform self: ' + !!self);
    console.log('StoreMigrator.perform self.collectionName: ' + self.collectionName);
    console.log('StoreMigrator.perform collection: ' + !!collection);
    console.log('StoreMigrator.perform collection.name: ' + collection.name);
  }

   // Validate collection and stores

  if (!collection || collection.name != self.collectionName) {
    throw new Meteor.Error('StoreMigrator.perform ' + self.collectionName, 'bad collection');
  }

  if (oldStore && oldStore.name !== self.oldName) {
    throw new Meteor.Error('StoreMigrator.perform ' + self.collectionName, 'bad store: ' + self.oldName);
  }

  if (newStore && newStore.name !== self.newName) {
    throw new Meteor.Error('StoreMigrator.perform ' + self.collectionName, 'bad store: ' + self.newName);
  }

  var name = collection.name;

  var copyStore = function () {

    debug && console.log('StoreMigrator.perform.copyStore ' + name + ' action: ' + self.action + ' rate(bytes/s): ' + self.rate);

    if(self.rate) {
      var ThrottleGroup = Npm.require('stream-throttle').ThrottleGroup,
        throttleGroup = new ThrottleGroup({rate: self.rate});
    }

    var completed = 0;
    var files = collection.find();
    var fileCount = files.count();

    debug && console.log('StoreMigrator.perform.copyStore ' + name + ' files: ', files.count());

    var copyFile = function (fileObj, index, done) {

      if( (fileObj.copies[self.newName] && fileObj.copies[self.newName].size === 0 )) {

        debug && console.log('StoreMigrator.perform.copyStore ' + name + ' migrating: ', fileObj.copies[self.newName].key);
        var readStream = fileObj.createReadStream();
        var writeStream = fileObj.createWriteStream(self.newName);

        writeStream.on('finish', Meteor.bindEnvironment(function() {
          debug && console.log('StoreMigrator.perform.copyStore ' + name + ' finished: ' + fileObj.copies[self.newName].key);
          if(++completed === fileCount)
            console.log('StoreMigrator.perform.copyStore ' + name + ' COMPLETED all files copied');
          done();
        }));

        if(self.rate) {

          readStream.pipe(throttleGroup.throttle()).pipe(writeStream);
        } else {
          readStream.pipe(writeStream);
        }

      } else {
        debug && console.log('StoreMigrator.perform.copyStore ' + name + ' skipping: ', fileObj.copies[self.newName].key);
      }
    }

    if (self.maxProcessing) {
      debug && console.log('StoreMigrator.perform.copyStore ' + name + ' queue max processes: ' + self.maxProcessing);

      var queue = new PowerQueue({
        name: name,
        maxProcessing: self.maxProcessing
      });

      if(debug) {
        queue.onEnded = function() {
          console.log('StoreMigrator.perform.copyStore ' + name + ' process queue ended ');
        }
      }

      files.forEach(function(fileObj, index) {
        queue.add(function(done) {
          copyFile(fileObj, index, done);
        });
      });
    } else {
      files.forEach(function(fileObj, index) {
        copyFile(fileObj, index, function() {});
      });
    }
  }

  var purgeStore = function () {
    debug && console.log('StoreMigrator.perform.purgeStore ' + name + ' action', self.action);

    var oldCopiesQuery = {};
    oldCopiesQuery['copies.' + self.oldName] = { $exists: true};
    var oldStoreCount = collection.find(oldCopiesQuery).count();

    var newCopiesQuery = {};
    newCopiesQuery['copies.' + self.newName] = { $exists: true}
    var newStoreCount = collection.find(newCopiesQuery).count();

    debug && console.log('StoreMigrator.perform.purgeStore ' + name + ' oldStoreCount: ', oldStoreCount);
    debug && console.log('StoreMigrator.perform.purgeStore ' + name + ' newStoreCount: ', newStoreCount);

    if(oldStoreCount && newStoreCount >= oldStoreCount) {

      // Files have been moved to the new store
      debug && console.log('StoreMigrator.perform.purgeStore name: ' + name + ' deleting copies.' + self.oldName);
      fields = {};
      fields['copies.' + self.oldName] = '';

      collection.update(oldCopiesQuery, {$unset: fields}, {multi: true}, function (error, count) {
        if(error)
          throw new Meteor.Error('FS.Collection ' + name,
                             'MoveStore action: ' + self.action  + ' purge failed');
        else
          console.log('StoreMigrator.perform.purgeStore ' + name + ' COMPLETED ' + count + ' files purged');

      });

    } else if (oldStoreCount && newStoreCount < oldStoreCount){
      throw new Meteor.Error('FS.Collection ' + name,
                             'MoveStore action: ' + self.action
                              + '; BAD oldStoreCount: ' + oldStoreCount
                              + ' newStoreCount: ' + newStoreCount);

    } else {
      debug && console.log('StoreMigrator.perform.purgeStore NO ACTION necessary');
    }
  }

  debug && console.log('StoreMigrator.perform action: ' + self.action
                    + ' oldName: ' + self.oldName + ' newName: ' + self.newName
                    + ' stores: ', Object.keys(collection.storesLookup));

  if (self.action === 'copy') {
    if (Object.keys(collection.storesLookup).length !== 2)
      throw new Meteor.Error('StoreMigrator.perform ' + self.collectionName,
                             'action: ' + self.action + '; bad collection storesLookup');

    if (!oldStore || !newStore)
      throw new Meteor.Error('StoreMigrator.perform ' + self.collectionName,
                             'action: ' + self.action + '; needs both stores');

    copyStore()

  } else if (self.action === 'purge') {
    if (Object.keys(collection.storesLookup).length !== 1)
      throw new Meteor.Error('StoreMigrator.perform ' + self.collectionName,
                             'action: ' + self.action + '; bad collection storesLookup');

    if(Object.keys(collection.storesLookup)[0] != self.newName)
      throw new Meteor.Error('StoreMigrator.perform ' + self.collectionName,
                             'action: ' + self.action + '; bad collection store');

    if (self.oldStore)
      throw new Meteor.Error('StoreMigrator.perform ' + self.collectionName,
                             'action: ' + self.action + '; oldStore is defined');

    purgeStore();

  } else if (self.action === 'none') {
    if (Object.keys(collection.storesLookup).length !== 1)
      throw new Meteor.Error('StoreMigrator.perform ' + self.collectionName,
                             'action: ' + self.action + '; bad collection storesLookup');

    if(Object.keys(collection.storesLookup)[0] != self.oldName)
      throw new Meteor.Error('StoreMigrator.perform ' + self.collectionName,
                             'action: ' + self.action + '; bad collection store');

    console.log('StoreMigrator.perform ' + name + ' action', self.action);

  } else if (self.action === 'done') {

    if (Object.keys(collection.storesLookup).length !== 1)
      throw new Meteor.Error('StoreMigrator.perform ' + self.collectionName,
                             'action: ' + self.action + '; bad collection storesLookup');

    if(Object.keys(collection.storesLookup)[0] != self.newName)
      throw new Meteor.Error('StoreMigrator.perform ' + self.collectionName,
                             'action: ' + self.action + '; bad collection store');

    console.log('StoreMigrator.perform ' + name + ' action', self.action);

  } else {
    throw new Meteor.Error('StoreMigrator.perform ' + self.collectionName,
                             'action: ' + self.action + '; bad action');
  }

}

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>Enum Dacs7ConnectionState
   </title>
    <meta name="viewport" content="width=device-width">
    <meta name="title" content="Enum Dacs7ConnectionState
   ">
    <meta name="generator" content="docfx 2.45.1.0">

    <link rel="shortcut icon" href="../favicon.ico">
    <link rel="stylesheet" href="../styles/docfx.vendor.css">
    <link rel="stylesheet" href="../styles/docfx.css">
    <link rel="stylesheet" href="../styles/main.css">
    <link rel="text/javascript" href="../styles/encrypter.js">
    <meta property="docfx:navrel" content="../toc.html">
    <meta property="docfx:tocrel" content="../toc.html">

              <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
                Toggle navigation

              </button>

              <form class="navbar-form navbar-right" role="search" id="search">

                  <input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">

              </form>

Enum Dacs7ConnectionState

Namespace:Dacs7

Assembly:Dacs7.dll

Syntax

public enum Dacs7ConnectionState

Fields

                    Name
                    Description

                    Closed

                    Connecting

                    Opened

Extension Methods

                  Converter.SetSwap<Dacs7ConnectionState>(IFormatProvider)

                  Converter.SetNoSwap<Dacs7ConnectionState>()

                  Converter.ToByteArray<Dacs7ConnectionState>(Int32)

                    View Source

              Back to top

            Copyright © Benjamin Proemmer


text:
"""
Base package for the gmtmodernize program.
"""
from ._version import get_versions
from .conversion import modernize

__version__ = get_versions()['version']
del get_versions

def test(doctest=True, verbose=True, coverage=False):
    """
    Run the test suite.

    Uses `py.test <http://pytest.org/>`__ to discover and run the tests. If you
    haven't already, you can install it with `conda
    <http://conda.pydata.org/>`__ or `pip <https://pip.pypa.io/en/stable/>`__.

    Parameters:

    * doctest : bool
        If ``True``, will run the doctests as well (code examples that start
        with a ``>>>`` in the docs).
    * verbose : bool
        If ``True``, will print extra information during the test run.
    * coverage : bool
        If ``True``, will run test coverage analysis on the code as well.
        Requires ``pytest-cov``.

    Raises:

    * ``AssertionError`` if pytest returns a non-zero error code indicating
      that some tests have failed.

    """
    import pytest
    args = []
    if verbose:
        args.append('-vv')
    if coverage:
        args.append('--cov=gmtmodernize')
        args.append('--cov-report=term-missing')
    if doctest:
        args.append('--doctest-modules')
    args.append('--pyargs')
    args.append('gmtmodernize')
    status = pytest.main(args)
    assert status == 0, "Some tests have failed."


text:
import UndoStore from "../src/stores/UndoStore";
import TaskStore from "../src/stores/TaskStore";
import UndoActions from "../src/actions/UndoActions";
import TaskActions from "../src/actions/TaskActions";

import analytics from "../src/analytics";

describe("UndoStore", () => {
	let state;
	let tasks;

	function updateState() {
		state = UndoStore.getState();
		tasks = TaskStore.getState().tasks;
	}

	it("is initially empty", () => {
		updateState();

		expect(state.latestItem).toEqual(null);
	});

	it("create an item on deleteTask", () => {
		jasmine.clock().install();

		TaskActions.createTask("My Task", true);

		updateState();

		TaskActions.deleteTask(tasks[0].id);

		updateState();

		expect(state.latestItem.type).toBe("DELETE_TASK");
		expect(state.latestItem.message).toEqual(jasmine.any(String));

		jasmine.clock().tick(10001);

		updateState();

		expect(state.latestItem).toBe(null);
	});

	it("will undo an item", () => {
		TaskActions.createTask("My Task", true);
		updateState();
		TaskActions.deleteTask(tasks[0].id);
		updateState();

		spyOn(analytics, "sendEvent");
		spyOn(TaskActions, "createTask");

		UndoActions.undo(state.latestItem);

		updateState();

		expect(state.latestItem).toBe(null);
		expect(analytics.sendEvent).toHaveBeenCalledWith("undo", "DELETE_TASK");
		expect(TaskActions.createTask).toHaveBeenCalledWith("My Task", true);
	});
});


text:
<?php

namespace App\AAS_Bundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * MedicalCommission
 */
class MedicalCommission
{
    /**
     * @var integer
     */
    private $id;

    /**
     * @var \DateTime
     */
    private $completion_date;

    /**
     * @var \App\AAS_Bundle\Entity\Person
     */
    private $person;

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set completion_date
     *
     * @param \DateTime $completionDate
     * @return MedicalCommission
     */
    public function setCompletionDate($completionDate)
    {
        $this->completion_date = $completionDate;

        return $this;
    }

    /**
     * Get completion_date
     *
     * @return \DateTime
     */
    public function getCompletionDate()
    {
        return $this->completion_date;
    }

    /**
     * Set person
     *
     * @param \App\AAS_Bundle\Entity\Person $person
     * @return MedicalCommission
     */
    public function setPerson(\App\AAS_Bundle\Entity\Person $person = null)
    {
        $this->person = $person;

        return $this;
    }

    /**
     * Get person
     *
     * @return \App\AAS_Bundle\Entity\Person
     */
    public function getPerson()
    {
        return $this->person;
    }

    //////////////////////////////////////////////////////////////////////////////////////////////////
    public function getDayWarning()
    {
        $date = new \DateTime();
//        $date->sub(new \DateInterval('P30D'));
//        $date->add(new \DateInterval('P30D'));

        return date_diff($date,$this->getCompletionDate())->days;
    }
    //////////////////////////////////////////////////////////////////////////////////////////////////
    /**
     * @var \DateTime
     */
    private $updated_at;

    /**
     * Set updated_at
     *
     * @param \DateTime $updatedAt
     * @return MedicalCommission
     */
    public function setUpdatedAt($updatedAt)
    {
        $this->updated_at = $updatedAt;

        return $this;
    }

    /**
     * Get updated_at
     *
     * @return \DateTime
     */
    public function getUpdatedAt()
    {
        return $this->updated_at;
    }

    /**
     * @ORM\PreUpdate
     */
    public function setUpdatedAtValue()
    {
        $this->updated_at = new \DateTime();
    }
}