Giter VIP home page Giter VIP logo

squants's People

Contributors

acarrasco avatar allanrenucci avatar armanbilge avatar buzden avatar cquiroz avatar cranst0n avatar darkfrog26 avatar davedecaprio avatar derekmorr avatar fnussber avatar garykeorkunian avatar golem131 avatar hunterpayne avatar jhnsmth avatar julienrf avatar larsrh avatar lasering avatar lukoyanov avatar martijnblankestijn avatar nornagon avatar nvinuesa avatar philipaxelrod avatar psung avatar robotsnowfall avatar scala-steward avatar shadaj avatar tel avatar thyandrecardoso avatar typelevel-steward[bot] avatar ybasket avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

squants's Issues

Irradiance division

I wanted to check if this is a bug or is it by design. On Irradiance we can divide by power as in here

We can see that the function is defined as

def /(that: Power): Area

however irradiance is power/area and dividing by power doesn't give you area but 1/area.

Am I missing something?

Provide information on type level if e.g. one dimension is the product of two other dimensions

Hi @garyKeorkunian,

I would like to use squants in a type-class based setting where it is important to keep track on a type level if e.g. two values of two different types can be multiplied to get a value of a third type.
I would like to derive something like the CanMultiply class in the following (hugely simplified) example:

implicit def createMultiplication[InDim1, InDim2, OutDim](implicit canMultiply: CanMultiply[InDim1, InDim2, OutDim]) = new Multiplication[InDim1, InDim2, OutDim](...)

val areaMultiplication: Multiplication[Length, Length, Area] = implicitly
val areaDensityMultiplication: Multiplication[Density, Length, AreaDensity] = implicitly

Skimming through the code I haven't found any hint that dimensions are actually tracked on a type level.
Is something like this planned?
Would you accept a PR if I find the time to create one?

problem with custom DataRateUnit

why does the following custom DataRateUnit lead to the wrong result?

  object GibibytesPerDay extends DataRateUnit {
    val symbol = "GiB/d"
    val conversionFactor = Gibibytes.conversionFactor / Days.conversionFactor
  }

manual test code:

    val averageDataRate: DataRate = MebibytesPerSecond(4096)
    println(averageDataRate in MebibytesPerSecond)
    println(averageDataRate in GibibytesPerSecond)
    println(averageDataRate in GibibytesPerDay)
    println( 4 * 60 * 60 * 24)

The third line (GibibytesPerDay) is off by a factor of 1000.

It can be corrected by

object GibibytesPerDay extends DataRateUnit {
    val symbol = "GiB/d"
    val conversionFactor = Gibibytes.conversionFactor / (Days.conversionFactor / Seconds.conversionFactor)
  }

but it is a bit counterintuitive.

Is there a better way to create custom DataRateUnits ?

Generic quantities support

It would be nice if Squants provided a parallel set of generic types for working with other kinds of numbers besides Double, or supported generic types in some other way.

I'm not sure exactly what this would look like, or if this is a realistic goal for the project, but there are definitely types in Spire (Rational, Real, Complex[_], Interval[_], and so on) that would be really useful for dimensional analysis.

squants.information and 0.6.1-SNAPSHOT

Hi, I'm working on a project that uses your preliminary support for storage units of measurement. When I started using same, the package was named squants.storage. Now it is squants.information.

When I try to use your snapshot builds for my own project, https://github.com/LoyolaChicagoCode/blockperf-scala, which does builds for 2.10 and 2.11 of Scala against your 0.6.1-SNAPSHOT, it seems like the 2.10 build for squants has not been updated. This might be because your 2.10 build didn't get pushed to bintray.

Here is where my own build is getting tripped up when trying to build the 2.10.6 version:

$ sbt '+ package'
[info] Loading project definition from /Users/gkt/Work/blockperf-scala/project
[info] Set current project to blockperf (in build file:/Users/gkt/Work/blockperf-scala/)
[info] Setting version to 2.10.6
[info] Reapplying settings...
[info] Set current project to blockperf (in build file:/Users/gkt/Work/blockperf-scala/)
[info] Compiling 1 Scala source to /Users/gkt/Work/blockperf-scala/target/scala-2.10/classes...
[error] /Users/gkt/Work/blockperf-scala/src/main/scala/blockperf/Performance.scala:2: object information is not a member of package squants
[error] import squants.information._
[error]                ^
[error] /Users/gkt/Work/blockperf-scala/src/main/scala/blockperf/Performance.scala:16: not found: value Bytes
[error]     val used = Bytes(m) in Megabytes
[error]                ^
[error] /Users/gkt/Work/blockperf-scala/src/main/scala/blockperf/Performance.scala:17: not found: value Bytes
[error]     val free = Bytes(Runtime.getRuntime.freeMemory) in Gigabytes
[error]                ^
[error] /Users/gkt/Work/blockperf-scala/src/main/scala/blockperf/Performance.scala:18: not found: value Bytes
[error]     val total = Bytes(Runtime.getRuntime.totalMemory) in Gigabytes
[error]                 ^
[error] four errors found
[error] (compile:compileIncremental) Compilation failed
[error] Total time: 1 s, completed Mar 10, 2016 3:38:48 PM

Dimensional Conversion of Vectors

Evaluate and implement one of the experimental strategies for applying conversions to support multiply, divide and dotProduct operations between QuantityVectors and other quantity types.

The goal is to allow for the following type of operation:

val lengthVector = QuantityVector(Meters(1), Meters(2), Meters(3))
val areaVector = lengthVector * Meters(2)
assert (areaVector == 
  QuantityVector(
    SquareMeters(2), 
    SquareMeters(4), 
    SquareMeters(6))) 

There are currently three strategies partially implemented with tests and marked as experimental. These can be found in Vector.scala and VectorSpec.scala.

Add stone mass unit

In the UK, the stone (14 pounds) is commonly used to express body weight. Squants should support this unif of mass. A PR is forthcoming.

Provide conversions for Int in addition to Double

scala> val foo: Double = 4
foo: Double = 4.0

scala> foo C
res1: squants.thermal.Celsius = 4.0°C

scala> val foo: Int = 4
foo: Int = 4

scala> foo C
<console>:199: error: value C is not a member of Int
              foo C
                  ^

Update motion package

Refactor case classes with component values to final class with single value and QuantityCompanion

Support Rankine temperature scale

Currently the thermal package does not support the Rankine scale. While Rankine isn't very popular, I gather it is still used in some areas, and supporting it is straightforward.

master doesn't build

[error] /Users/nornagon/work/squants/src/main/scala/squants/space/Volume.scala:27: illegal cyclic reference involving class VolumeFlowRate
[error]     with TimeIntegral[VolumeFlowRate] {
[error]                       ^

JSON Marshalling and Serialization Tests

Add tests to ensure that all types support basic JSON marshalling / serialization

This may reveal the need (or desire) to create companion projects for specific JSON frameworks (ie, squants-json4s)

Support Troy Units and Carats

Many industries measure mass of precious metals and gemstones in troy units and carats. We should support those units. A PR is forthcoming.

Fix sbt.publish and sbt.console issues

The recent introduction of the ScalaJS, broke the publish and console features.

This needs to be corrected so that new versions can be properly published and the Squants REPL returns to normal operation.

Update electro package

Refactor case classes with component values to final class with single value and QuantityCompanion

Microliters

Hey! I'm replacing another measures library internally with squants, and we use microliters a lot (for biology). It'd be great to have that included by default in squants!

1.0.0 Release

We should figure out if any of the remaining tickets need to be addressed before an official 1.0.0 release is made. I'd prefer to get this done ASAP to avoid depending on a SNAPSHOT.

Are there any tickets that specifically need to be addressed before the current status is considered "stable"?

Update public site

The site at www.squants.com still references the old organization and version. The gh-pages branch contains raw html for the pages instead of a jekyll site

What do you think about migrating to sbt-microsites I'd really like the documentation to be typechecked with tut. This is also suggested by typelevel at

https://github.com/typelevel/general/blob/master/governance/membership.md

I'm not sure how to keep the nice layout of the current site with sbt-microsites though

Does not save values in the units used to create them

$ sbt console
scala> Kilowatts(1200)
res3: squants.energy.Power = 1.2 MW
scala> Microlitres(20000)
res2: squants.space.Volume = 2.0E-5 m³

This is causing havoc with serialization tests in my project (since things don't round-trip from JSON back to JSON).

The README claims that "Quantity values are based in the units used to create them", but this does not seem to be the case.

Why Price[Energy] is not a Quantity?

Hi,

I was going to code a TimeSeries class for the Energy domain enforcing that values in the timeseries must be of type [A <: Quantity[A]]. So far so good but then I tried to create a TimeSeries of Price[Energy] and it happens that a Ratio is not a quantity. Digging deeper I see other "Ratio" quantities like Velocity having its own non-derived types.
Is this something by design or something that could be improved in current implementation? Should I create an EnergyPrice type like the one in Velocity? Is it something maybe related to #127 ?

Regards.

Conversion between m/s^2 and EarthGravities possibly invalid

scala> val ok = 10.metres / second / second
ok: squants.motion.Acceleration = 10.0 m/s²

scala> val o2k = EarthGravities(10.metres / second / second)
o2k: squants.motion.Acceleration = 10.0 g

EarthGravities(ok)
res8: squants.motion.Acceleration = 10.0 g

Shouldn't this result in ~1g ? I've only just picked up the library just now, please excuse me if I'm misunderstanding something fundamental here.

Seek new maintainers, fork into Typelevel github organization and publish under org.typelevel

Following up on #137, this is a call for new maintainers under the typelevel github organization. Other than @garyKeorkunian the current contributors are listed as,

and it'd be good to see one or more of them step forward. I imagine that everyone who has commented on #137 is also a stakeholder in some sense so they would be very welcome to step forward too.

Given that @garyKeorkunian approached Typelevel for member status I think it's appropriate to continue the project in the Typelevel organization. That being the case I think it would be good if volunteer maintainers shared that commitment.

Can't use Power in collection sum method

scala> Kilowatts(10)
res0: squants.energy.Power = 10.0 kW

scala> Kilowatts(20
| )
res1: squants.energy.Power = 20.0 kW

scala> List(res0, res1)
res2: List[squants.energy.Power] = List(10.0 kW, 20.0 kW)

scala> res2.sum
:156: error: could not find implicit value for parameter num: Numeric[squants.energy.Power]
res2.sum

Kinetic energy calculations

Hi,

I'm trying to use squants to do some kinetic energy calculations :

val v1 = Meters(1.0)/Seconds(1.0)
val m1 = Kilograms(1.0)

val ek1 = 1/2 * m1 * v1 * v1
val ek2 = 1/2 * m1 * (v1 * v1)

But the last two lines don't compile (ek1 because operator * is not define between one momentum and one velocity and ek2 because operator * is not define between two velocities).

Maybe I did something wrong, but I'm wondering if there is a way to do some kinetic energy calculations without define new operator *.

ScalaJS?

Adding information in different units is a part of many user-interfaces and is often validated on a frontend. I wonder, do you have any plans of cross-releasing to ScalaJS?

Update radio package

Refactor case classes with component values to final class with single value and QuantityCompanion

multiplication with TimeDerivative is not supported

Would it be possible to support multiplication with a TimeDerivative like Frequency ?

here is an example:

    val averageMessageSize: Information = Bytes(600)
    println(averageMessageSize)

    val messageRate: Frequency = Each(7000) / Seconds(1)
    println(messageRate)

    // A * Frequency is not supported
    // following doesn't compile:
    //    val averageDataRate: DataRate = averageMessageSize * messageRate
    // But A / Time is supported, so convert Frequency to Time and divide
    val averageDataRate: DataRate = averageMessageSize / (Each(1) / messageRate)
    println(averageDataRate in MebibytesPerSecond)

Cross compile to Scala.js

Thanks for this great library.

I kindly request to publish it cross-compiled to Scala.js so that it can be used in hybrid (Scala/Scala.js) projects.

Thank you!

MoneyNumeric

Money types don't have a Numeric implicit object. This seems to be hindered by the fact that AbstractQuantityNumeric requires a valueUnit instance that can apply from an Int, while money can be created from Double or BigDecimal. Alternately, I'm just missing something trivial :)

1.0.0-SNAPSHOT is empty

The snapshot release JAR on Sonatype Snapshots is empty apart from the META-INF directory.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.