Skip to content
No description, website, or topics provided.
Scala
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
project
src/main/scala/net/priimak/scala/data
.gitignore
LICENSE
NAMD-DCD-File-Format.md
README.md
build.sbt

README.md

Scala Data - Tools for reading various scientific data formats

At the moment this library contains very primitive Scala code for reading 1-dimensional numpy arrays from .npy files and NAMD generated dcd trajectory files.

NPY Arrays

Only a asmall subset of possible dataypes that can be stored in the .npy files is supported. Following table lists correspondance between supported numpy types their Scala types.

NPY Type Scala Type
u1 Int
i1 Byte
u2 Int
i2 Short
u4 Long
i4 Int
u8 Long
i8 Long
f4 Float
i8 Double

Due to the nature of library an explicit type conversion/declaration is required as is shown in the fowllowing example

import net.priimak.scala.data.npy._

val v: NPYVector[Int] = NPYVector.valueOf("voltage.npy")

If specified type does not match Scala type as defined in the table above then runtime error will be thrown at the time you access elements of the vector.

Numpy type (NPY Type) can also be retireved by calling NPYVector.npyType() method.

Class NPYVector extends from the IndexedSeq and therefore has access to all methods of Scala collection API.

NUMD DCD Trajectory files

The library is capable of reading 32bit DCD trajectory files generated by the NAMD application. It can be used like so

import net.priimak.scala.data.dcd._

val dcd = DCD.valueOf("dry.dcd")
val xAverage = dcd.atom(100).map(_.x).sum/dcd.frames

Where method atom($index) returns sequence of coordinates (class Coord)

You can’t perform that action at this time.