https://github.com/aplbrain/npyjs

Read numpy .npy files in JavaScript

https://github.com/aplbrain/npyjs

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.4%) to scientific vocabulary

Keywords

3d javascript jhuapl nodejs npy npy-files numpy

Keywords from Contributors

interactive tensor deep-neural-network distributed autograd archival projection sequences observability hacking
Last synced: 6 months ago · JSON representation

Repository

Read numpy .npy files in JavaScript

Basic Info
Statistics
  • Stars: 89
  • Watchers: 7
  • Forks: 22
  • Open Issues: 13
  • Releases: 3
Topics
3d javascript jhuapl nodejs npy npy-files numpy
Created over 9 years ago · Last pushed 6 months ago
Metadata Files
Readme Changelog License

README.md

npy.js

Read .npy files directly in JS

GitHub Workflow Status

Read .npy files from numpy in Node/JS.

Installation

Include npy.js in your project directly, or:

```shell yarn add npyjs

npm i npyjs

```

Import

javascript import npyjs from "npyjs";

Usage

  • Create a new npyjs object:

javascript let n = new npyjs(); // Or with options: let n = new npyjs({ convertFloat16: false }); // Disable float16 to float32 conversion

  • This object can now be used load .npy files. Arrays can be returned via a JavaScript callback, so usage looks like this:

javascript n.load("my-array.npy", (array, shape) => { // `array` is a one-dimensional array of the raw data // `shape` is a one-dimensional array that holds a numpy-style shape. console.log(`You loaded an array with ${array.length} elements and ${shape.length} dimensions.`); });

  • You can also use this library promise-style using either .then or async await:

javascript n.load("test.npy").then((res) => { // res has { data, shape, dtype } members. });

javascript const npyArray = await n.load("test.npy");

Accessing multidimensional array elements

  • You can conveniently access multidimensional array elements using the 'ndarray' library:

javascript import ndarray from "ndarray"; const npyArray = ndarray(data, shape); npyArray.get(10, 15);

Supported Data Types

The library supports the following NumPy data types:

  • int8, uint8
  • int16, uint16
  • int32, uint32
  • int64, uint64 (as BigInt)
  • float32
  • float64
  • float16 (converted to float32 by default)

Float16 Support

By default, float16 arrays are automatically converted to float32 for compatibility, since JavaScript doesn't natively support float16. You can control this behavior with the constructor options:

javascript // Default behavior - float16 is converted to float32 const n1 = new npyjs(); // Keep float16 as raw uint16 values without conversion const n2 = new npyjs({ convertFloat16: false });

Unless otherwise specified, all code inside of this repository is covered under the license in LICENSE.

Please report bugs or contribute pull-requests on GitHub.


Made with ♥ at JHU APL

Owner

  • Name: APL BRAIN
  • Login: aplbrain
  • Kind: organization

GitHub Events

Total
  • Issues event: 1
  • Watch event: 10
  • Delete event: 1
  • Issue comment event: 13
  • Push event: 4
  • Pull request event: 6
  • Fork event: 1
  • Create event: 2
Last Year
  • Issues event: 1
  • Watch event: 10
  • Delete event: 1
  • Issue comment event: 13
  • Push event: 4
  • Pull request event: 6
  • Fork event: 1
  • Create event: 2

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 77
  • Total Committers: 12
  • Avg Commits per committer: 6.417
  • Development Distribution Score (DDS): 0.299
Past Year
  • Commits: 5
  • Committers: 4
  • Avg Commits per committer: 1.25
  • Development Distribution Score (DDS): 0.6
Top Committers
Name Email Commits
Jordan Matelsky j****8@g****m 54
dependabot[bot] 4****] 12
eric.lwh e****h@a****m 2
koreanwglasses k****s@g****m 1
epbsb 5****b 1
Tristan Rice r****e@f****c 1
Roberts Slisans r****s@g****m 1
Radu-Sebastian Amarie r****e@g****m 1
Philippe Rivière f****l@r****t 1
James Hughes 7****2 1
Ha-limLee 6****e 1
Aditya Sarwade 6****e 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 18
  • Total pull requests: 37
  • Average time to close issues: 3 months
  • Average time to close pull requests: 5 days
  • Total issue authors: 17
  • Total pull request authors: 14
  • Average comments per issue: 2.61
  • Average comments per pull request: 0.78
  • Merged pull requests: 29
  • Bot issues: 0
  • Bot pull requests: 15
Past Year
  • Issues: 0
  • Pull requests: 6
  • Average time to close issues: N/A
  • Average time to close pull requests: 3 days
  • Issue authors: 0
  • Pull request authors: 4
  • Average comments per issue: 0
  • Average comments per pull request: 0.5
  • Merged pull requests: 3
  • Bot issues: 0
  • Bot pull requests: 2
Top Authors
Issue Authors
  • rmorshea (2)
  • AdityaSarwade (1)
  • TheNewSound (1)
  • armsp (1)
  • lixiaofa-lab (1)
  • Ricerob (1)
  • Fil (1)
  • jeffpeck10x (1)
  • borismus (1)
  • 1wheel (1)
  • bgutter (1)
  • jhughes982 (1)
  • rsxdalv (1)
  • wolfiex (1)
  • esperanc (1)
Pull Request Authors
  • dependabot[bot] (15)
  • j6k4m8 (7)
  • vallsv (2)
  • eek (2)
  • epbsb (2)
  • rsxdalv (1)
  • jhughes982 (1)
  • 1wheel (1)
  • Ha-limLee (1)
  • sebaB003 (1)
  • WenheLI (1)
  • Fil (1)
  • d4l3k (1)
  • AdityaSarwade (1)
Top Labels
Issue Labels
Pull Request Labels
dependencies (15)

Dependencies

package-lock.json npm
  • @ungap/promise-all-settled 1.1.2 development
  • ansi-colors 4.1.1 development
  • ansi-regex 3.0.1 development
  • ansi-regex 5.0.1 development
  • ansi-styles 4.3.0 development
  • anymatch 3.1.2 development
  • argparse 2.0.1 development
  • balanced-match 1.0.2 development
  • binary-extensions 2.2.0 development
  • brace-expansion 1.1.11 development
  • braces 3.0.2 development
  • browser-stdout 1.3.1 development
  • camelcase 6.3.0 development
  • chalk 4.1.2 development
  • chokidar 3.5.1 development
  • cliui 7.0.4 development
  • color-convert 2.0.1 development
  • color-name 1.1.4 development
  • concat-map 0.0.1 development
  • debug 4.3.1 development
  • decamelize 4.0.0 development
  • diff 5.0.0 development
  • emoji-regex 8.0.0 development
  • escalade 3.1.1 development
  • escape-string-regexp 4.0.0 development
  • fill-range 7.0.1 development
  • find-up 5.0.0 development
  • flat 5.0.2 development
  • fs.realpath 1.0.0 development
  • fsevents 2.3.2 development
  • get-caller-file 2.0.5 development
  • glob 7.1.6 development
  • glob-parent 5.1.2 development
  • growl 1.10.5 development
  • has-flag 4.0.0 development
  • he 1.2.0 development
  • inflight 1.0.6 development
  • inherits 2.0.4 development
  • is-binary-path 2.1.0 development
  • is-extglob 2.1.1 development
  • is-fullwidth-code-point 3.0.0 development
  • is-fullwidth-code-point 2.0.0 development
  • is-glob 4.0.3 development
  • is-number 7.0.0 development
  • is-plain-obj 2.1.0 development
  • isexe 2.0.0 development
  • js-yaml 4.0.0 development
  • locate-path 6.0.0 development
  • log-symbols 4.0.0 development
  • minimatch 3.0.4 development
  • mocha 8.4.0 development
  • ms 2.1.2 development
  • ms 2.1.3 development
  • nanoid 3.1.20 development
  • normalize-path 3.0.0 development
  • once 1.4.0 development
  • p-limit 3.1.0 development
  • p-locate 5.0.0 development
  • path-exists 4.0.0 development
  • path-is-absolute 1.0.1 development
  • picomatch 2.3.1 development
  • randombytes 2.1.0 development
  • readdirp 3.5.0 development
  • require-directory 2.1.1 development
  • safe-buffer 5.2.1 development
  • serialize-javascript 5.0.1 development
  • string-width 2.1.1 development
  • string-width 4.2.3 development
  • strip-ansi 4.0.0 development
  • strip-ansi 6.0.1 development
  • strip-json-comments 3.1.1 development
  • supports-color 7.2.0 development
  • supports-color 8.1.1 development
  • to-regex-range 5.0.1 development
  • which 2.0.2 development
  • wide-align 1.1.3 development
  • workerpool 6.1.0 development
  • wrap-ansi 7.0.0 development
  • wrappy 1.0.2 development
  • y18n 5.0.8 development
  • yargs 16.2.0 development
  • yargs-parser 20.2.4 development
  • yargs-parser 20.2.9 development
  • yargs-unparser 2.0.0 development
  • yocto-queue 0.1.0 development
  • cross-fetch 3.1.5
  • node-fetch 2.6.7
  • tr46 0.0.3
  • webidl-conversions 3.0.1
  • whatwg-url 5.0.0
package.json npm
  • mocha ^8.4.0 development
  • cross-fetch ^3.1.5
yarn.lock npm
  • @ungap/promise-all-settled 1.1.2
  • ansi-colors 4.1.1
  • ansi-regex 3.0.1
  • ansi-regex 5.0.1
  • ansi-styles 4.3.0
  • anymatch 3.1.2
  • argparse 2.0.1
  • balanced-match 1.0.2
  • binary-extensions 2.2.0
  • brace-expansion 1.1.11
  • braces 3.0.2
  • browser-stdout 1.3.1
  • camelcase 6.3.0
  • chalk 4.1.2
  • chokidar 3.5.1
  • cliui 7.0.4
  • color-convert 2.0.1
  • color-name 1.1.4
  • concat-map 0.0.1
  • cross-fetch 3.1.5
  • debug 4.3.1
  • decamelize 4.0.0
  • diff 5.0.0
  • emoji-regex 8.0.0
  • escalade 3.1.1
  • escape-string-regexp 4.0.0
  • fill-range 7.0.1
  • find-up 5.0.0
  • flat 5.0.2
  • fs.realpath 1.0.0
  • fsevents 2.3.2
  • get-caller-file 2.0.5
  • glob 7.1.6
  • glob-parent 5.1.2
  • growl 1.10.5
  • has-flag 4.0.0
  • he 1.2.0
  • inflight 1.0.6
  • inherits 2.0.4
  • is-binary-path 2.1.0
  • is-extglob 2.1.1
  • is-fullwidth-code-point 2.0.0
  • is-fullwidth-code-point 3.0.0
  • is-glob 4.0.3
  • is-number 7.0.0
  • is-plain-obj 2.1.0
  • isexe 2.0.0
  • js-yaml 4.0.0
  • locate-path 6.0.0
  • log-symbols 4.0.0
  • minimatch 3.0.4
  • mocha 8.4.0
  • ms 2.1.2
  • ms 2.1.3
  • nanoid 3.1.20
  • node-fetch 2.6.7
  • normalize-path 3.0.0
  • once 1.4.0
  • p-limit 3.1.0
  • p-locate 5.0.0
  • path-exists 4.0.0
  • path-is-absolute 1.0.1
  • picomatch 2.3.1
  • randombytes 2.1.0
  • readdirp 3.5.0
  • require-directory 2.1.1
  • safe-buffer 5.2.1
  • serialize-javascript 5.0.1
  • string-width 2.1.1
  • string-width 4.2.3
  • strip-ansi 4.0.0
  • strip-ansi 6.0.1
  • strip-json-comments 3.1.1
  • supports-color 8.1.1
  • supports-color 7.2.0
  • to-regex-range 5.0.1
  • tr46 0.0.3
  • webidl-conversions 3.0.1
  • whatwg-url 5.0.0
  • which 2.0.2
  • wide-align 1.1.3
  • workerpool 6.1.0
  • wrap-ansi 7.0.0
  • wrappy 1.0.2
  • y18n 5.0.8
  • yargs 16.2.0
  • yargs-parser 20.2.4
  • yargs-parser 20.2.9
  • yargs-unparser 2.0.0
  • yocto-queue 0.1.0