npy

NPY and NPZ support for the JVM

Лицензия

Лицензия

Группа

Группа

org.jetbrains.bio
Идентификатор

Идентификатор

npy
Последняя версия

Последняя версия

0.3.5
Дата

Дата

Тип

Тип

jar
Описание

Описание

npy
NPY and NPZ support for the JVM
Ссылка на сайт

Ссылка на сайт

https://github.com/JetBrains-Research/npy
Система контроля версий

Система контроля версий

https://github.com/JetBrains-Research/npy

Скачать npy

Имя Файла Размер
npy-0.3.5.pom
npy-0.3.5.jar 70 KB
npy-0.3.5-sources.jar 10 KB
npy-0.3.5-javadoc.jar 40 KB
Обзор

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.jetbrains.bio/npy/ -->
<dependency>
    <groupId>org.jetbrains.bio</groupId>
    <artifactId>npy</artifactId>
    <version>0.3.5</version>
</dependency>
// https://jarcasting.com/artifacts/org.jetbrains.bio/npy/
implementation 'org.jetbrains.bio:npy:0.3.5'
// https://jarcasting.com/artifacts/org.jetbrains.bio/npy/
implementation ("org.jetbrains.bio:npy:0.3.5")
'org.jetbrains.bio:npy:jar:0.3.5'
<dependency org="org.jetbrains.bio" name="npy" rev="0.3.5">
  <artifact name="npy" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.jetbrains.bio', module='npy', version='0.3.5')
)
libraryDependencies += "org.jetbrains.bio" % "npy" % "0.3.5"
[org.jetbrains.bio/npy "0.3.5"]

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
org.jetbrains.kotlin : kotlin-stdlib jar 1.4.21

test (2)

Идентификатор библиотеки Тип Версия
org.jetbrains.kotlin : kotlin-test jar 1.4.21
junit : junit jar 4.13.1

Модули Проекта

Данный проект не имеет модулей.

JetBrains Research Tests Status Maven Central

npy

npy allows to read and write files in NPY npy and [NPZ] npy formats on the JVM.

Installation

The latest version of npy is available on [Maven Central] maven-central. If you're using Gradle just add the following to your build.gradle:

repositories {
    mavenCentral()
}

dependencies {
    compile 'org.jetbrains.bio:npy:0.3.5'
}

With Maven, specify the following in your pom.xml:

<dependency>
  <groupId>org.jetbrains.bio</groupId>
  <artifactId>npy</artifactId>
  <version>0.3.5</version>
</dependency>

The previous versions were published on Bintray. They can be downloaded from GitHub Releases.

Examples

NPY

val values = intArrayOf(1, 2, 3, 4, 5, 6)
val path = Paths.get("sample.npy")
NpyFile.write(path, values, shape = intArrayOf(2, 3))

println(NpyFile.read(path))
// => NpyArray{data=[1, 2, 3, 4, 5, 6], shape=[2, 3]}

NPZ

val values1 = intArrayOf(1, 2, 3, 4, 5, 6)
val values2 = booleanArrayOf(true, false)
val path = Paths.get("sample.npz")

NpzFile.write(path).use {
    it.write("xs", values1, shape = intArrayOf(2, 3))
    it.write("mask", values2)
}

NpzFile.read(path).use {
    println(it.introspect())
    // => [NpzEntry{name=xs, type=int, shape=[2, 3]},
    //     NpzEntry{name=mask, type=boolean, shape=[2]}]

    println("xs   = ${it["xs"]}")
    println("mask = ${it["mask"]}")
    // => xs   = NpyArray{data=[1, 2, 3, 4, 5, 6], shape=[2, 3]}
    //    mask = NpyArray{data=[true, false], shape=[2]}
}

Limitations

The implementation is rather minimal at the moment. Specifically it does not support the following types:

  • unsigned integral types (treated as signed),
  • bit field,
  • complex,
  • object,
  • Unicode
  • void*
  • intersections aka types for structured arrays.

Building from source

The build process is as simple as

$ ./gradlew jar

Note: don't use ./gradlew assemble, since it includes the signing of the artifacts and will fail if the correct credentials are not provided.

Testing

No extra configuration is required for running the tests from Gradle

$ ./gradlew test

However, some tests require Python and NumPy to run and will be skipped unless you have these.

org.jetbrains.bio

Версии библиотеки

Версия
0.3.5