Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,10 @@ jdk:
- oraclejdk7
- oraclejdk8
- openjdk7

env:
matrix:
- SCALA_VERSION=2.10
- SCALA_VERSION=2.11

script: "mvn clean install -P scala-${SCALA_VERSION}"
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,21 @@ Scala implementation of Histogrammar

See [histogrammar.org](http://histogrammar.org) for a complete introduction to Histogrammar.

This is a Scala implementation for Scala version 2.10.

**FIXME:** add tests (and check implementation) for Scala 2.11. It should work, but still.
This is a Scala implementation for Scala versions 2.10 and 2.11.

Installation
============

Histogrammar has a standard Maven POM. With Maven 3+, run

```bash
mvn install
mvn install -P scala-2.10
```

or

```bash
mvn install -P scala-2.11
```

in the base directory (to compile everything) or one of the subdirectories. All subdirectories depend on `core`, so this must be installed first.
Expand Down
40 changes: 32 additions & 8 deletions bokeh/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<inceptionYear>2016</inceptionYear>

<groupId>org.diana-hep</groupId>
<artifactId>histogrammar-bokeh</artifactId>
<artifactId>histogrammar-bokeh_${scala.binary.version}</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>

Expand All @@ -32,11 +32,35 @@
</license>
</licenses>

<profiles>
<profile>
<id>scala-2.10</id>
<activation>
<property><name>!scala-2.11</name></property>
</activation>
<properties>
<scala.version>2.10.6</scala.version>
<scala.binary.version>2.10</scala.binary.version>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
</profile>

<profile>
<id>scala-2.11</id>
<activation>
<property><name>scala-2.11</name></property>
</activation>
<properties>
<scala.version>2.11.8</scala.version>
<scala.binary.version>2.11</scala.binary.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
</profile>
</profiles>

<properties>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<scala.tools.version>2.10</scala.tools.version>
<scala.version>2.10.5</scala.version>
<encoding>UTF-8</encoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
Expand All @@ -50,13 +74,13 @@

<dependency>
<groupId>org.diana-hep</groupId>
<artifactId>histogrammar</artifactId>
<artifactId>histogrammar_${scala.binary.version}</artifactId>
<version>1.0.0</version>
</dependency>

<dependency>
<groupId>io.continuum.bokeh</groupId>
<artifactId>bokeh_${scala.tools.version}</artifactId>
<artifactId>bokeh_${scala.binary.version}</artifactId>
<version>0.6</version>
<scope>provided</scope>
</dependency>
Expand All @@ -73,7 +97,7 @@
<!-- see http://davidb.github.com/scala-maven-plugin -->
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.2.1</version>
<version>3.2.2</version>
<executions>
<execution>
<goals>
Expand Down
10 changes: 5 additions & 5 deletions bokeh/src/main/scala/org/dianahep/histogrammar/bokeh.scala
Original file line number Diff line number Diff line change
Expand Up @@ -346,24 +346,24 @@ package object bokeh extends Tools {

//////////////////////////////////////////////////////////////// methods for FractionedHistogram

implicit def anyBinnedToFractionedHistogramMethodsBokeh[U <: Container[U] with NoAggregation, O <: Container[O] with NoAggregation, N <: Container[N] with NoAggregation](hist: Fractioned[Binned[Counted, U, O, N]]): FractionedHistogramMethodsBokeh =
implicit def anyBinnedToFractionedHistogramMethodsBokeh[U <: Container[U] with NoAggregation, O <: Container[O] with NoAggregation, N <: Container[N] with NoAggregation](hist: Fractioned[Binned[Counted, U, O, N], Binned[Counted, U, O, N]]): FractionedHistogramMethodsBokeh =
new FractionedHistogramMethodsBokeh(anyBinnedToFractionedHistogramMethods(hist).fractioned)
implicit def anyBinningToFractionedHistogramMethodsBokeh[DATUM, U <: Container[U] with Aggregation{type Datum >: DATUM}, O <: Container[O] with Aggregation{type Datum >: DATUM}, N <: Container[N] with Aggregation{type Datum >: DATUM}](hist: Fractioning[DATUM, Binning[DATUM, Counting, U, O, N]]): FractionedHistogramMethodsBokeh =
new FractionedHistogramMethodsBokeh(anyBinningToFractionedHistogramMethods(hist).fractioned)
implicit def anySelectedBinnedToFractionedHistogramMethodsBokeh[U <: Container[U] with NoAggregation, O <: Container[O] with NoAggregation, N <: Container[N] with NoAggregation](hist: Fractioned[Selected[Binned[Counted, U, O, N]]]): FractionedHistogramMethodsBokeh =
implicit def anySelectedBinnedToFractionedHistogramMethodsBokeh[U <: Container[U] with NoAggregation, O <: Container[O] with NoAggregation, N <: Container[N] with NoAggregation](hist: Fractioned[Selected[Binned[Counted, U, O, N]], Selected[Binned[Counted, U, O, N]]]): FractionedHistogramMethodsBokeh =
new FractionedHistogramMethodsBokeh(anySelectedBinnedToFractionedHistogramMethods(hist).fractioned)
implicit def anySelectingBinningToFractionedHistogramMethodsBokeh[DATUM, U <: Container[U] with Aggregation{type Datum >: DATUM}, O <: Container[O] with Aggregation{type Datum >: DATUM}, N <: Container[N] with Aggregation{type Datum >: DATUM}](hist: Fractioning[DATUM, Selecting[DATUM, Binning[DATUM, Counting, U, O, N]]]): FractionedHistogramMethodsBokeh =
new FractionedHistogramMethodsBokeh(anySelectingBinningToFractionedHistogramMethods(hist).fractioned)
implicit def anySparselyBinnedToFractionedHistogramMethodsBokeh[N <: Container[N] with NoAggregation](hist: Fractioned[SparselyBinned[Counted, N]]): FractionedHistogramMethodsBokeh =
implicit def anySparselyBinnedToFractionedHistogramMethodsBokeh[N <: Container[N] with NoAggregation](hist: Fractioned[SparselyBinned[Counted, N], SparselyBinned[Counted, N]]): FractionedHistogramMethodsBokeh =
new FractionedHistogramMethodsBokeh(anySparselyBinnedToFractionedHistogramMethods(hist).fractioned)
implicit def anySparselyBinningToFractionedHistogramMethodsBokeh[DATUM, N <: Container[N] with Aggregation{type Datum >: DATUM}](hist: Fractioning[DATUM, SparselyBinning[DATUM, Counting, N]]): FractionedHistogramMethodsBokeh =
new FractionedHistogramMethodsBokeh(anySparselyBinningToFractionedHistogramMethods(hist).fractioned)
implicit def anySelectedSparselyBinnedToFractionedHistogramMethodsBokeh[N <: Container[N] with NoAggregation](hist: Fractioned[Selected[SparselyBinned[Counted, N]]]): FractionedHistogramMethodsBokeh =
implicit def anySelectedSparselyBinnedToFractionedHistogramMethodsBokeh[N <: Container[N] with NoAggregation](hist: Fractioned[Selected[SparselyBinned[Counted, N]], Selected[SparselyBinned[Counted, N]]]): FractionedHistogramMethodsBokeh =
new FractionedHistogramMethodsBokeh(anySelectedSparselyBinnedToFractionedHistogramMethods(hist).fractioned)
implicit def anySelectingSparselyBinningToFractionedHistogramMethodsBokeh[DATUM, N <: Container[N] with Aggregation{type Datum >: DATUM}](hist: Fractioning[DATUM, Selecting[DATUM, SparselyBinning[DATUM, Counting, N]]]): FractionedHistogramMethodsBokeh =
new FractionedHistogramMethodsBokeh(anySelectingSparselyBinningToFractionedHistogramMethods(hist).fractioned)

class FractionedHistogramMethodsBokeh(val fractioned: Fractioned[Selected[Binned[Counted, Counted, Counted, Counted]]])
class FractionedHistogramMethodsBokeh(val fractioned: Fractioned[Selected[Binned[Counted, Counted, Counted, Counted]], Selected[Binned[Counted, Counted, Counted, Counted]]])

//////////////////////////////////////////////////////////////// methods for TwoDimensionallyHistogram and TwoDimensionallySparselyHistogram

Expand Down
40 changes: 32 additions & 8 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<inceptionYear>2016</inceptionYear>

<groupId>org.diana-hep</groupId>
<artifactId>histogrammar</artifactId>
<artifactId>histogrammar_${scala.binary.version}</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>

Expand All @@ -32,6 +32,34 @@
</license>
</licenses>

<profiles>
<profile>
<id>scala-2.10</id>
<activation>
<property><name>!scala-2.11</name></property>
</activation>
<properties>
<scala.version>2.10.6</scala.version>
<scala.binary.version>2.10</scala.binary.version>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
</profile>

<profile>
<id>scala-2.11</id>
<activation>
<property><name>scala-2.11</name></property>
</activation>
<properties>
<scala.version>2.11.8</scala.version>
<scala.binary.version>2.11</scala.binary.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
</profile>
</profiles>

<reporting>
<plugins>
<plugin>
Expand All @@ -43,10 +71,6 @@
</reporting>

<properties>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<scala.tools.version>2.10</scala.tools.version>
<scala.version>2.10.5</scala.version>
<encoding>UTF-8</encoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
Expand All @@ -60,8 +84,8 @@

<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_${scala.tools.version}</artifactId>
<version>2.2.6</version>
<artifactId>scalatest_${scala.binary.version}</artifactId>
<version>2.2.5</version>
<scope>test</scope>
</dependency>

Expand All @@ -77,7 +101,7 @@
<!-- see http://davidb.github.com/scala-maven-plugin -->
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.2.1</version>
<version>3.2.2</version>
<executions>
<execution>
<goals>
Expand Down
10 changes: 5 additions & 5 deletions core/src/main/scala/org/dianahep/histogrammar/ascii.scala
Original file line number Diff line number Diff line change
Expand Up @@ -362,24 +362,24 @@ package object ascii {

//////////////////////////////////////////////////////////////// methods for FractionedHistogram

implicit def anyBinnedToFractionedHistogramMethodsAscii[U <: Container[U] with NoAggregation, O <: Container[O] with NoAggregation, N <: Container[N] with NoAggregation](hist: Fractioned[Binned[Counted, U, O, N]]): FractionedHistogramMethodsAscii =
implicit def anyBinnedToFractionedHistogramMethodsAscii[U <: Container[U] with NoAggregation, O <: Container[O] with NoAggregation, N <: Container[N] with NoAggregation](hist: Fractioned[Binned[Counted, U, O, N], Binned[Counted, U, O, N]]): FractionedHistogramMethodsAscii =
new FractionedHistogramMethodsAscii(anyBinnedToFractionedHistogramMethods(hist).fractioned)
implicit def anyBinningToFractionedHistogramMethodsAscii[DATUM, U <: Container[U] with Aggregation{type Datum >: DATUM}, O <: Container[O] with Aggregation{type Datum >: DATUM}, N <: Container[N] with Aggregation{type Datum >: DATUM}](hist: Fractioning[DATUM, Binning[DATUM, Counting, U, O, N]]): FractionedHistogramMethodsAscii =
new FractionedHistogramMethodsAscii(anyBinningToFractionedHistogramMethods(hist).fractioned)
implicit def anySelectedBinnedToFractionedHistogramMethodsAscii[U <: Container[U] with NoAggregation, O <: Container[O] with NoAggregation, N <: Container[N] with NoAggregation](hist: Fractioned[Selected[Binned[Counted, U, O, N]]]): FractionedHistogramMethodsAscii =
implicit def anySelectedBinnedToFractionedHistogramMethodsAscii[U <: Container[U] with NoAggregation, O <: Container[O] with NoAggregation, N <: Container[N] with NoAggregation](hist: Fractioned[Selected[Binned[Counted, U, O, N]], Selected[Binned[Counted, U, O, N]]]): FractionedHistogramMethodsAscii =
new FractionedHistogramMethodsAscii(anySelectedBinnedToFractionedHistogramMethods(hist).fractioned)
implicit def anySelectingBinningToFractionedHistogramMethodsAscii[DATUM, U <: Container[U] with Aggregation{type Datum >: DATUM}, O <: Container[O] with Aggregation{type Datum >: DATUM}, N <: Container[N] with Aggregation{type Datum >: DATUM}](hist: Fractioning[DATUM, Selecting[DATUM, Binning[DATUM, Counting, U, O, N]]]): FractionedHistogramMethodsAscii =
new FractionedHistogramMethodsAscii(anySelectingBinningToFractionedHistogramMethods(hist).fractioned)
implicit def anySparselyBinnedToFractionedHistogramMethodsAscii[N <: Container[N] with NoAggregation](hist: Fractioned[SparselyBinned[Counted, N]]): FractionedHistogramMethodsAscii =
implicit def anySparselyBinnedToFractionedHistogramMethodsAscii[N <: Container[N] with NoAggregation](hist: Fractioned[SparselyBinned[Counted, N], SparselyBinned[Counted, N]]): FractionedHistogramMethodsAscii =
new FractionedHistogramMethodsAscii(anySparselyBinnedToFractionedHistogramMethods(hist).fractioned)
implicit def anySparselyBinningToFractionedHistogramMethodsAscii[DATUM, N <: Container[N] with Aggregation{type Datum >: DATUM}](hist: Fractioning[DATUM, SparselyBinning[DATUM, Counting, N]]): FractionedHistogramMethodsAscii =
new FractionedHistogramMethodsAscii(anySparselyBinningToFractionedHistogramMethods(hist).fractioned)
implicit def anySelectedSparselyBinnedToFractionedHistogramMethodsAscii[N <: Container[N] with NoAggregation](hist: Fractioned[Selected[SparselyBinned[Counted, N]]]): FractionedHistogramMethodsAscii =
implicit def anySelectedSparselyBinnedToFractionedHistogramMethodsAscii[N <: Container[N] with NoAggregation](hist: Fractioned[Selected[SparselyBinned[Counted, N]], Selected[SparselyBinned[Counted, N]]]): FractionedHistogramMethodsAscii =
new FractionedHistogramMethodsAscii(anySelectedSparselyBinnedToFractionedHistogramMethods(hist).fractioned)
implicit def anySelectingSparselyBinningToFractionedHistogramMethodsAscii[DATUM, N <: Container[N] with Aggregation{type Datum >: DATUM}](hist: Fractioning[DATUM, Selecting[DATUM, SparselyBinning[DATUM, Counting, N]]]): FractionedHistogramMethodsAscii =
new FractionedHistogramMethodsAscii(anySelectingSparselyBinningToFractionedHistogramMethods(hist).fractioned)

class FractionedHistogramMethodsAscii(val fractioned: Fractioned[Selected[Binned[Counted, Counted, Counted, Counted]]]) {
class FractionedHistogramMethodsAscii(val fractioned: Fractioned[Selected[Binned[Counted, Counted, Counted, Counted]], Selected[Binned[Counted, Counted, Counted, Counted]]]) {
/** Print an ASCII representation of a histogram for debugging on headless systems. Limited to 80 columns. */
def println {
println({(n: Double, d: Double, z: Double) => n/d}, 80)
Expand Down
12 changes: 6 additions & 6 deletions core/src/main/scala/org/dianahep/histogrammar/defs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ package object histogrammar {
}

implicit class StringIndex(val string: String) extends CollectionIndex {
override def toString() = "\"" + scala.util.parsing.json.JSONFormat.quoteString(string) + "\""
override def toString() = "\"" + string + "\""
}
object StringIndex {
def unapply(x: StringIndex) = Some(x.string)
Expand Down Expand Up @@ -1049,32 +1049,32 @@ package object histogrammar {

//////////////////////////////////////////////////////////////// methods for FractionedHistogram

implicit def anyBinnedToFractionedHistogramMethods[U <: Container[U] with NoAggregation, O <: Container[O] with NoAggregation, N <: Container[N] with NoAggregation](hist: Fractioned[Binned[Counted, U, O, N]]): FractionedHistogramMethods =
implicit def anyBinnedToFractionedHistogramMethods[U <: Container[U] with NoAggregation, O <: Container[O] with NoAggregation, N <: Container[N] with NoAggregation](hist: Fractioned[Binned[Counted, U, O, N], Binned[Counted, U, O, N]]): FractionedHistogramMethods =
new FractionedHistogramMethods(new Fractioned(hist.entries, hist.quantityName, anyBinnedToHistogramMethods(hist.numerator).selected, anyBinnedToHistogramMethods(hist.denominator).selected))

implicit def anyBinningToFractionedHistogramMethods[DATUM, U <: Container[U] with Aggregation{type Datum >: DATUM}, O <: Container[O] with Aggregation{type Datum >: DATUM}, N <: Container[N] with Aggregation{type Datum >: DATUM}](hist: Fractioning[DATUM, Binning[DATUM, Counting, U, O, N]]): FractionedHistogramMethods =
anyBinnedToFractionedHistogramMethods(hist.toImmutable)

implicit def anySelectedBinnedToFractionedHistogramMethods[U <: Container[U] with NoAggregation, O <: Container[O] with NoAggregation, N <: Container[N] with NoAggregation](hist: Fractioned[Selected[Binned[Counted, U, O, N]]]): FractionedHistogramMethods =
implicit def anySelectedBinnedToFractionedHistogramMethods[U <: Container[U] with NoAggregation, O <: Container[O] with NoAggregation, N <: Container[N] with NoAggregation](hist: Fractioned[Selected[Binned[Counted, U, O, N]], Selected[Binned[Counted, U, O, N]]]): FractionedHistogramMethods =
new FractionedHistogramMethods(new Fractioned(hist.entries, hist.quantityName, anySelectedBinnedToHistogramMethods(hist.numerator).selected, anySelectedBinnedToHistogramMethods(hist.denominator).selected))

implicit def anySelectingBinningToFractionedHistogramMethods[DATUM, U <: Container[U] with Aggregation{type Datum >: DATUM}, O <: Container[O] with Aggregation{type Datum >: DATUM}, N <: Container[N] with Aggregation{type Datum >: DATUM}](hist: Fractioning[DATUM, Selecting[DATUM, Binning[DATUM, Counting, U, O, N]]]): FractionedHistogramMethods =
anySelectedBinnedToFractionedHistogramMethods(hist.toImmutable)

implicit def anySparselyBinnedToFractionedHistogramMethods[N <: Container[N] with NoAggregation](hist: Fractioned[SparselyBinned[Counted, N]]): FractionedHistogramMethods =
implicit def anySparselyBinnedToFractionedHistogramMethods[N <: Container[N] with NoAggregation](hist: Fractioned[SparselyBinned[Counted, N], SparselyBinned[Counted, N]]): FractionedHistogramMethods =
new FractionedHistogramMethods(new Fractioned(hist.entries, hist.quantityName, anySparselyBinnedToHistogramMethods(hist.numerator).selected, anySparselyBinnedToHistogramMethods(hist.denominator).selected))

implicit def anySparselyBinningToFractionedHistogramMethods[DATUM, N <: Container[N] with Aggregation{type Datum >: DATUM}](hist: Fractioning[DATUM, SparselyBinning[DATUM, Counting, N]]): FractionedHistogramMethods =
anySparselyBinnedToFractionedHistogramMethods(hist.toImmutable)

implicit def anySelectedSparselyBinnedToFractionedHistogramMethods[N <: Container[N] with NoAggregation](hist: Fractioned[Selected[SparselyBinned[Counted, N]]]): FractionedHistogramMethods =
implicit def anySelectedSparselyBinnedToFractionedHistogramMethods[N <: Container[N] with NoAggregation](hist: Fractioned[Selected[SparselyBinned[Counted, N]], Selected[SparselyBinned[Counted, N]]]): FractionedHistogramMethods =
new FractionedHistogramMethods(new Fractioned(hist.entries, hist.quantityName, anySelectedSparselyBinnedToHistogramMethods(hist.numerator).selected, anySelectedSparselyBinnedToHistogramMethods(hist.denominator).selected))

implicit def anySelectingSparselyBinningToFractionedHistogramMethods[DATUM, N <: Container[N] with Aggregation{type Datum >: DATUM}](hist: Fractioning[DATUM, Selecting[DATUM, SparselyBinning[DATUM, Counting, N]]]): FractionedHistogramMethods =
anySelectedSparselyBinnedToFractionedHistogramMethods(hist.toImmutable)

/** Methods that are implicitly added to container combinations that look like fractioned histograms. */
class FractionedHistogramMethods(val fractioned: Fractioned[Selected[Binned[Counted, Counted, Counted, Counted]]]) {
class FractionedHistogramMethods(val fractioned: Fractioned[Selected[Binned[Counted, Counted, Counted, Counted]], Selected[Binned[Counted, Counted, Counted, Counted]]]) {
def numeratorBinned = fractioned.numerator.cut
def denominatorBinned = fractioned.denominator.cut

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

package org.dianahep

import scala.language.existentials

import org.dianahep.histogrammar.json._
import org.dianahep.histogrammar.util._

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

package org.dianahep

import scala.language.existentials

import scala.reflect.classTag
import scala.reflect.ClassTag

Expand Down
Loading