text:
__version__=''' $Id: markers.py 3959 2012-09-27 14:39:39Z robin $ '''
__doc__="""This modules defines a collection of markers used in charts.
"""

from reportlab.graphics.shapes import Rect, Line, Circle, Polygon, Drawing, Group
from reportlab.graphics.widgets.signsandsymbols import SmileyFace
from reportlab.graphics.widgetbase import Widget
from reportlab.lib.validators import isNumber, isColorOrNone, OneOf, Validator
from reportlab.lib.attrmap import AttrMap, AttrMapValue
from reportlab.lib.colors import black
from reportlab.lib.utils import isClassType, isFunctionType
from reportlab.graphics.widgets.flags import Flag
from math import sin, cos, pi
_toradians = pi/180.0

class Marker(Widget):
    '''A polymorphic class of markers'''
    _attrMap = AttrMap(BASE=Widget,
                    kind = AttrMapValue(
                            OneOf(None, 'Square', 'Diamond', 'Circle', 'Cross', 'Triangle', 'StarSix',
                                'Pentagon', 'Hexagon', 'Heptagon', 'Octagon', 'StarFive',
                                'FilledSquare', 'FilledCircle', 'FilledDiamond', 'FilledCross',
                                'FilledTriangle','FilledStarSix', 'FilledPentagon', 'FilledHexagon',
                                'FilledHeptagon', 'FilledOctagon', 'FilledStarFive',
                                'Smiley','ArrowHead', 'FilledArrowHead'),
                            desc='marker type name'),
                    size = AttrMapValue(isNumber,desc='marker size'),
                    x = AttrMapValue(isNumber,desc='marker x coordinate'),
                    y = AttrMapValue(isNumber,desc='marker y coordinate'),
                    dx = AttrMapValue(isNumber,desc='marker x coordinate adjustment'),
                    dy = AttrMapValue(isNumber,desc='marker y coordinate adjustment'),
                    angle = AttrMapValue(isNumber,desc='marker rotation'),
                    fillColor = AttrMapValue(isColorOrNone, desc='marker fill colour'),
                    strokeColor = AttrMapValue(isColorOrNone, desc='marker stroke colour'),
                    strokeWidth = AttrMapValue(isNumber, desc='marker stroke width'),
                    arrowBarbDx = AttrMapValue(isNumber, desc='arrow only the delta x for the barbs'),
                    arrowHeight = AttrMapValue(isNumber, desc='arrow only height'),
                    )

    def __init__(self,*args,**kw):
        self.setProperties(kw)
        self._setKeywords(
            kind = None,
            strokeColor = black,
            strokeWidth = 0.1,
            fillColor = None,
            size = 5,
            x = 0,
            y = 0,
            dx = 0,
            dy = 0,
            angle = 0,
            arrowBarbDx = -1.25,
            arrowHeight = 1.875,
            )

    def clone(self):
        return Marker(self.__dict__.copy())

    def _Smiley(self):
        x, y = self.x+self.dx, self.y+self.dy
        d = self.size/2.0
        s = SmileyFace()
        s.fillColor = self.fillColor
        s.strokeWidth = self.strokeWidth
        s.strokeColor = self.strokeColor
        s.x = x-d
        s.y = y-d
        s.size = d*2
        return s

    def _Square(self):
        x, y = self.x+self.dx, self.y+self.dy
        d = self.size/2.0
        s = Rect(x-d,y-d,2*d,2*d,fillColor=self.fillColor,strokeColor=self.strokeColor,strokeWidth=self.strokeWidth)
        return s

    def _Diamond(self):
        d = self.size/2.0
        return self._doPolygon((-d,0,0,d,d,0,0,-d))

    def _Circle(self):
        x, y = self.x+self.dx, self.y+self.dy
        s = Circle(x,y,self.size/2.0,fillColor=self.fillColor,strokeColor=self.strokeColor,strokeWidth=self.strokeWidth)
        return s

    def _Cross(self):
        x, y = self.x+self.dx, self.y+self.dy
        s = float(self.size)
        h, s = s/2, s/6
        return self._doPolygon((-s,-h,-s,-s,-h,-s,-h,s,-s,s,-s,h,s,h,s,s,h,s,h,-s,s,-s,s,-h))

    def _Triangle(self):
        x, y = self.x+self.dx, self.y+self.dy
        r = float(self.size)/2
        c = 30*_toradians
        s = sin(30*_toradians)*r
        c = cos(c)*r
        return self._doPolygon((0,r,-c,-s,c,-s))

    def _StarSix(self):
        r = float(self.size)/2
        c = 30*_toradians
        s = sin(c)*r
        c = cos(c)*r
        z = s/2
        g = c/2
        return self._doPolygon((0,r,-z,s,-c,s,-s,0,-c,-s,-z,-s,0,-r,z,-s,c,-s,s,0,c,s,z,s))

    def _StarFive(self):
        R = float(self.size)/2
        r = R*sin(18*_toradians)/cos(36*_toradians)
        P = []
        angle = 90
        for i in range(5):
            for radius in R, r:
                theta = angle*_toradians
                P.append(radius*cos(theta))
                P.append(radius*sin(theta))
                angle = angle + 36
        return self._doPolygon(P)

    def _Pentagon(self):
        return self._doNgon(5)

    def _Hexagon(self):
        return self._doNgon(6)

    def _Heptagon(self):
        return self._doNgon(7)

    def _Octagon(self):
        return self._doNgon(8)

    def _ArrowHead(self):
        s = self.size
        h = self.arrowHeight
        b = self.arrowBarbDx
        return self._doPolygon((0,0,b,-h,s,0,b,h))

    def _doPolygon(self,P):
        x, y = self.x+self.dx, self.y+self.dy
        if x or y: P = list(map(lambda i,P=P,A=[x,y]: P[i] + A[i&1], range(len(P))))
        return Polygon(P, strokeWidth =self.strokeWidth, strokeColor=self.strokeColor, fillColor=self.fillColor)

    def _doFill(self):
        old = self.fillColor
        if old is None:
            self.fillColor = self.strokeColor
        r = (self.kind and getattr(self,'_'+self.kind[6:]) or Group)()
        self.fillColor = old
        return r

    def _doNgon(self,n):
        P = []
        size = float(self.size)/2
        for i in range(n):
            r = (2.*i/n+0.5)*pi
            P.append(size*cos(r))
            P.append(size*sin(r))
        return self._doPolygon(P)

    _FilledCircle = _doFill
    _FilledSquare = _doFill
    _FilledDiamond = _doFill
    _FilledCross = _doFill
    _FilledTriangle = _doFill
    _FilledStarSix = _doFill
    _FilledPentagon = _doFill
    _FilledHexagon = _doFill
    _FilledHeptagon = _doFill
    _FilledOctagon = _doFill
    _FilledStarFive = _doFill
    _FilledArrowHead = _doFill

    def draw(self):
        if self.kind:
            m = getattr(self,'_'+self.kind)
            if self.angle:
                _x, _dx, _y, _dy = self.x, self.dx, self.y, self.dy
                self.x, self.dx, self.y, self.dy = 0,0,0,0
                try:
                    m = m()
                finally:
                    self.x, self.dx, self.y, self.dy = _x, _dx, _y, _dy
                if not isinstance(m,Group):
                    _m, m = m, Group()
                    m.add(_m)
                if self.angle: m.rotate(self.angle)
                x, y = _x+_dx, _y+_dy
                if x or y: m.shift(x,y)
            else:
                m = m()
        else:
            m = Group()
        return m

def uSymbol2Symbol(uSymbol,x,y,color):
    if isFunctionType(uSymbol):
        symbol = uSymbol(x, y, 5, color)
    elif isClassType(uSymbol) is type and issubclass(uSymbol,Widget):
        size = 10.
        symbol = uSymbol()
        symbol.x = x - (size/2)
        symbol.y = y - (size/2)
        try:
            symbol.size = size
            symbol.color = color
        except:
            pass
    elif isinstance(uSymbol,Marker) or isinstance(uSymbol,Flag):
        symbol = uSymbol.clone()
        if isinstance(uSymbol,Marker): symbol.fillColor = symbol.fillColor or color
        symbol.x, symbol.y = x, y
    else:
        symbol = None
    return symbol

class _isSymbol(Validator):
    def test(self,x):
        return hasattr(x,'__call__') or isinstance(x,Marker) or isinstance(x,Flag) \
                or (isClassType(x) and issubclass(x,Widget))

isSymbol = _isSymbol()

def makeMarker(name,**kw):
    if Marker._attrMap['kind'].validate(name):
        m = Marker(**kw)
        m.kind = name
    elif name[-5:]=='_Flag' and Flag._attrMap['kind'].validate(name[:-5]):
        m = Flag(**kw)
        m.kind = name[:-5]
        m.size = 10
    else:
        raise ValueError("Invalid marker name %s" % name)
    return m

if __name__=='__main__':
    D = Drawing()
    D.add(Marker())
    D.save(fnRoot='Marker',formats=['pdf'], outDir='/tmp')


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.prestosql.cost;

import static com.google.common.base.Preconditions.checkArgument;
import static java.lang.Double.NaN;
import static java.lang.Double.isNaN;
import static java.lang.Double.max;
import static java.lang.Double.min;
import static java.util.stream.Stream.concat;

public class PlanNodeStatsEstimateMath
{
    private PlanNodeStatsEstimateMath()
    {}

    /**
     * Subtracts subset stats from supersets stats.
     * It is assumed that each NDV from subset has a matching NDV in superset.
     */
    public static PlanNodeStatsEstimate subtractSubsetStats(PlanNodeStatsEstimate superset, PlanNodeStatsEstimate subset)
    {
        if (superset.isOutputRowCountUnknown() || subset.isOutputRowCountUnknown()) {
            return PlanNodeStatsEstimate.unknown();
        }

        double supersetRowCount = superset.getOutputRowCount();
        double subsetRowCount = subset.getOutputRowCount();
        double outputRowCount = max(supersetRowCount - subsetRowCount, 0);

        // everything will be filtered out after applying negation
        if (outputRowCount == 0) {
            return createZeroStats(superset);
        }

        PlanNodeStatsEstimate.Builder result = PlanNodeStatsEstimate.builder();
        result.setOutputRowCount(outputRowCount);

        superset.getSymbolsWithKnownStatistics().forEach(symbol -> {
            SymbolStatsEstimate supersetSymbolStats = superset.getSymbolStatistics(symbol);
            SymbolStatsEstimate subsetSymbolStats = subset.getSymbolStatistics(symbol);

            SymbolStatsEstimate.Builder newSymbolStats = SymbolStatsEstimate.builder();

            // for simplicity keep the average row size the same as in the input
            // in most cases the average row size doesn't change after applying filters
            newSymbolStats.setAverageRowSize(supersetSymbolStats.getAverageRowSize());

            // nullsCount
            double supersetNullsCount = supersetSymbolStats.getNullsFraction() * supersetRowCount;
            double subsetNullsCount = subsetSymbolStats.getNullsFraction() * subsetRowCount;
            double newNullsCount = max(supersetNullsCount - subsetNullsCount, 0);
            newSymbolStats.setNullsFraction(min(newNullsCount, outputRowCount) / outputRowCount);

            // distinctValuesCount
            double supersetDistinctValues = supersetSymbolStats.getDistinctValuesCount();
            double subsetDistinctValues = subsetSymbolStats.getDistinctValuesCount();
            double newDistinctValuesCount;
            if (isNaN(supersetDistinctValues) || isNaN(subsetDistinctValues)) {
                newDistinctValuesCount = NaN;
            }
            else if (supersetDistinctValues == 0) {
                newDistinctValuesCount = 0;
            }
            else if (subsetDistinctValues == 0) {
                newDistinctValuesCount = supersetDistinctValues;
            }
            else {
                double supersetNonNullsCount = supersetRowCount - supersetNullsCount;
                double subsetNonNullsCount = subsetRowCount - subsetNullsCount;
                double supersetValuesPerDistinctValue = supersetNonNullsCount / supersetDistinctValues;
                double subsetValuesPerDistinctValue = subsetNonNullsCount / subsetDistinctValues;
                if (supersetValuesPerDistinctValue <= subsetValuesPerDistinctValue) {
                    newDistinctValuesCount = max(supersetDistinctValues - subsetDistinctValues, 0);
                }
                else {
                    newDistinctValuesCount = supersetDistinctValues;
                }
            }
            newSymbolStats.setDistinctValuesCount(newDistinctValuesCount);

            // range
            newSymbolStats.setLowValue(supersetSymbolStats.getLowValue());
            newSymbolStats.setHighValue(supersetSymbolStats.getHighValue());

            result.addSymbolStatistics(symbol, newSymbolStats.build());
        });

        return result.build();
    }

    public static PlanNodeStatsEstimate capStats(PlanNodeStatsEstimate stats, PlanNodeStatsEstimate cap)
    {
        if (stats.isOutputRowCountUnknown() || cap.isOutputRowCountUnknown()) {
            return PlanNodeStatsEstimate.unknown();
        }

        PlanNodeStatsEstimate.Builder result = PlanNodeStatsEstimate.builder();
        double cappedRowCount = min(stats.getOutputRowCount(), cap.getOutputRowCount());
        result.setOutputRowCount(cappedRowCount);

        stats.getSymbolsWithKnownStatistics().forEach(symbol -> {
            SymbolStatsEstimate symbolStats = stats.getSymbolStatistics(symbol);
            SymbolStatsEstimate capSymbolStats = cap.getSymbolStatistics(symbol);

            SymbolStatsEstimate.Builder newSymbolStats = SymbolStatsEstimate.builder();

            // for simplicity keep the average row size the same as in the input
            // in most cases the average row size doesn't change after applying filters
            newSymbolStats.setAverageRowSize(symbolStats.getAverageRowSize());

            newSymbolStats.setDistinctValuesCount(min(symbolStats.getDistinctValuesCount(), capSymbolStats.getDistinctValuesCount()));
            newSymbolStats.setLowValue(max(symbolStats.getLowValue(), capSymbolStats.getLowValue()));
            newSymbolStats.setHighValue(min(symbolStats.getHighValue(), capSymbolStats.getHighValue()));

            double numberOfNulls = stats.getOutputRowCount() * symbolStats.getNullsFraction();
            double capNumberOfNulls = cap.getOutputRowCount() * capSymbolStats.getNullsFraction();
            double cappedNumberOfNulls = min(numberOfNulls, capNumberOfNulls);
            double cappedNullsFraction = cappedRowCount == 0 ? 1 : cappedNumberOfNulls / cappedRowCount;
            newSymbolStats.setNullsFraction(cappedNullsFraction);

            result.addSymbolStatistics(symbol, newSymbolStats.build());
        });

        return result.build();
    }

    private static PlanNodeStatsEstimate createZeroStats(PlanNodeStatsEstimate stats)
    {
        PlanNodeStatsEstimate.Builder result = PlanNodeStatsEstimate.builder();
        result.setOutputRowCount(0);
        stats.getSymbolsWithKnownStatistics().forEach(symbol -> result.addSymbolStatistics(symbol, SymbolStatsEstimate.zero()));
        return result.build();
    }

    @FunctionalInterface
    private interface RangeAdditionStrategy
    {
        StatisticRange add(StatisticRange leftRange, StatisticRange rightRange);
    }

    public static PlanNodeStatsEstimate addStatsAndSumDistinctValues(PlanNodeStatsEstimate left, PlanNodeStatsEstimate right)
    {
        return addStats(left, right, StatisticRange::addAndSumDistinctValues);
    }

    public static PlanNodeStatsEstimate addStatsAndMaxDistinctValues(PlanNodeStatsEstimate left, PlanNodeStatsEstimate right)
    {
        return addStats(left, right, StatisticRange::addAndMaxDistinctValues);
    }

    public static PlanNodeStatsEstimate addStatsAndCollapseDistinctValues(PlanNodeStatsEstimate left, PlanNodeStatsEstimate right)
    {
        return addStats(left, right, StatisticRange::addAndCollapseDistinctValues);
    }

    private static PlanNodeStatsEstimate addStats(PlanNodeStatsEstimate left, PlanNodeStatsEstimate right, RangeAdditionStrategy strategy)
    {
        if (left.isOutputRowCountUnknown() || right.isOutputRowCountUnknown()) {
            return PlanNodeStatsEstimate.unknown();
        }

        PlanNodeStatsEstimate.Builder statsBuilder = PlanNodeStatsEstimate.builder();
        double newRowCount = left.getOutputRowCount() + right.getOutputRowCount();

        concat(left.getSymbolsWithKnownStatistics().stream(), right.getSymbolsWithKnownStatistics().stream())
                .distinct()
                .forEach(symbol -> {
                    SymbolStatsEstimate symbolStats = SymbolStatsEstimate.zero();
                    if (newRowCount > 0) {
                        symbolStats = addColumnStats(
                                left.getSymbolStatistics(symbol),
                                left.getOutputRowCount(),
                                right.getSymbolStatistics(symbol),
                                right.getOutputRowCount(),
                                newRowCount,
                                strategy);
                    }
                    statsBuilder.addSymbolStatistics(symbol, symbolStats);
                });

        return statsBuilder.setOutputRowCount(newRowCount).build();
    }

    private static SymbolStatsEstimate addColumnStats(SymbolStatsEstimate leftStats, double leftRows, SymbolStatsEstimate rightStats, double rightRows, double newRowCount, RangeAdditionStrategy strategy)
    {
        checkArgument(newRowCount > 0, "newRowCount must be greater than zero");

        StatisticRange leftRange = StatisticRange.from(leftStats);
        StatisticRange rightRange = StatisticRange.from(rightStats);

        StatisticRange sum = strategy.add(leftRange, rightRange);
        double nullsCountRight = rightStats.getNullsFraction() * rightRows;
        double nullsCountLeft = leftStats.getNullsFraction() * leftRows;
        double totalSizeLeft = (leftRows - nullsCountLeft) * leftStats.getAverageRowSize();
        double totalSizeRight = (rightRows - nullsCountRight) * rightStats.getAverageRowSize();
        double newNullsFraction = (nullsCountLeft + nullsCountRight) / newRowCount;
        double newNonNullsRowCount = newRowCount * (1.0 - newNullsFraction);

        // FIXME, weights to average. left and right should be equal in most cases anyway
        double newAverageRowSize = newNonNullsRowCount == 0 ? 0 : ((totalSizeLeft + totalSizeRight) / newNonNullsRowCount);

        return SymbolStatsEstimate.builder()
                .setStatisticsRange(sum)
                .setAverageRowSize(newAverageRowSize)
                .setNullsFraction(newNullsFraction)
                .build();
    }
}

redpajama_set_name: RedPajamaGithub


text:
_A community-maintained library of visualizations for Mode reports_

See [the gallery of visualizations](https://community.modeanalytics.com/gallery) included in this library.

## Quick Usage

1. Open the [HTML editor](https://help.modeanalytics.com/articles/create-advanced-layouts-and-visualizations/) in a Mode report.
2. Add `alamode.js` and `alamode.css` to your report by adding these two lines to top of your report's HTML.

	```
	<link rel="stylesheet" href="alamode.min.css">
	<script src="alamode.min.js">
	```

3. Add the customizable snippet for the chart you want to include and edit the options to fit your data.

	```
	alamode.sunburstChart(
		{
			html_element: "#sunburst-div",
	    	query_name: "My Sunburst Query",
	    	title: "A chart built with alamode",
	    	event_columns: ["event_1","event_2","event_3"],
	    	event_counts: "number_of_events"
  		}
	)
	```

## Making Changes
Great! You've created a branch and you've udpated `alamode.js` or `alamode.css` but you're probably wondering how to minify your changes and get them into production. The steps below outline how to minify your code and how to get your changes live.

### Minification
If you've made changes to `alamode.js`, in order to minify the file you'll need to use [UglifyJS2](https://github.com/mishoo/UglifyJS/tree/v2.x). Once you've followed the instructions for installation, you'll need to run the following command to minify `alamode.js` to `alamode.min.js`

```sh
uglifyjs --output alamode.min.js --compress --mangle -- alamode.js
```

If you've made changes to `alamode.css`, in order to minify the file you'll need to use [CSSO](https://github.com/css/csso). Once you've followed the instructions for installion, you'll need to run the following command to minify `alamode.css` to `alamode.min.css`

```sh
csso alamode.css --output alamode.min.css
```

### Geting to Production
Once your changes are minified, create a pull request against `master`. When your changes are approved, merge your branch into `master`.

After your changes have been merged to master, you'll need to merge your changes from `master` to a branch called `gh-pages`. `gh-pages` is our production branch and once your changes are merged to it, it will be live. Follow the commands below to merge your changes from `master` to `gh-pages`:

```sh
# from your local master branch ensure that you do a pull on master
# this ensures that the changes that you just merged are
# also on your local branch
git pull master

# switching to gh-pages branch
git checkout gh-pages
git merge master
git push
```

And that's it! Now your change to Alamode are live!


text:
var Controller = $CL.namespace("Ginger.Users.Controller");

$CL.require("Cl.Application.Mvc.AbstractController");

Controller.Index = function() {};

Controller.Index = $CL.extendClass(Controller.Index, Cl.Application.Mvc.AbstractController, {
    indexAction : function() {
        var isDummy = -1;
        if ($CL.get('user_manager').getActiveUser().get('id') === isDummy) {
            var v = $CL.get("Ginger.Users.View.Form.User");
            v.setSubmitCallback(function(formData) {
                formData['isAdmin'] = true;
                $CL.app().router.forward('users_user_create_first', {userData : formData});
            });

            v.setData({headline : $CL.translate('USERS::HEADLINE::ADD_USER'), isFirstUser : true});

            return v;
        }

    }
});


text:
<?php echo $button ?> Galeri Foto

<?php echo $button ?> Galeri Foto

                <button class="btn btn-box-tool" data-widget="collapse"></button>

            <form action="<?php echo $action; ?>" enctype="multipart/form-data" class="form-horizontal" method="post">

                    Nama <?php echo form_error('nm_galeri') ?>

                        <input type="text" class="form-control" name="nm_galeri" id="nm_galeri" placeholder="Nama" value="<?php echo $nm_galeri; ?>" />

                    Album <?php echo form_error('id_album') ?>

                        <?php echo form_dropdown(
                            'id_album',
                            $option_album,
                            set_value('id_album', isset($id_album) ? $id_album : ''),
                            'class="form-control selectFilter"  id="id_album"'
                        ); ?>

                <?php if(!empty($pic_galeri)) {?>

                        Gambar <?php echo form_error('pic_galeri') ?>

                            <img src="<?php echo base_url(); ?>uploads/foto_galeri/<?php echo $pic_galeri ?>" class="img-responsive" style="max-width: 150px;" alt=""/>

                <?php } ?>

                    Gambar <?php echo form_error('pic_galeri') ?>

                        <input type="file" name="userfile" id="userfile" class="" title="Pilih File" accept="image/*"/>

                        <input type="hidden" name="id_galeri" value="<?php echo $id_galeri; ?>" />
                        <button type="submit" class="btn btn-primary"><?php echo $button ?></button>
                        <a href="<?php echo site_url('dashboard/galeri') ?>" class="btn btn-warning">Batal

            </form>


text:
package main
import "fmt"
var x string = "Hello World"
func main() {
	fmt.Println(x)
}


text:
#ifndef MIMEINLINEFILE_H
#define MIMEINLINEFILE_H

#include "mimefile.h"

//#include "smtpexports.h"SMTP_EXPORT

class  MimeInlineFile : public MimeFile
{
public:

    /* [1] Constructors and Destructors */

    MimeInlineFile(QFile *f);
    ~MimeInlineFile();

    /* [1] --- */

    /* [2] Getters and Setters */

    /* [2] --- */

protected:

    /* [3] Protected members */

    /* [3] --- */

    /* [4] Protected methods */

    virtual void prepare();

    /* [4] --- */
};

#endif // MIMEINLINEFILE_H


text:
<!DOCTYPE html>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>colour.models Package — Colour 0.3.6 documentation</title>

    <link rel="stylesheet" href="_static/basic.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <link rel="stylesheet" href="_static/bootswatch-3.1.0/colour/bootstrap.min.css" type="text/css" />
    <link rel="stylesheet" href="_static/bootstrap-sphinx.css" type="text/css" />
    <link rel="stylesheet" href="_static/styles.css" type="text/css" />

    <link rel="top" title="Colour 0.3.6 documentation" href="index.html" />
    <link rel="up" title="colour Package" href="colour.html" />
    <link rel="next" title="colour.models.dataset Package" href="colour.models.dataset.html" />
    <link rel="prev" title="colour.io.xrite Module" href="colour.io.xrite.html" />
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">

        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">

        </button>

          Colour 0.3

colour-science.org

                   Documentation

                           API Reference

                           IPython Notebooks

                           Features

                           Contributing

    « colour.io.xrite ...

    colour.models.da... »

<form class="navbar-form navbar-right" action="search.html" method="get">

  <input type="text" name="q" class="form-control" placeholder="Search" />

  <input type="hidden" name="check_keywords" value="yes" />
  <input type="hidden" name="area" value="default" />
</form>

colour.models Package¶

Sub-Packages¶

colour.models.dataset Package

Sub-Modules

colour.models.dataset.aces Module

Academy Color Encoding System

colour.models.dataset.aces_it Module

Academy Color Encoding System - Input Transform Dataset

colour.models.dataset.adobe_rgb_1998 Module

Adobe RGB 1998 Colourspace

colour.models.dataset.adobe_wide_gamut_rgb Module

Adobe Wide Gamut RGB Colourspace

colour.models.dataset.alexa_wide_gamut_rgb Module

ALEXA Wide Gamut RGB Colourspace

colour.models.dataset.apple_rgb Module

Apple RGB Colourspace

colour.models.dataset.best_rgb Module

Best RGB Colourspace

colour.models.dataset.beta_rgb Module

Beta RGB Colourspace

colour.models.dataset.cie_rgb Module

CIE RGB Colourspace

colour.models.dataset.cinema_gamut Module

Cinema Gamut Colourspace

colour.models.dataset.color_match_rgb Module

ColorMatch RGB Colourspace

colour.models.dataset.dci_p3 Module

DCI-P3 & DCI-P3+ Colourspaces

colour.models.dataset.don_rgb_4 Module

Don RGB 4 Colourspace

colour.models.dataset.eci_rgb_v2 Module

ECI RGB v2 Colourspace

colour.models.dataset.ekta_space_ps5 Module

Ekta Space PS 5 Colourspace

colour.models.dataset.max_rgb Module

Max RGB Colourspace

colour.models.dataset.ntsc_rgb Module

NTSC RGB Colourspace

colour.models.dataset.pal_secam_rgb Module

Pal/Secam RGB Colourspace

colour.models.dataset.pointer_gamut Module

Pointer’s Gamut

colour.models.dataset.prophoto_rgb Module

ProPhoto RGB Colourspace

colour.models.dataset.rec_2020 Module

Rec. 2020 Colourspace

colour.models.dataset.rec_709 Module

Rec. 709 Colourspace

colour.models.dataset.red Module

RED Colourspaces

colour.models.dataset.russell_rgb Module

Russell RGB Colourspace

colour.models.dataset.smptec_rgb Module

SMPTE-C RGB Colourspace

colour.models.dataset.sony Module

Sony Colourspaces

colour.models.dataset.srgb Module

sRGB Colourspace

colour.models.dataset.v_gamut Module

V-Gamut Colourspace

colour.models.dataset.xtreme_rgb Module

Xtreme RGB Colourspace

Module Contents

Sub-Modules¶

colour.models.aces_it Module

Academy Color Encoding System - Input Transform

colour.models.cie_lab Module

CIE Lab Colourspace

colour.models.cie_luv Module

CIE Luv Colourspace

colour.models.cie_ucs Module

CIE UCS Colourspace

colour.models.cie_uvw Module

CIE UVW Colourspace

colour.models.cie_xyy Module

CIE xyY Colourspace

colour.models.common Module

Common Colour Models Utilities

colour.models.deprecated Module

Deprecated Colour Models Transformations

colour.models.derivation Module

RGB Colourspace Derivation

colour.models.ipt Module

IPT Colourspace

colour.models.log Module

Log Conversion

colour.models.rgb Module

RGB Colourspace & Transformations

Module Contents¶

<tt class="descclassname">colour.models.</tt><tt class="descname">XYZ_to_xyY</tt><big>(</big>XYZ, illuminant=(0.34567, 0.3585)<big>)</big>¶

Converts from CIE XYZ tristimulus values to CIE xyY colourspace and
reference illuminant.

<col class="field-name" />
<col class="field-body" />

Parameters:

XYZ (array_like) – CIE XYZ tristimulus values.

illuminant (array_like, optional) – Reference illuminant chromaticity coordinates.

Returns:
CIE xyY colourspace array.

Return type:
ndarray

Notes

Input CIE XYZ tristimulus values are in domain [0, 1].

Output CIE xyY colourspace array is in domain [0, 1].

References

<colgroup><col class="label" /><col /></colgroup>

[2]	Lindbloom, B. (2003). XYZ to xyY. Retrieved February 24, 2014,
from http://www.brucelindbloom.com/Eqn_XYZ_to_xyY.html

Examples

>>> XYZ = np.array([0.07049534, 0.10080000, 0.09558313])
>>> XYZ_to_xyY(XYZ)
array([ 0.2641477...,  0.3777000...,  0.1008    ])

<tt class="descclassname">colour.models.</tt><tt class="descname">xyY_to_XYZ</tt><big>(</big>xyY<big>)</big>¶

Converts from CIE xyY colourspace to CIE XYZ tristimulus values.

<col class="field-name" />
<col class="field-body" />

Parameters:	xyY (array_like) – CIE xyY colourspace array.

Returns:	CIE XYZ tristimulus values.

Return type:	ndarray

Notes

Input CIE xyY colourspace array is in domain [0, 1].

Output CIE XYZ tristimulus values are in domain [0, 1].

References

<colgroup><col class="label" /><col /></colgroup>

[3]	Lindbloom, B. (2009). xyY to XYZ. Retrieved February 24, 2014,
from http://www.brucelindbloom.com/Eqn_xyY_to_XYZ.html

Examples

>>> xyY = np.array([0.26414772, 0.37770001, 0.10080000])
>>> xyY_to_XYZ(xyY)
array([ 0.0704953...,  0.1008    ,  0.0955831...])

<tt class="descclassname">colour.models.</tt><tt class="descname">xy_to_xyY</tt><big>(</big>xy, Y=1<big>)</big>¶

Converts from xy chromaticity coordinates to CIE xyY colourspace by
extending the array last dimension with \(Y\) Luminance.

xy argument with last dimension being equal to 3 will be assumed to be a
CIE xyY colourspace array argument and will be returned directly by the
definition.

<col class="field-name" />
<col class="field-body" />

Parameters:

xy (array_like) – xy chromaticity coordinates or CIE xyY colourspace array.

Y (numeric, optional) – Optional \(Y\) Luminance value used to construct the CIE xyY
colourspace array, otherwise the \(Y\) Luminance will be set to 1.

Returns:
CIE xyY colourspace array.

Return type:
ndarray

See also

<tt class="xref py py-func docutils literal">xyY_to_xy()</tt>

Notes

This definition is a convenient object provided to implement support of
illuminant argument luminance value in various <tt class="xref py py-mod docutils literal">colour.models</tt>
package objects such as <tt class="xref py py-func docutils literal">colour.models.Lab_to_XYZ()</tt> or
<tt class="xref py py-func docutils literal">colour.models.Luv_to_XYZ()</tt>.

Input xy chromaticity coordinates are in domain [0, 1].

Output CIE xyY colourspace array is in domain [0, 1].

Examples

>>> xy = np.array([0.26414772, 0.37770001])
>>> xy_to_xyY(xy)
array([ 0.2641477...,  0.3777000...,  1.        ])
>>> xy = np.array([0.26414772, 0.37770001, 0.10080000])
>>> xy_to_xyY(xy)
array([ 0.2641477...,  0.3777000...,  0.1008...])
>>> xy = np.array([0.26414772, 0.37770001])
>>> xy_to_xyY(xy, 100)
array([   0.2641477...,    0.3777000...,  100.        ])

<tt class="descclassname">colour.models.</tt><tt class="descname">xyY_to_xy</tt><big>(</big>xyY<big>)</big>¶

Converts from CIE xyY colourspace to xy chromaticity coordinates.

xyY argument with last dimension being equal to 2 will be assumed to be a
xy chromaticity coordinates argument and will be returned directly by the
definition.

<col class="field-name" />
<col class="field-body" />

Parameters:	xyY (array_like) – CIE xyY colourspace array or xy chromaticity coordinates.

Returns:	xy chromaticity coordinates.

Return type:	ndarray

See also

<tt class="xref py py-func docutils literal">xy_to_xyY()</tt>

Notes

Input CIE xyY colourspace array is in domain [0, 1].

Output xy chromaticity coordinates are in domain [0, 1].

Examples

>>> xyY = np.array([0.26414772, 0.37770001, 0.10080000])
>>> xyY_to_xy(xyY)
array([ 0.2641477...,  0.3777000...])
>>> xy = np.array([0.26414772, 0.37770001])
>>> xyY_to_xy(xy)
array([ 0.2641477...,  0.3777000...])

<tt class="descclassname">colour.models.</tt><tt class="descname">xy_to_XYZ</tt><big>(</big>xy<big>)</big>¶

Returns the CIE XYZ tristimulus values from given xy chromaticity
coordinates.

<col class="field-name" />
<col class="field-body" />

Parameters:	xy (array_like) – xy chromaticity coordinates.

Returns:	CIE XYZ tristimulus values.

Return type:	ndarray

Notes

Input xy chromaticity coordinates are in domain [0, 1].

Output CIE XYZ tristimulus values are in domain [0, 1].

Examples

>>> xy = np.array([0.26414772236966133, 0.37770000704815188])
>>> xy_to_XYZ(xy)
array([ 0.6993585...,  1.        ,  0.9482453...])

<tt class="descclassname">colour.models.</tt><tt class="descname">XYZ_to_xy</tt><big>(</big>XYZ, illuminant=(0.34567, 0.3585)<big>)</big>¶

Returns the xy chromaticity coordinates from given CIE XYZ tristimulus
values.

<col class="field-name" />
<col class="field-body" />

Parameters:

XYZ (array_like) – CIE XYZ tristimulus values.

illuminant (array_like, optional) – Reference illuminant chromaticity coordinates.

Returns:
xy chromaticity coordinates.

Return type:
ndarray

Notes

Input CIE XYZ tristimulus values are in domain [0, 1].

Output xy chromaticity coordinates are in domain [0, 1].

Examples

>>> XYZ = np.array([0.07049534, 0.10080000, 0.09558313])
>>> XYZ_to_xy(XYZ)
array([ 0.2641477...,  0.3777000...])

class <tt class="descclassname">colour.models.</tt><tt class="descname">RGB_Colourspace</tt><big>(</big>name, primaries, whitepoint, illuminant=None, RGB_to_XYZ_matrix=None, XYZ_to_RGB_matrix=None, transfer_function=None, inverse_transfer_function=None<big>)</big>¶

Bases: <tt class="xref py py-class docutils literal">object</tt>

Implements support for the RGB colourspaces dataset from
<tt class="xref py py-mod docutils literal">colour.models.dataset.aces_rgb</tt>, etc....

<col class="field-name" />
<col class="field-body" />

Parameters:

name (unicode) – RGB colourspace name.

primaries (array_like) – RGB colourspace primaries.

whitepoint (array_like) – RGB colourspace whitepoint.

illuminant (unicode, optional) – RGB colourspace whitepoint name as illuminant.

RGB_to_XYZ_matrix (array_like, optional) – Transformation matrix from colourspace to CIE XYZ tristimulus values.

XYZ_to_RGB_matrix (array_like, optional) – Transformation matrix from CIE XYZ tristimulus values to colourspace.

transfer_function (object, optional) – RGB colourspace opto-electronic conversion function from linear to
colourspace.

inverse_transfer_function (object, optional) – RGB colourspace inverse opto-electronic conversion function from
colourspace to linear.

<tt class="descname">RGB_to_XYZ_matrix</tt>¶

Property for self.__to_XYZ private attribute.

<col class="field-name" />
<col class="field-body" />

Returns:	self.__to_XYZ.

Return type:	array_like, (3, 3)

<tt class="descname">XYZ_to_RGB_matrix</tt>¶

Property for self.__to_RGB private attribute.

<col class="field-name" />
<col class="field-body" />

Returns:	self.__to_RGB.

Return type:	array_like, (3, 3)

<tt class="descname">illuminant</tt>¶

Property for self.__illuminant private attribute.

<col class="field-name" />
<col class="field-body" />

Returns:	self.__illuminant.

Return type:	unicode

<tt class="descname">inverse_transfer_function</tt>¶

Property for self.__inverse_transfer_function private attribute.

<col class="field-name" />
<col class="field-body" />

Returns:	self.__inverse_transfer_function.

Return type:	object

<tt class="descname">name</tt>¶

Property for self.__name private attribute.

<col class="field-name" />
<col class="field-body" />

Returns:	self.__name.

Return type:	unicode

<tt class="descname">primaries</tt>¶

Property for self.__primaries private attribute.

<col class="field-name" />
<col class="field-body" />

Returns:	self.__primaries.

Return type:	array_like, (3, 2)

<tt class="descname">transfer_function</tt>¶

Property for self.__transfer_function private attribute.

<col class="field-name" />
<col class="field-body" />

Returns:	self.__transfer_function.

Return type:	object

<tt class="descname">whitepoint</tt>¶

Property for self.__whitepoint private attribute.

<col class="field-name" />
<col class="field-body" />

Returns:	self.__whitepoint.

Return type:	array_like

<tt class="descclassname">colour.models.</tt><tt class="descname">normalised_primary_matrix</tt><big>(</big>primaries, whitepoint<big>)</big>¶

Returns the normalised primary matrix using given primaries and
whitepoint.

<col class="field-name" />
<col class="field-body" />

Parameters:

primaries (array_like, (3, 2)) – Primaries chromaticity coordinates.

whitepoint (array_like) – Illuminant / whitepoint chromaticity coordinates.

Returns:
Normalised primary matrix.

Return type:
ndarray, (3, 3)

Examples

>>> pms = np.array([0.73470, 0.26530, 0.00000, 1.00000, 0.00010, -0.07700])
>>> whitepoint = np.array([0.32168, 0.33767])
>>> normalised_primary_matrix(pms, whitepoint)
array([[  9.5255239...e-01,   0.0000000...e+00,   9.3678631...e-05],
       [  3.4396645...e-01,   7.2816609...e-01,  -7.2132546...e-02],
       [  0.0000000...e+00,   0.0000000...e+00,   1.0088251...e+00]])

<tt class="descclassname">colour.models.</tt><tt class="descname">primaries_whitepoint</tt><big>(</big>npm<big>)</big>¶

Returns primaries and whitepoint using given normalised primary
matrix.

<col class="field-name" />
<col class="field-body" />

Parameters:	npm (array_like, (3, 3)) – Normalised primary matrix.

Returns:	Primaries and whitepoint.

Return type:	tuple

References

<colgroup><col class="label" /><col /></colgroup>

[2]	Trieu, T. (2015). Private Discussion with Mansencal, T.

Examples

>>> npm = np.array([[9.52552396e-01, 0.00000000e+00, 9.36786317e-05],
...                 [3.43966450e-01, 7.28166097e-01, -7.21325464e-02],
...                 [0.00000000e+00, 0.00000000e+00, 1.00882518e+00]])
>>> p, w = primaries_whitepoint(npm)
>>> p
array([[  7.3470000...e-01,   2.6530000...e-01],
       [  0.0000000...e+00,   1.0000000...e+00],
       [  1.0000000...e-04,  -7.7000000...e-02]])
>>> w
array([ 0.32168,  0.33767])

<tt class="descclassname">colour.models.</tt><tt class="descname">RGB_luminance_equation</tt><big>(</big>primaries, whitepoint<big>)</big>¶

Returns the luminance equation from given primaries and whitepoint.

<col class="field-name" />
<col class="field-body" />

Parameters:

primaries (array_like, (3, 2)) – Primaries chromaticity coordinates.

whitepoint (array_like) – Illuminant / whitepoint chromaticity coordinates.

Returns:
Luminance equation.

Return type:
unicode

Examples

>>> pms = np.array([0.73470, 0.26530, 0.00000, 1.00000, 0.00010, -0.07700])
>>> whitepoint = np.array([0.32168, 0.33767])
>>> # Doctests skip for Python 2.x compatibility.
>>> RGB_luminance_equation(pms, whitepoint)
'Y = 0.3439664...(R) + 0.7281660...(G) + -0.0721325...(B)'

<tt class="descclassname">colour.models.</tt><tt class="descname">RGB_luminance</tt><big>(</big>RGB, primaries, whitepoint<big>)</big>¶

Returns the luminance \(Y\) of given RGB components from given
primaries and whitepoint.

<col class="field-name" />
<col class="field-body" />

Parameters:

RGB (array_like) – RGB chromaticity coordinate matrix.

primaries (array_like, (3, 2)) – Primaries chromaticity coordinate matrix.

whitepoint (array_like) – Illuminant / whitepoint chromaticity coordinates.

Returns:
Luminance \(Y\).

Return type:
numeric or ndarray

Examples

>>> RGB = np.array([40.6, 4.2, 67.4])
>>> pms = np.array([0.73470, 0.26530, 0.00000, 1.00000, 0.00010, -0.07700])
>>> whitepoint = np.array([0.32168, 0.33767])
>>> RGB_luminance(RGB, pms, whitepoint)
12.1616018...

<tt class="descclassname">colour.models.</tt><tt class="descname">XYZ_to_Lab</tt><big>(</big>XYZ, illuminant=(0.34567, 0.3585)<big>)</big>¶

Converts from CIE XYZ tristimulus values to CIE Lab colourspace.

<col class="field-name" />
<col class="field-body" />

Parameters:

XYZ (array_like) – CIE XYZ tristimulus values.

illuminant (array_like, optional) – Reference illuminant xy chromaticity coordinates or CIE xyY
colourspace array.

Returns:
CIE Lab colourspace array.

Return type:
ndarray

Notes

Input CIE XYZ tristimulus values are in domain [0, 1].

Input illuminant xy chromaticity coordinates or CIE xyY
colourspace array are in domain [0, \(\infty\)].

Output Lightness \(L^*\) is in domain [0, 100].

References

<colgroup><col class="label" /><col /></colgroup>

[2]	Lindbloom, B. (2003). XYZ to Lab. Retrieved February 24, 2014,
from http://www.brucelindbloom.com/Eqn_XYZ_to_Lab.html

Examples

>>> XYZ = np.array([0.07049534, 0.10080000, 0.09558313])
>>> XYZ_to_Lab(XYZ)
array([ 37.9856291..., -23.6230288...,  -4.4141703...])

<tt class="descclassname">colour.models.</tt><tt class="descname">Lab_to_XYZ</tt><big>(</big>Lab, illuminant=(0.34567, 0.3585)<big>)</big>¶

Converts from CIE Lab colourspace to CIE XYZ tristimulus values.

<col class="field-name" />
<col class="field-body" />

Parameters:

Lab (array_like) – CIE Lab colourspace array.

illuminant (array_like, optional) – Reference illuminant xy chromaticity coordinates or CIE xyY
colourspace array.

Returns:
CIE XYZ tristimulus values.

Return type:
ndarray

Notes

Input Lightness \(L^*\) is in domain [0, 100].

Input illuminant xy chromaticity coordinates or CIE xyY
colourspace array are in domain [0, \(\infty\)].

Output CIE XYZ tristimulus values are in domain [0, 1].

References

<colgroup><col class="label" /><col /></colgroup>

[3]	Lindbloom, B. (2008). Lab to XYZ. Retrieved February 24, 2014,
from http://www.brucelindbloom.com/Eqn_Lab_to_XYZ.html

Examples

>>> Lab = np.array([37.98562910, -23.62302887, -4.41417036])
>>> Lab_to_XYZ(Lab)
array([ 0.0704953...,  0.1008    ,  0.0955831...])

<tt class="descclassname">colour.models.</tt><tt class="descname">Lab_to_LCHab</tt><big>(</big>Lab<big>)</big>¶

Converts from CIE Lab colourspace to CIE LCHab colourspace.

<col class="field-name" />
<col class="field-body" />

Parameters:	Lab (array_like) – CIE Lab colourspace array.

Returns:	CIE LCHab colourspace array.

Return type:	ndarray

Notes

Lightness \(L^*\) is in domain [0, 100].

References

<colgroup><col class="label" /><col /></colgroup>

[4]	Lindbloom, B. (2007). Lab to LCH(ab). Retrieved February 24, 2014,
from http://www.brucelindbloom.com/Eqn_Lab_to_LCH.html

Examples

>>> Lab = np.array([37.98562910, -23.62302887, -4.41417036])
>>> Lab_to_LCHab(Lab)
array([  37.9856291...,   24.0319036...,  190.5841597...])

<tt class="descclassname">colour.models.</tt><tt class="descname">LCHab_to_Lab</tt><big>(</big>LCHab<big>)</big>¶

Converts from CIE LCHab colourspace to CIE Lab colourspace.

<col class="field-name" />
<col class="field-body" />

Parameters:	LCHab (array_like) – CIE LCHab colourspace array.

Returns:	CIE Lab colourspace array.

Return type:	ndarray

Notes

Lightness \(L^*\) is in domain [0, 100].

References

<colgroup><col class="label" /><col /></colgroup>

[5]	Lindbloom, B. (2006). LCH(ab) to Lab. Retrieved February 24, 2014,
from http://www.brucelindbloom.com/Eqn_LCH_to_Lab.html

Examples

>>> LCHab = np.array([37.98562910, 24.03190365, 190.58415972])
>>> LCHab_to_Lab(LCHab)
array([ 37.9856291..., -23.6230288...,  -4.4141703...])

<tt class="descclassname">colour.models.</tt><tt class="descname">XYZ_to_Luv</tt><big>(</big>XYZ, illuminant=(0.34567, 0.3585)<big>)</big>¶

Converts from CIE XYZ tristimulus values to CIE Luv colourspace.

<col class="field-name" />
<col class="field-body" />

Parameters:

XYZ (array_like) – CIE XYZ tristimulus values.

illuminant (array_like, optional) – Reference illuminant xy chromaticity coordinates or CIE xyY
colourspace array.

Returns:
CIE Luv colourspace array.

Return type:
ndarray

Notes

Input CIE XYZ tristimulus values are in domain [0, 1].

Input illuminant xy chromaticity coordinates or CIE xyY
colourspace array are in domain [0, \(\infty\)].

Output \(L^*\) is in domain [0, 100].

References

<colgroup><col class="label" /><col /></colgroup>

[2]	Lindbloom, B. (2003). XYZ to Luv. Retrieved February 24, 2014,
from http://brucelindbloom.com/Eqn_XYZ_to_Luv.html

Examples

>>> XYZ = np.array([0.07049534, 0.10080000, 0.09558313])
>>> XYZ_to_Luv(XYZ)
array([ 37.9856291..., -28.7922944...,  -1.3558195...])

<tt class="descclassname">colour.models.</tt><tt class="descname">Luv_to_XYZ</tt><big>(</big>Luv, illuminant=(0.34567, 0.3585)<big>)</big>¶

Converts from CIE Luv colourspace to CIE XYZ tristimulus values.

<col class="field-name" />
<col class="field-body" />

Parameters:

Luv (array_like) – CIE Luv colourspace array.

illuminant (array_like, optional) – Reference illuminant xy chromaticity coordinates or CIE xyY
colourspace array.

Returns:
CIE XYZ tristimulus values.

Return type:
ndarray

Notes

Input \(L^*\) is in domain [0, 100].

Input illuminant xy chromaticity coordinates or CIE xyY
colourspace array are in domain [0, \(\infty\)].

Output CIE XYZ tristimulus values are in domain [0, 1].

References

<colgroup><col class="label" /><col /></colgroup>

[3]	Lindbloom, B. (2003). Luv to XYZ. Retrieved February 24, 2014,
from http://brucelindbloom.com/Eqn_Luv_to_XYZ.html

Examples

>>> Luv = np.array([37.98562910, -28.79229446, -1.35581950])
>>> Luv_to_XYZ(Luv)
array([ 0.0704953...,  0.1008    ,  0.0955831...])

<tt class="descclassname">colour.models.</tt><tt class="descname">Luv_to_uv</tt><big>(</big>Luv, illuminant=(0.34567, 0.3585)<big>)</big>¶

Returns the \(uv^p\) chromaticity coordinates from given CIE Luv
colourspace array.

<col class="field-name" />
<col class="field-body" />

Parameters:

Luv (array_like) – CIE Luv colourspace array.

illuminant (array_like, optional) – Reference illuminant xy chromaticity coordinates or CIE xyY
colourspace array.

Returns:
\(uv^p\) chromaticity coordinates.

Return type:
ndarray

Notes

Input \(L^*\) is in domain [0, 100].

Input illuminant xy chromaticity coordinates or CIE xyY
colourspace array are in domain [0, \(\infty\)].

Output \(uv^p\) chromaticity coordinates are in domain [0, 1].

References

<colgroup><col class="label" /><col /></colgroup>

[4]	Wikipedia. (n.d.). The forward transformation. Retrieved February
24, 2014, from
http://en.wikipedia.org/wiki/CIELUV#The_forward_transformation

Examples

>>> Luv = np.array([37.98562910, -28.79229446, -1.35581950])
>>> Luv_to_uv(Luv)
array([ 0.1508531...,  0.4853297...])

<tt class="descclassname">colour.models.</tt><tt class="descname">Luv_uv_to_xy</tt><big>(</big>uv<big>)</big>¶

Returns the xy chromaticity coordinates from given CIE Luv colourspace
\(uv^p\) chromaticity coordinates.

<col class="field-name" />
<col class="field-body" />

Parameters:	uv (array_like) – CIE Luv u”v” chromaticity coordinates.

Returns:	xy chromaticity coordinates.

Return type:	ndarray

Notes

Input \(uv^p\) chromaticity coordinates are in domain [0, 1].

Output xy is in domain [0, 1].

References

<colgroup><col class="label" /><col /></colgroup>

[5]	Wikipedia. (n.d.). The reverse transformation. Retrieved from
http://en.wikipedia.org/wiki/CIELUV#The_reverse_transformation

Examples

>>> uv = np.array([0.15085309882985695, 0.48532970854318019])
>>> Luv_uv_to_xy(uv)
array([ 0.2641477...,  0.3777000...])

<tt class="descclassname">colour.models.</tt><tt class="descname">Luv_to_LCHuv</tt><big>(</big>Luv<big>)</big>¶

Converts from CIE Luv colourspace to CIE LCHuv colourspace.

<col class="field-name" />
<col class="field-body" />

Parameters:	Luv (array_like) – CIE Luv colourspace array.

Returns:	CIE LCHuv colourspace array.

Return type:	ndarray

Notes

\(L^*\) is in domain [0, 100].

References

<colgroup><col class="label" /><col /></colgroup>

[6]	Lindbloom, B. (2003). Luv to LCH(uv). Retrieved February 24, 2014,
from http://www.brucelindbloom.com/Eqn_Luv_to_LCH.html

Examples

>>> Luv = np.array([37.98562910, -28.79229446, -1.35581950])
>>> Luv_to_LCHuv(Luv)
array([  37.9856291...,   28.8241993...,  182.6960474...])

<tt class="descclassname">colour.models.</tt><tt class="descname">LCHuv_to_Luv</tt><big>(</big>LCHuv<big>)</big>¶

Converts from CIE LCHuv colourspace to CIE Luv colourspace.

<col class="field-name" />
<col class="field-body" />

Parameters:	LCHuv (array_like) – CIE LCHuv colourspace array.

Returns:	CIE Luv colourspace array.

Return type:	ndarray

Notes

\(L^*\) is in domain [0, 100].

References

<colgroup><col class="label" /><col /></colgroup>

[7]	Lindbloom, B. (2006). LCH(uv) to Luv. Retrieved February 24, 2014,
from http://www.brucelindbloom.com/Eqn_LCH_to_Luv.html

Examples

>>> LCHuv = np.array([37.98562910, 28.82419933, 182.69604747])
>>> LCHuv_to_Luv(LCHuv)
array([ 37.9856291..., -28.7922944...,  -1.3558195...])

<tt class="descclassname">colour.models.</tt><tt class="descname">XYZ_to_UCS</tt><big>(</big>XYZ<big>)</big>¶

Converts from CIE XYZ tristimulus values to CIE UCS colourspace.

<col class="field-name" />
<col class="field-body" />

Parameters:	XYZ (array_like) – CIE XYZ tristimulus values.

Returns:	CIE UCS colourspace array.

Return type:	ndarray

Notes

Input CIE XYZ tristimulus values are in domain [0, 1].

Output CIE UCS colourspace array is in domain [0, 1].

Examples

>>> XYZ = np.array([0.07049534, 0.10080000, 0.09558313])
>>> XYZ_to_UCS(XYZ)
array([ 0.0469968...,  0.1008    ,  0.1637439...])

<tt class="descclassname">colour.models.</tt><tt class="descname">UCS_to_XYZ</tt><big>(</big>UVW<big>)</big>¶

Converts from CIE UCS colourspace to CIE XYZ tristimulus values.

<col class="field-name" />
<col class="field-body" />

Parameters:	UVW (array_like) – CIE UCS colourspace array.

Returns:	CIE XYZ tristimulus values.

Return type:	ndarray

Notes

Input CIE UCS colourspace array is in domain [0, 1].

Output CIE XYZ tristimulus values are in domain [0, 1].

Examples

>>> UVW = np.array([0.04699689, 0.10080000, 0.16374390])
>>> UCS_to_XYZ(UVW)
array([ 0.0704953...,  0.1008    ,  0.0955831...])

<tt class="descclassname">colour.models.</tt><tt class="descname">UCS_to_uv</tt><big>(</big>UVW<big>)</big>¶

Returns the uv chromaticity coordinates from given CIE UCS colourspace
array.

<col class="field-name" />
<col class="field-body" />

Parameters:	UVW (array_like) – CIE UCS colourspace array.

Returns:	uv chromaticity coordinates.

Return type:	ndarray

Notes

Input CIE UCS colourspace array is in domain [0, 1].

Output uv chromaticity coordinates are in domain [0, 1].

Examples

>>> UCS = np.array([0.04699689, 0.10080000, 0.16374390])
>>> UCS_to_uv(UCS)
array([ 0.1508530...,  0.3235531...])

<tt class="descclassname">colour.models.</tt><tt class="descname">UCS_uv_to_xy</tt><big>(</big>uv<big>)</big>¶

Returns the xy chromaticity coordinates from given CIE UCS colourspace
uv chromaticity coordinates.

<col class="field-name" />
<col class="field-body" />

Parameters:	uv (array_like) – CIE UCS uv chromaticity coordinates.

Returns:	xy chromaticity coordinates.

Return type:	ndarray

Notes

Input uv chromaticity coordinates are in domain [0, 1].

Output xy chromaticity coordinates are in domain [0, 1].

Examples

>>> uv = np.array([0.15085308732766581, 0.3235531372954405])
>>> UCS_uv_to_xy(uv)
array([ 0.2641477...,  0.3777000...])

<tt class="descclassname">colour.models.</tt><tt class="descname">XYZ_to_UVW</tt><big>(</big>XYZ, illuminant=(0.34567, 0.3585)<big>)</big>¶

Converts from CIE XYZ tristimulus values to CIE 1964 U*V*W*
colourspace.

<col class="field-name" />
<col class="field-body" />

Parameters:

XYZ (array_like) – CIE XYZ tristimulus values.

illuminant (array_like, optional) – Reference illuminant xy chromaticity coordinates or CIE xyY
colourspace array.

Returns:
CIE 1964 U*V*W* colourspace array.

Return type:
ndarray

Notes

Input CIE XYZ tristimulus values are in domain [0, 100].

Input illuminant xy chromaticity coordinates or CIE xyY
colourspace array are in domain [0, \(\infty\)].

Output CIE UVW colourspace array is in domain [0, 100].

Warning

The input / output domains of that definition are non standard!

Examples

>>> import numpy as np
>>> XYZ = np.array([0.07049534, 0.10080000, 0.09558313]) * 100
>>> XYZ_to_UVW(XYZ)
array([-28.0483277...,  -0.8805242...,  37.0041149...])

<tt class="descclassname">colour.models.</tt><tt class="descname">XYZ_to_IPT</tt><big>(</big>XYZ<big>)</big>¶

Converts from CIE XYZ tristimulus values to IPT colourspace.

<col class="field-name" />
<col class="field-body" />

Parameters:	XYZ (array_like) – CIE XYZ tristimulus values.

Returns:	IPT colourspace array.

Return type:	ndarray

Notes

Input CIE XYZ tristimulus values needs to be adapted for
CIE Standard Illuminant D Series D65.

Examples

>>> XYZ = np.array([0.96907232, 1, 1.12179215])
>>> XYZ_to_IPT(XYZ)
array([ 1.0030082...,  0.0190691..., -0.0136929...])

<tt class="descclassname">colour.models.</tt><tt class="descname">IPT_to_XYZ</tt><big>(</big>IPT<big>)</big>¶

Converts from IPT colourspace to CIE XYZ tristimulus values.

<col class="field-name" />
<col class="field-body" />

Parameters:	IPT (array_like) – IPT colourspace array.

Returns:	CIE XYZ tristimulus values.

Return type:	ndarray

Examples

>>> IPT = np.array([1.00300825, 0.01906918, -0.01369292])
>>> IPT_to_XYZ(IPT)
array([ 0.9690723...,  1.        ,  1.1217921...])

<tt class="descclassname">colour.models.</tt><tt class="descname">IPT_hue_angle</tt><big>(</big>IPT<big>)</big>¶

Computes the hue angle from IPT colourspace.

<col class="field-name" />
<col class="field-body" />

Parameters:	IPT (array_like) – IPT colourspace array.

Returns:	Hue angle.

Return type:	numeric or ndarray

Examples

>>> IPT = np.array([0.96907232, 1, 1.12179215])
>>> IPT_hue_angle(IPT)
0.8427358...

<tt class="descclassname">colour.models.</tt><tt class="descname">linear_to_log</tt><big>(</big>value, method=u'Cineon', **kwargs<big>)</big>¶

Converts from linear to log using given method.

<col class="field-name" />
<col class="field-body" />

Parameters:

value (numeric or array_like) – Value.

method (unicode, optional) – {‘Cineon’, ‘Panalog’, ‘ViperLog’, ‘PLog’, ‘C-Log’, ‘ACEScc’,
‘ALEXA Log C’, ‘REDLogFilm’, ‘DCI-P3’, ‘S-Log’, ‘S-Log2’, ‘S-Log3’,
‘V-Log’},
Computation method.

**kwargs (**) – Keywords arguments.

Returns:
Log value.

Return type:
numeric or ndarray

Examples

>>> linear_to_log(0.18)
0.4573196...
>>> linear_to_log(0.18, method='ACEScc')
array(0.4135884...)
>>> linear_to_log(
...     0.18, method='PLog', log_reference=400)
0.3910068...
>>> linear_to_log(0.18, method='S-Log')
0.3599878...

<tt class="descclassname">colour.models.</tt><tt class="descname">log_to_linear</tt><big>(</big>value, method=u'Cineon', **kwargs<big>)</big>¶

Converts from log to linear using given method.

<col class="field-name" />
<col class="field-body" />

Parameters:

value (numeric or array_like) – Value.

method (unicode, optional) – {‘Cineon’, ‘Panalog’, ‘ViperLog’, ‘PLog’, ‘C-Log’, ‘ACEScc’,
‘ALEXA Log C’, ‘DCI-P3’, ‘REDLogFilm’, ‘S-Log’, ‘S-Log2’, ‘S-Log3’,
‘V-Log’},
Computation method.

**kwargs (**) – Keywords arguments.

Returns:
Log value.

Return type:
numeric or ndarray

Examples

>>> log_to_linear(0.45731961308541841)
0.18...
>>> log_to_linear(0.41358840249244228, method='ACEScc')
array(0.18...)
>>> log_to_linear(
...     0.39100684261974583, method='PLog', log_reference=400)
0.1...
>>> log_to_linear(
...     0.35998784642215442, method='S-Log')
0.1799999...

<tt class="descclassname">colour.models.</tt><tt class="descname">linear_to_cineon</tt><big>(</big>value, black_offset=0.0107977516232771, **kwargs<big>)</big>¶

Defines the linear to Cineon conversion function.

<col class="field-name" />
<col class="field-body" />

Parameters:

value (numeric or array_like) – Linear value.

black_offset (numeric or array_like) – Black offset.

**kwargs (**, optional) – Unused parameter provided for signature compatibility with other
linear / log conversion objects.

Returns:
Cineon value.

Return type:
numeric or ndarray

Examples

>>> linear_to_cineon(0.18)
0.4573196...

<tt class="descclassname">colour.models.</tt><tt class="descname">cineon_to_linear</tt><big>(</big>value, black_offset=0.0107977516232771, **kwargs<big>)</big>¶

Defines the Cineon to linear conversion function.

<col class="field-name" />
<col class="field-body" />

Parameters:

value (numeric or array_like) – Cineon value.

black_offset (numeric or array_like) – Black offset.

**kwargs (**, optional) – Unused parameter provided for signature compatibility with other
linear / log conversion objects.

Returns:
Linear value.

Return type:
numeric or ndarray

Examples

>>> cineon_to_linear(0.45731961308541841)
0.18...

<tt class="descclassname">colour.models.</tt><tt class="descname">linear_to_panalog</tt><big>(</big>value, black_offset=0.04077184461038074, **kwargs<big>)</big>¶

Defines the linear to Panalog conversion function.

<col class="field-name" />
<col class="field-body" />

Parameters:

value (numeric or array_like) – Linear value.

black_offset (numeric or array_like) – Black offset.

**kwargs (**, optional) – Unused parameter provided for signature compatibility with other
linear / log conversion objects.

Returns:
Panalog value.

Return type:
numeric or ndarray

Examples

>>> linear_to_panalog(0.18)
0.3745767...

<tt class="descclassname">colour.models.</tt><tt class="descname">panalog_to_linear</tt><big>(</big>value, black_offset=0.04077184461038074, **kwargs<big>)</big>¶

Defines the Panalog to linear conversion function.

<col class="field-name" />
<col class="field-body" />

Parameters:

value (numeric or array_like) – Panalog value.

black_offset (numeric or array_like) – Black offset.

**kwargs (**, optional) – Unused parameter provided for signature compatibility with other
linear / log conversion objects.

Returns:
Linear value.

Return type:
numeric or ndarray

Examples

>>> panalog_to_linear(0.37457679138229816)
0.1...

<tt class="descclassname">colour.models.</tt><tt class="descname">linear_to_red_log_film</tt><big>(</big>value, black_offset=0.009955040995908344, **kwargs<big>)</big>¶

Defines the linear to REDLogFilm conversion function.

<col class="field-name" />
<col class="field-body" />

Parameters:

value (numeric or array_like) – Linear value.

black_offset (numeric or array_like) – Black offset.

**kwargs (**, optional) – Unused parameter provided for signature compatibility with other
linear / log conversion objects.

Returns:
REDLogFilm value.

Return type:
numeric or ndarray

Examples

>>> linear_to_red_log_film(0.18)
0.6376218...

<tt class="descclassname">colour.models.</tt><tt class="descname">red_log_film_to_linear</tt><big>(</big>value, black_offset=0.009955040995908344, **kwargs<big>)</big>¶

Defines the REDLogFilm to linear conversion function.

<col class="field-name" />
<col class="field-body" />

Parameters:

value (numeric or array_like) – REDLogFilm value.

black_offset (numeric or array_like) – Black offset.

**kwargs (**, optional) – Unused parameter provided for signature compatibility with other
linear / log conversion objects.

Returns:
Linear value.

Return type:
numeric or ndarray

Examples

>>> red_log_film_to_linear(0.63762184598817484)
0.1...

<tt class="descclassname">colour.models.</tt><tt class="descname">linear_to_viper_log</tt><big>(</big>value, **kwargs<big>)</big>¶

Defines the linear to ViperLog conversion function.

<col class="field-name" />
<col class="field-body" />

Parameters:

value (numeric or array_like) – Linear value.

**kwargs (**, optional) – Unused parameter provided for signature compatibility with other
linear / log conversion objects.

Returns:
ViperLog value.

Return type:
numeric or ndarray

Examples

>>> linear_to_viper_log(0.18)
0.6360080...

<tt class="descclassname">colour.models.</tt><tt class="descname">viper_log_to_linear</tt><big>(</big>value, **kwargs<big>)</big>¶

Defines the ViperLog to linear conversion function.

<col class="field-name" />
<col class="field-body" />

Parameters:

value (numeric or array_like) – ViperLog value.

**kwargs (**, optional) – Unused parameter provided for signature compatibility with other
linear / log conversion objects.

Returns:
Linear value.

Return type:
numeric or ndarray

Examples

>>> viper_log_to_linear(0.63600806701041346)
0.1799999...

<tt class="descclassname">colour.models.</tt><tt class="descname">linear_to_pivoted_log</tt><big>(</big>value, log_reference=445, linear_reference=0.18, negative_gamma=0.6, density_per_code_value=0.002<big>)</big>¶

Defines the linear to Josh Pines style pivoted log conversion function.

<col class="field-name" />
<col class="field-body" />

Parameters:

value (numeric or array_like) – Linear value.

log_reference (numeric or array_like) – Log reference.

linear_reference (numeric or array_like) – Linear reference.

negative_gamma (numeric or array_like) – Negative gamma.

density_per_code_value (numeric or array_like) – Density per code value.

Returns:
Josh Pines style pivoted log value.

Return type:
numeric or ndarray

Examples

>>> linear_to_pivoted_log(0.18)
0.4349951...

<tt class="descclassname">colour.models.</tt><tt class="descname">pivoted_log_to_linear</tt><big>(</big>value, log_reference=445, linear_reference=0.18, negative_gamma=0.6, density_per_code_value=0.002<big>)</big>¶

Defines the Josh Pines style pivoted log to linear conversion function.

<col class="field-name" />
<col class="field-body" />

Parameters:

value (numeric or array_like) – Josh Pines style pivoted log value.

log_reference (numeric or array_like) – Log reference.

linear_reference (numeric or array_like) – Linear reference.

negative_gamma (numeric or array_like) – Negative gamma.

density_per_code_value (numeric or array_like) – Density per code value.

Returns:
Linear value.

Return type:
numeric or ndarray

Examples

>>> pivoted_log_to_linear(0.43499511241446726)
0.1...

<tt class="descclassname">colour.models.</tt><tt class="descname">linear_to_c_log</tt><big>(</big>value, **kwargs<big>)</big>¶

Defines the linear to Canon Log conversion function.

<col class="field-name" />
<col class="field-body" />

Parameters:

value (numeric or array_like) – Linear value.

**kwargs (**, optional) – Unused parameter provided for signature compatibility with other
linear / log conversion objects.

Returns:
Canon Log value.

Return type:
numeric or ndarray

References

<colgroup><col class="label" /><col /></colgroup>

[2]	Thorpe, L. (2012). CANON-LOG TRANSFER CHARACTERISTIC. Retrieved
from http://downloads.canon.com/CDLC/Canon-Log_Transfer_Characteristic_6-20-2012.pdf

Examples

>>> linear_to_c_log(0.20) * 100
32.7953896...

<tt class="descclassname">colour.models.</tt><tt class="descname">c_log_to_linear</tt><big>(</big>value, **kwargs<big>)</big>¶

Defines the Canon Log to linear conversion function. [2]_

<col class="field-name" />
<col class="field-body" />

Parameters:

value (numeric or array_like) – Canon Log value.

**kwargs (**, optional) – Unused parameter provided for signature compatibility with other
linear / log conversion objects.

Returns:
Linear value.

Return type:
numeric or ndarray

Examples

>>> c_log_to_linear(32.795389693580908 / 100)
0.19999999...

<tt class="descclassname">colour.models.</tt><tt class="descname">linear_to_aces_cc</tt><big>(</big>value, **kwargs<big>)</big>¶

Defines the linear to ACEScc conversion function.

<col class="field-name" />
<col class="field-body" />

Parameters:

value (numeric or array_like) – Linear value.

**kwargs (**, optional) – Unused parameter provided for signature compatibility with other
linear / log conversion objects.

Returns:
ACEScc value.

Return type:
numeric or ndarray

Examples

>>> linear_to_aces_cc(0.18)
array(0.4135884...)

<tt class="descclassname">colour.models.</tt><tt class="descname">aces_cc_to_linear</tt><big>(</big>value, **kwargs<big>)</big>¶

Defines the ACEScc to linear conversion function.

<col class="field-name" />
<col class="field-body" />

Parameters:

value (numeric or array_like) – ACEScc value.

**kwargs (**, optional) – Unused parameter provided for signature compatibility with other
linear / log conversion objects.

Returns:
Linear value.

Return type:
numeric or ndarray

Examples

>>> aces_cc_to_linear(0.41358840249244228)
array(0.1800000...)

<tt class="descclassname">colour.models.</tt><tt class="descname">linear_to_alexa_log_c</tt><big>(</big>value, **kwargs<big>)</big>¶

Defines the linear to ALEXA Log C conversion function.

<col class="field-name" />
<col class="field-body" />

Parameters:

value (numeric or array_like) – Linear value.

**kwargs (**, optional) – Unused parameter provided for signature compatibility with other
linear / log conversion objects.

Returns:
ALEXA Log C value.

Return type:
numeric or ndarray

Examples

>>> linear_to_alexa_log_c(0.18)
array(0.3910068...)

<tt class="descclassname">colour.models.</tt><tt class="descname">alexa_log_c_to_linear</tt><big>(</big>value, **kwargs<big>)</big>¶

Defines the ALEXA Log C to linear conversion function.

<col class="field-name" />
<col class="field-body" />

Parameters:

value (numeric or array_like) – ALEXA Log C value.

**kwargs (**, optional) – Unused parameter provided for signature compatibility with other
linear / log conversion objects.

Returns:
Linear value.

Return type:
numeric or ndarray

Examples

>>> alexa_log_c_to_linear(0.39100683203408376)
array(0.1800000...)

<tt class="descclassname">colour.models.</tt><tt class="descname">linear_to_s_log</tt><big>(</big>value, **kwargs<big>)</big>¶

Defines the linear to S-Log conversion function.

<col class="field-name" />
<col class="field-body" />

Parameters:

value (numeric or array_like) – Linear value.

**kwargs (**, optional) – Unused parameter provided for signature compatibility with other
linear / log conversion objects.

Returns:
S-Log value.

Return type:
numeric or ndarray

Examples

>>> linear_to_s_log(0.18)
0.3599878...

<tt class="descclassname">colour.models.</tt><tt class="descname">linear_to_dci_p3_log</tt><big>(</big>value, **kwargs<big>)</big>¶

Defines the linear to DCI-P3 conversion function.

<col class="field-name" />
<col class="field-body" />

Parameters:

value (numeric or array_like) – Linear value.

**kwargs (**, optional) – Unused parameter provided for signature compatibility with other
linear / log conversion objects.

Returns:
DCI-P3 value.

Return type:
numeric or ndarray

Examples

>>> linear_to_dci_p3_log(0.18)
461.9922059...

<tt class="descclassname">colour.models.</tt><tt class="descname">dci_p3_log_to_linear</tt><big>(</big>value, **kwargs<big>)</big>¶

Defines the DCI-P3 to linear conversion function.

<col class="field-name" />
<col class="field-body" />

Parameters:

value (numeric or array_like) – DCI-P3 value.

**kwargs (**, optional) – Unused parameter provided for signature compatibility with other
linear / log conversion objects.

Returns:
Linear value.

Return type:
numeric or ndarray

Examples

>>> dci_p3_log_to_linear(461.99220597484737)
0.1800000...

<tt class="descclassname">colour.models.</tt><tt class="descname">s_log_to_linear</tt><big>(</big>value, **kwargs<big>)</big>¶

Defines the S-Log to linear conversion function.

<col class="field-name" />
<col class="field-body" />

Parameters:

value (numeric or array_like) – S-Log value.

**kwargs (**, optional) – Unused parameter provided for signature compatibility with other
linear / log conversion objects.

Returns:
Linear value.

Return type:
numeric or ndarray

Examples

>>> s_log_to_linear(0.35998784642215442)
0.1...

<tt class="descclassname">colour.models.</tt><tt class="descname">linear_to_s_log2</tt><big>(</big>value, **kwargs<big>)</big>¶

Defines the linear to S-Log2 conversion function.

<col class="field-name" />
<col class="field-body" />

Parameters:

value (numeric or array_like) – Linear value.

**kwargs (**, optional) – Unused parameter provided for signature compatibility with other
linear / log conversion objects.

Returns:
S-Log2 value.

Return type:
numeric or ndarray

Examples

>>> linear_to_s_log2(0.18)
0.3849708...

<tt class="descclassname">colour.models.</tt><tt class="descname">s_log2_to_linear</tt><big>(</big>value, **kwargs<big>)</big>¶

Defines the S-Log2 to linear conversion function.

<col class="field-name" />
<col class="field-body" />

Parameters:

value (numeric or array_like) – S-Log2 value.

**kwargs (**, optional) – Unused parameter provided for signature compatibility with other
linear / log conversion objects.

Returns:
Linear value.

Return type:
numeric or ndarray

Examples

>>> s_log2_to_linear(0.38497081592867027)
0.1...

<tt class="descclassname">colour.models.</tt><tt class="descname">linear_to_s_log3</tt><big>(</big>value, **kwargs<big>)</big>¶

Defines the linear to S-Log3 conversion function.

<col class="field-name" />
<col class="field-body" />

Parameters:

value (numeric or array_like) – Linear value.

**kwargs (**, optional) – Unused parameter provided for signature compatibility with other
linear / log conversion objects.

Returns:
S-Log3 value.

Return type:
numeric or ndarray

Examples

>>> linear_to_s_log3(0.18)
array(0.4105571...)

<tt class="descclassname">colour.models.</tt><tt class="descname">s_log3_to_linear</tt><big>(</big>value, **kwargs<big>)</big>¶

Defines the S-Log3 to linear conversion function.

<col class="field-name" />
<col class="field-body" />

Parameters:

value (numeric or array_like) – S-Log3 value.

**kwargs (**, optional) – Unused parameter provided for signature compatibility with other
linear / log conversion objects.

Returns:
Linear value.

Return type:
numeric or ndarray

Examples

>>> s_log3_to_linear(0.41055718475073316)
array(0.1...)

<tt class="descclassname">colour.models.</tt><tt class="descname">linear_to_v_log</tt><big>(</big>value, **kwargs<big>)</big>¶

Defines the linear to V-Log conversion function.

<col class="field-name" />
<col class="field-body" />

Parameters:

value (numeric or array_like) – Linear value.

**kwargs (**, optional) – Unused parameter provided for signature compatibility with other
linear / log conversion objects.

Returns:
V-Log value.

Return type:
numeric or ndarray

Examples

>>> linear_to_v_log(0.18)
array(0.4233114...)

<tt class="descclassname">colour.models.</tt><tt class="descname">v_log_to_linear</tt><big>(</big>value, **kwargs<big>)</big>¶

Defines the V-Log to linear conversion function.

<col class="field-name" />
<col class="field-body" />

Parameters:

value (numeric or array_like) – V-Log value.

**kwargs (**, optional) – Unused parameter provided for signature compatibility with other
linear / log conversion objects.

Returns:
Linear value.

Return type:
numeric or ndarray

Examples

>>> v_log_to_linear(0.42331144876013616)
array(0.1...)

<tt class="descclassname">colour.models.</tt><tt class="descname">XYZ_to_RGB</tt><big>(</big>XYZ, illuminant_XYZ, illuminant_RGB, XYZ_to_RGB_matrix, chromatic_adaptation_transform=u'CAT02', transfer_function=None<big>)</big>¶

Converts from CIE XYZ tristimulus values to given RGB colourspace.

<col class="field-name" />
<col class="field-body" />

Parameters:

XYZ (array_like) – CIE XYZ tristimulus values.

illuminant_XYZ (array_like) – CIE XYZ tristimulus values illuminant xy chromaticity coordinates
or CIE xyY colourspace array.

illuminant_RGB (array_like) – RGB colourspace illuminant xy chromaticity coordinates or
CIE xyY colourspace array.

XYZ_to_RGB_matrix (array_like) – Normalised primary matrix.

chromatic_adaptation_transform (unicode, optional) – {‘CAT02’, ‘XYZ Scaling’, ‘Von Kries’, ‘Bradford’, ‘Sharp’,
‘Fairchild, ‘CMCCAT97’, ‘CMCCAT2000’, ‘CAT02_BRILL_CAT’, ‘Bianco’,
‘Bianco PC’},
Chromatic adaptation transform.

transfer_function (object, optional) – Transfer function.

Returns:
RGB colourspace array.

Return type:
ndarray

Notes

Input CIE XYZ tristimulus values are in domain [0, 1].

Input illuminant_XYZ xy chromaticity coordinates or CIE xyY
colourspace array are in domain [0, \(\infty\)].

Input illuminant_RGB xy chromaticity coordinates or CIE xyY
colourspace array are in domain [0, \(\infty\)].

Output RGB colourspace array is in domain [0, 1].

Examples

>>> XYZ = np.array([0.07049534, 0.10080000, 0.09558313])
>>> illuminant_XYZ = np.array([0.34567, 0.35850])
>>> illuminant_RGB = np.array([0.31271, 0.32902])
>>> chromatic_adaptation_transform = 'Bradford'
>>> XYZ_to_RGB_matrix = np.array([
...     [3.24100326, -1.53739899, -0.49861587],
...     [-0.96922426, 1.87592999, 0.04155422],
...     [0.05563942, -0.20401120, 1.05714897]])
>>> XYZ_to_RGB(
...     XYZ,
...     illuminant_XYZ,
...     illuminant_RGB,
...     XYZ_to_RGB_matrix,
...     chromatic_adaptation_transform)
array([ 0.0110360...,  0.1273446...,  0.1163103...])

<tt class="descclassname">colour.models.</tt><tt class="descname">RGB_to_XYZ</tt><big>(</big>RGB, illuminant_RGB, illuminant_XYZ, RGB_to_XYZ_matrix, chromatic_adaptation_transform=u'CAT02', inverse_transfer_function=None<big>)</big>¶

Converts from given RGB colourspace to CIE XYZ tristimulus values.

<col class="field-name" />
<col class="field-body" />

Parameters:

RGB (array_like) – RGB colourspace array.

illuminant_RGB (array_like) – RGB colourspace illuminant chromaticity coordinates or CIE xyY
colourspace array.

illuminant_XYZ (array_like) – CIE XYZ tristimulus values illuminant chromaticity coordinates or
CIE xyY colourspace array.

RGB_to_XYZ_matrix (array_like) – Normalised primary matrix.

chromatic_adaptation_transform (unicode, optional) – {‘CAT02’, ‘XYZ Scaling’, ‘Von Kries’, ‘Bradford’, ‘Sharp’,
‘Fairchild, ‘CMCCAT97’, ‘CMCCAT2000’, ‘CAT02_BRILL_CAT’, ‘Bianco’,
‘Bianco PC’},
Chromatic adaptation transform.

inverse_transfer_function (object, optional) – Inverse transfer function.

Returns:
CIE XYZ tristimulus values.

Return type:
ndarray

Notes

Input RGB colourspace array is in domain [0, 1].

Input illuminant_RGB xy chromaticity coordinates or CIE xyY
colourspace array are in domain [0, \(\infty\)].

Input illuminant_XYZ xy chromaticity coordinates or CIE xyY
colourspace array are in domain [0, \(\infty\)].

Output CIE XYZ tristimulus values are in domain [0, 1].

Examples

>>> RGB = np.array([0.01103604, 0.12734466, 0.11631037])
>>> illuminant_RGB = np.array([0.31271, 0.32902])
>>> illuminant_XYZ = np.array([0.34567, 0.35850])
>>> chromatic_adaptation_transform = 'Bradford'
>>> RGB_to_XYZ_matrix = np.array([
...     [0.41238656, 0.35759149, 0.18045049],
...     [0.21263682, 0.71518298, 0.07218020],
...     [0.01933062, 0.11919716, 0.95037259]])
>>> RGB_to_XYZ(
...     RGB,
...     illuminant_RGB,
...     illuminant_XYZ,
...     RGB_to_XYZ_matrix,
...     chromatic_adaptation_transform)
array([ 0.0704953...,  0.1008    ,  0.0955831...])

<tt class="descclassname">colour.models.</tt><tt class="descname">RGB_to_RGB</tt><big>(</big>RGB, input_colourspace, output_colourspace, chromatic_adaptation_transform=u'CAT02'<big>)</big>¶

Converts from given input RGB colourspace to output RGB colourspace
using given chromatic adaptation method.

<col class="field-name" />
<col class="field-body" />

Parameters:

RGB (array_like) – RGB colourspace array.

input_colourspace (RGB_Colourspace) – RGB input colourspace.

output_colourspace (RGB_Colourspace) – RGB output colourspace.

chromatic_adaptation_transform (unicode, optional) – {‘CAT02’, ‘XYZ Scaling’, ‘Von Kries’, ‘Bradford’, ‘Sharp’,
‘Fairchild, ‘CMCCAT97’, ‘CMCCAT2000’, ‘CAT02_BRILL_CAT’, ‘Bianco’,
‘Bianco PC’},
Chromatic adaptation transform.

ndarray – RGB colourspace array.

Notes

RGB colourspace arrays are in domain [0, 1].

Examples

>>> from colour import sRGB_COLOURSPACE, PROPHOTO_RGB_COLOURSPACE
>>> RGB = np.array([0.01103604, 0.12734466, 0.11631037])
>>> RGB_to_RGB(
...     RGB,
...     sRGB_COLOURSPACE,
...     PROPHOTO_RGB_COLOURSPACE)
array([ 0.0643338...,  0.1157362...,  0.1157614...])

<tt class="descclassname">colour.models.</tt><tt class="descname">XYZ_to_sRGB</tt><big>(</big>XYZ, illuminant=(0.31271, 0.32902), chromatic_adaptation_transform=u'CAT02', transfer_function=True<big>)</big>¶

Converts from CIE XYZ tristimulus values to sRGB colourspace.

<col class="field-name" />
<col class="field-body" />

Parameters:

XYZ (array_like) – CIE XYZ tristimulus values.

illuminant (array_like, optional) – Source illuminant chromaticity coordinates.

chromatic_adaptation_transform (unicode, optional) – {‘CAT02’, ‘XYZ Scaling’, ‘Von Kries’, ‘Bradford’, ‘Sharp’,
‘Fairchild, ‘CMCCAT97’, ‘CMCCAT2000’, ‘CAT02_BRILL_CAT’, ‘Bianco’,
‘Bianco PC’},
Chromatic adaptation transform.

transfer_function (bool, optional) – Apply sRGB transfer function.

Returns:
sRGB colour array.

Return type:
ndarray

Notes

Input CIE XYZ tristimulus values are in domain [0, 1].

Examples

>>> import numpy as np
>>> XYZ = np.array([0.07049534, 0.10080000, 0.09558313])
>>> XYZ_to_sRGB(XYZ)
array([ 0.1750135...,  0.3881879...,  0.3216195...])

<tt class="descclassname">colour.models.</tt><tt class="descname">sRGB_to_XYZ</tt><big>(</big>RGB, illuminant=(0.31271, 0.32902), chromatic_adaptation_method=u'CAT02', inverse_transfer_function=True<big>)</big>¶

Converts from sRGB colourspace to CIE XYZ tristimulus values.

<col class="field-name" />
<col class="field-body" />

Parameters:

RGB (array_like) – sRGB colourspace array.

illuminant (array_like, optional) – Source illuminant chromaticity coordinates.

chromatic_adaptation_method (unicode, optional) – {‘CAT02’, ‘XYZ Scaling’, ‘Von Kries’, ‘Bradford’, ‘Sharp’,
‘Fairchild, ‘CMCCAT97’, ‘CMCCAT2000’, ‘CAT02_BRILL_CAT’, ‘Bianco’,
‘Bianco PC’},
Chromatic adaptation method.

inverse_transfer_function (bool, optional) – Apply sRGB inverse transfer function.

Returns:
CIE XYZ tristimulus values.

Return type:
ndarray

Notes

Input RGB colourspace array is in domain [0, 1].

Examples

>>> import numpy as np
>>> RGB = np.array([0.17501358, 0.38818795, 0.32161955])
>>> sRGB_to_XYZ(RGB)
array([ 0.0704953...,  0.1008    ,  0.0955831...])

<tt class="descclassname">colour.models.</tt><tt class="descname">spectral_to_aces_relative_exposure_values</tt><big>(</big>spd, illuminant=<colour.colorimetry.spectrum.SpectralPowerDistribution object at 0x2abef976db50><big>)</big>¶

Converts given spectral power distribution to ACES2065-1 colourspace
relative exposure values.

<col class="field-name" />
<col class="field-body" />

Parameters:

spd (SpectralPowerDistribution) – Spectral power distribution.

illuminant (SpectralPowerDistribution, optional) – Illuminant spectral power distribution.

Returns:
ACES2065-1 colourspace relative exposure values array.

Return type:
ndarray, (3,)

Notes

Output ACES2065-1 colourspace relative exposure values array is in
domain [0, 1].

See also

<tt class="xref py py-func docutils literal">colour.colorimetry.tristimulus.spectral_to_XYZ()</tt>

References

Examples

>>> from colour import COLOURCHECKERS_SPDS
>>> spd = COLOURCHECKERS_SPDS['ColorChecker N Ohta']['dark skin']
>>> spectral_to_aces_relative_exposure_values(spd)
array([ 0.1187697...,  0.0870866...,  0.0589442...])

      Back to top

        © Copyright 2013 - 2015, Colour Developers.

      Created using Sphinx 1.2.2.


text:
"""Support for the Hive devices."""
import logging

from pyhiveapi import Pyhiveapi
import voluptuous as vol

from homeassistant.const import CONF_PASSWORD, CONF_SCAN_INTERVAL, CONF_USERNAME
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.discovery import load_platform

_LOGGER = logging.getLogger(__name__)

DOMAIN = "hive"
DATA_HIVE = "data_hive"
DEVICETYPES = {
    "binary_sensor": "device_list_binary_sensor",
    "climate": "device_list_climate",
    "water_heater": "device_list_water_heater",
    "light": "device_list_light",
    "switch": "device_list_plug",
    "sensor": "device_list_sensor",
}

CONFIG_SCHEMA = vol.Schema(
    {
        DOMAIN: vol.Schema(
            {
                vol.Required(CONF_PASSWORD): cv.string,
                vol.Required(CONF_USERNAME): cv.string,
                vol.Optional(CONF_SCAN_INTERVAL, default=2): cv.positive_int,
            }
        )
    },
    extra=vol.ALLOW_EXTRA,
)

class HiveSession:
    """Initiate Hive Session Class."""

    entities = []
    core = None
    heating = None
    hotwater = None
    light = None
    sensor = None
    switch = None
    weather = None
    attributes = None

def setup(hass, config):
    """Set up the Hive Component."""
    session = HiveSession()
    session.core = Pyhiveapi()

    username = config[DOMAIN][CONF_USERNAME]
    password = config[DOMAIN][CONF_PASSWORD]
    update_interval = config[DOMAIN][CONF_SCAN_INTERVAL]

    devicelist = session.core.initialise_api(username, password, update_interval)

    if devicelist is None:
        _LOGGER.error("Hive API initialization failed")
        return False

    session.sensor = Pyhiveapi.Sensor()
    session.heating = Pyhiveapi.Heating()
    session.hotwater = Pyhiveapi.Hotwater()
    session.light = Pyhiveapi.Light()
    session.switch = Pyhiveapi.Switch()
    session.weather = Pyhiveapi.Weather()
    session.attributes = Pyhiveapi.Attributes()
    hass.data[DATA_HIVE] = session

    for ha_type, hive_type in DEVICETYPES.items():
        for key, devices in devicelist.items():
            if key == hive_type:
                for hivedevice in devices:
                    load_platform(hass, ha_type, DOMAIN, hivedevice, config)
    return True


text:
from solver_utils import *

class IRSolver(Solver):

    def __init__(self, index, k, test_questions):
        self.index = index
        self.k = k
        self.classifier = None
        self.weight = 1.15
        self.answer_cache = {}
        self.load_answer_cache(test_questions, 'ir')
        self.soft_cache = {}

    def calculate_answer(self, question):
        queries = self.complete_sentence(question)
        k_docs = [self.index.get_top_k_documents(self.k, query) for query in queries]
        scores = [sum([doc.score for doc in docs]) for docs in k_docs]
        return scores

    def sub_ans_for_blank(self, question):
        question_text = question.question
        filled_in = []
        for answer in [question.A, question.B, question.C, question.D]:
            copy = question_text
            copy = re.sub("__+", " " + answer + " ", copy)
            filled_in.append(copy)
        return filled_in

    def complete_sentence(self, question):
        question_text = question.question
        filled_in = []
        for answer in [question.A, question.B, question.C, question.D]:
            filled_in.append(question_text + " " + answer)
        return filled_in


text:
#ifndef OPD_IBS_H
#define OPD_IBS_H

#include <stdint.h>

#include "opd_ibs_macro.h"

struct transient;
struct opd_event;

/**
 * IBS information is processed in two steps. The first step decodes
 * hardware-level IBS information and saves it in decoded form. The
 * second step translates the decoded IBS information into IBS derived
 * events. IBS information is tallied and is reported as derived events.
 */

struct ibs_sample {
	struct ibs_fetch_sample * fetch;
	struct ibs_op_sample * op;
};

/**
 * This struct represents the hardware-level IBS fetch information.
 * Each field corresponds to a model-specific register (MSR.) See the
 * BIOS and Kernel Developer's Guide for AMD Model Family 10h Processors
 * for further details.
 */
struct ibs_fetch_sample {
	unsigned long int rip;
	/* MSRC001_1030 IBS Fetch Control Register */
	unsigned int ibs_fetch_ctl_low;
	unsigned int ibs_fetch_ctl_high;
	/* MSRC001_1031 IBS Fetch Linear Address Register */
	unsigned int ibs_fetch_lin_addr_low;
	unsigned int ibs_fetch_lin_addr_high;
	/* MSRC001_1032 IBS Fetch Physical Address Register */
	unsigned int ibs_fetch_phys_addr_low;
	unsigned int ibs_fetch_phys_addr_high;
	unsigned int dummy_event;
};

/** This struct represents the hardware-level IBS op information. */
struct ibs_op_sample {
	unsigned long int rip;
	/* MSRC001_1034 IBS Op Logical Address Register */
	unsigned int ibs_op_lin_addr_low;
	unsigned int ibs_op_lin_addr_high;
	/* MSRC001_1035 IBS Op Data Register */
	unsigned int ibs_op_data1_low;
	unsigned int ibs_op_data1_high;
	/* MSRC001_1036 IBS Op Data 2 Register */
	unsigned int ibs_op_data2_low;
	unsigned int ibs_op_data2_high;
	/* MSRC001_1037 IBS Op Data 3 Register */
	unsigned int ibs_op_data3_low;
	unsigned int ibs_op_data3_high;
	/* MSRC001_1038 IBS DC Linear Address */
	unsigned int ibs_op_ldst_linaddr_low;
	unsigned int ibs_op_ldst_linaddr_high;
	/* MSRC001_1039 IBS DC Physical Address */
	unsigned int ibs_op_phys_addr_low;
	unsigned int ibs_op_phys_addr_high;
	/* MSRC001_103B IBS Branch Target Address */
	unsigned long ibs_op_brtgt_addr;
};

/**
 * Handle an IBS fetch sample escape code sequence. An IBS fetch sample
 * is represented as an escape code sequence. (See the comment for the
 * function code_ibs_op_sample() for the sequence of entries in the event
 * buffer.) When this function is called, the ESCAPE_CODE and IBS_FETCH_CODE
 * have already been removed from the event buffer. Thus, 7 more event buffer
 * entries are needed in order to process a complete IBS fetch sample.
 */
extern void code_ibs_fetch_sample(struct transient * trans);

/**
 * Handle an IBS op sample escape code sequence. An IBS op sample
 * is represented as an escape code sequence:
 *
 *    IBS fetch              IBS op
 *    ---------------        ----------------
 *    ESCAPE_CODE            ESCAPE_CODE
 *    IBS_FETCH_CODE         IBS_OP_CODE
 *    Offset                 Offset
 *    IbsFetchLinAd low      IbsOpRip low        <-- Logical (virtual) RIP
 *    IbsFetchLinAd high     IbsOpRip high       <-- Logical (virtual) RIP
 *    IbsFetchCtl low        IbsOpData low
 *    IbsFetchCtl high       IbsOpData high
 *    IbsFetchPhysAd low     IbsOpData2 low
 *    IbsFetchPhysAd high    IbsOpData2 high
 *                           IbsOpData3 low
 *                           IbsOpData3 high
 *                           IbsDcLinAd low
 *                           IbsDcLinAd high
 *                           IbsDcPhysAd low
 *                           IbsDcPhysAd high
 *
 * When this function is called, the ESCAPE_CODE and IBS_OP_CODE have
 * already been removed from the event buffer. Thus, 13 more event buffer
 * entries are needed to process a complete IBS op sample.
 *
 * The IbsFetchLinAd and IbsOpRip are the linear (virtual) addresses
 * that were generated by the IBS hardware. These addresses are mapped
 * into the offset.
 */
extern void code_ibs_op_sample(struct transient * trans);

/** Log the specified IBS derived event. */
extern void opd_log_ibs_event(unsigned int event, struct transient * trans);

/** Log the specified IBS cycle count. */
extern void opd_log_ibs_count(unsigned int event, struct transient * trans, unsigned int count);

#endif /*OPD_IBS_H*/


text:
package org.apache.camel.component.rabbitmq;

import java.io.IOException;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeoutException;

import com.rabbitmq.client.AMQP;
import com.rabbitmq.client.Channel;
import org.apache.camel.Endpoint;
import org.apache.camel.EndpointInject;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.impl.JndiRegistry;
import org.junit.Test;

public class RabbitMQConsumerIntTest extends AbstractRabbitMQIntTest {

    private static final String EXCHANGE = "ex1";
    private static final String HEADERS_EXCHANGE = "ex8";
    private static final String QUEUE = "q1";
    private static final String MSG = "hello world";

    @EndpointInject(uri = "rabbitmq:localhost:5672/" + EXCHANGE + "?username=cameltest&password=cameltest")
    private Endpoint from;

    @EndpointInject(uri = "mock:result")
    private MockEndpoint to;

    @EndpointInject(uri = "rabbitmq:localhost:5672/" + HEADERS_EXCHANGE + "?username=cameltest&password=cameltest&exchangeType=headers&queue=" + QUEUE + "&bindingArgs=#bindArgs")
    private Endpoint headersExchangeWithQueue;

    @EndpointInject(uri = "rabbitmq:localhost:5672/" + "ex7" + "?username=cameltest&password=cameltest&exchangeType=headers&autoDelete=false&durable=true&queue=q7&arg.binding.fizz=buzz")
    private Endpoint headersExchangeWithQueueDefiniedInline;

    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {

            @Override
            public void configure() throws Exception {
                from(from).to(to);
                from(headersExchangeWithQueue).to(to);
                from(headersExchangeWithQueueDefiniedInline).to(to);
            }
        };
    }

    @Override
    protected JndiRegistry createRegistry() throws Exception {
        JndiRegistry jndi = super.createRegistry();

        Map<String, Object> bindingArgs = new HashMap<>();
        jndi.bind("bindArgs", bindingArgs);

        return jndi;
    }

    @Test
    public void sentMessageIsReceived() throws InterruptedException, IOException, TimeoutException {

        to.expectedMessageCount(1);
        to.expectedHeaderReceived(RabbitMQConstants.REPLY_TO, "myReply");

        AMQP.BasicProperties.Builder properties = new AMQP.BasicProperties.Builder();
        properties.replyTo("myReply");

        Channel channel = connection().createChannel();
        channel.basicPublish(EXCHANGE, "", properties.build(), MSG.getBytes());

        to.assertIsSatisfied();
    }

    @Test
    public void sentMessageIsDeliveryModeSet() throws InterruptedException, IOException, TimeoutException {

        to.expectedMessageCount(1);
        to.expectedHeaderReceived(RabbitMQConstants.DELIVERY_MODE, 1);

        AMQP.BasicProperties.Builder properties = new AMQP.BasicProperties.Builder();
        properties.deliveryMode(1);

        Channel channel = connection().createChannel();
        channel.basicPublish(EXCHANGE, "", properties.build(), MSG.getBytes());

        to.assertIsSatisfied();
    }

    @Test
    public void sentMessageWithTimestampIsReceived() throws InterruptedException, IOException, TimeoutException {
        Date timestamp = currentTimestampWithoutMillis();

        to.expectedMessageCount(1);
        to.expectedHeaderReceived(RabbitMQConstants.TIMESTAMP, timestamp);

        AMQP.BasicProperties.Builder properties = new AMQP.BasicProperties.Builder();
        properties.timestamp(timestamp);

        Channel channel = connection().createChannel();
        channel.basicPublish(EXCHANGE, "", properties.build(), MSG.getBytes());

        to.assertIsSatisfied();
    }

    /**
     * Tests the proper rabbit binding arguments are in place when the headersExchangeWithQueue is created.
     * Should only receive messages with the header [foo=bar]
     */
    @Test
    public void sentMessageIsReceivedWithHeadersRouting() throws InterruptedException, IOException, TimeoutException {
        //should only be one message that makes it through because only
        //one has the correct header set
        to.expectedMessageCount(1);

        Channel channel = connection().createChannel();
        channel.basicPublish(HEADERS_EXCHANGE, "", propertiesWithHeader("foo", "bar"), MSG.getBytes());
        channel.basicPublish(HEADERS_EXCHANGE, "", null, MSG.getBytes());
        channel.basicPublish(HEADERS_EXCHANGE, "", propertiesWithHeader("foo", "bra"), MSG.getBytes());

        to.assertIsSatisfied();
    }

    @Test
    public void sentMessageIsReceivedWithHeadersRoutingMultiValueMapBindings() throws Exception {
        to.expectedMessageCount(3);

        Channel channel = connection().createChannel();
        channel.basicPublish("ex7", "", propertiesWithHeader("fizz", "buzz"), MSG.getBytes());
        channel.basicPublish("ex7", "", propertiesWithHeader("fizz", "buzz"), MSG.getBytes());
        channel.basicPublish("ex7", "", propertiesWithHeader("fizz", "buzz"), MSG.getBytes());
        channel.basicPublish("ex7", "", propertiesWithHeader("fizz", "nope"), MSG.getBytes());

        to.assertIsSatisfied();
    }

    private AMQP.BasicProperties propertiesWithHeader(String headerName, String headerValue) {
        AMQP.BasicProperties.Builder properties = new AMQP.BasicProperties.Builder();
        properties.headers(Collections.singletonMap(headerName, headerValue));
        return properties.build();
    }

    private Date currentTimestampWithoutMillis() {
        Calendar calendar = Calendar.getInstance();
        calendar.set(Calendar.MILLISECOND, 0);
        return calendar.getTime();
    }
}


text:
module Spree
  class Country < Spree::Base
    has_many :states, -> { order(:name) }, dependent: :destroy
    has_many :addresses, dependent: :nullify
    has_many :prices, class_name: "Spree::Price", foreign_key: "country_iso", primary_key: "iso"

    validates :name, :iso_name, presence: true

    def self.states_required_by_country_id
      Spree::Deprecation.warn "Spree::Country.states_required_by_country_id is deprecated and will be removed from future releases, Implement it yourself.", caller
      states_required = Hash.new(true)
      all.each { |country| states_required[country.id.to_s] = country.states_required }
      states_required
    end

    def self.default
      if Spree::Config.default_country_id
        Spree::Deprecation.warn("Setting your default country via its ID is deprecated. Please set your default country via the `default_country_iso` setting.", caller)
        find_by(id: Spree::Config.default_country_id) || find_by!(iso: Spree::Config.default_country_iso)
      else
        find_by!(iso: Spree::Config.default_country_iso)
      end
    end

    def <=>(other)
      name <=> other.name
    end

    def to_s
      name
    end
  end
end


text:
<?xml version="1.0" encoding="UTF-8"?>
<suppressions xmlns="https://jeremylong.github.io/DependencyCheck/dependency-suppression.1.1.xsd">
    <suppress>
        <notes><![CDATA[
   file name: amqp-client-5.4.3.jar
   ]]></notes>
        <gav regex="true">^com\.rabbitmq:amqp-client:.*$</gav>
        <cve>CVE-2018-1279</cve>
        <!-- Rabbit Erlang cookie issue relevant to the server, not the client -->
    </suppress>
    <suppress>
        <notes><![CDATA[
   file name: spring-rabbit-2.1.7.RELEASE.jar
   ]]></notes>
        <gav regex="true">^org\.springframework\.amqp:spring-rabbit:.*$</gav>
        <cve>CVE-2018-1279</cve>
        <!-- Rabbit Erlang cookie issue relevant to the server, not the client -->
    </suppress>
    <suppress>
        <notes><![CDATA[
   file name: spring-rabbit-2.1.7.RELEASE.jar
   ]]></notes>
        <gav regex="true">^org\.springframework\.amqp:spring-rabbit:.*$</gav>
        <cve>CVE-2014-9494</cve>
        <!-- serverside issue related to specific headers -->
    </suppress>
    <suppress>
        <notes><![CDATA[
   file name: spring-rabbit-2.1.7.RELEASE.jar
   ]]></notes>
        <gav regex="true">^org\.springframework\.amqp:spring-rabbit:.*$</gav>
        <cve>CVE-2018-11087</cve>
        <!--  Since 2.1.4 vulnerability mitigated by default.

         "By default, the RabbitConnectionFactoryBean now calls enableHostnameVerification().
         To revert to the previous behavior, set the enableHostnameVerification property to
         false."-->
    </suppress>
</suppressions>


text:
@interface LWCircleListSectionHeaderView : LWView

@end


text:
<?php
use Mouf\Html\Widgets\Form\Styles\LayoutStyle;
use Mouf\Html\Widgets\Form\TextAreaField;

/* @var $object TextAreaField */

//Check for styles
$inline = $object->getLayout() != null && $object->getLayout()->getLayoutType() == LayoutStyle::LAYOUT_INLINE;
if ($inline) {
    $ratio = $object->getLayout()->getLayoutRatio();
    $labelRatio = 12 / $ratio;
    $fieldRatio = 12 - $labelRatio;
}
?>
<div class="form-group <?php echo $object->getTextarea()->getName() ?>">
    <?php
        /* @var $object Mouf\Html\Widgets\Form\TextAreaField */
    if ($inline) {
        $object->getLabel()->addClass("col-lg-".$labelRatio);
    }
        $object->getLabel()->addClass('control-label');
    if ($required) {
        $object->getLabel()->addText('*');
    }
        $object->getLabel()->toHtml();
    ?>
    <div class="<?php echo $inline ? "col-lg-".$fieldRatio : ""; ?>">
        <?php
            $object->getTextarea()->addClass('form-control');
        if ($object->isRequired()) {
            $object->getTextarea()->setRequired('required');
        }
            $object->getTextarea()->toHtml();
        if ($object->getHelpText()) {
            ?>
                <?php $object->getHelpText()->toHtml() ?>
                <?php
        }
        ?>