normcore 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/normcore +15 -0
  3. data/readme.md +84 -0
  4. metadata +7 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 62078ad0b3ab7a5cd12a10eafbeddb120117fa38
4
- data.tar.gz: 2d232fadddaa878ca0899864c1c9db4ff3750e23
3
+ metadata.gz: 9c502650d879b7e1a3abe572df1fd06dd40fc031
4
+ data.tar.gz: 06a4a322e7a4a72f33278e437408ebbbbf0e41e3
5
5
  SHA512:
6
- metadata.gz: bf013bba69a41da90a5ed30d267668e5277892788dd4294165190c7f0a7e8c98566275a45ae591ffb505d2254315636ee9731f4f9b598646991a291af3a07263
7
- data.tar.gz: c24e7d317730ebdd9f4d843efd327ce6308338942126cef49e2d4ad382e68c37b70bf2e4aa19b17e18643d2d844810c767eb7aef68d0f117d97d81a6e4019084
6
+ metadata.gz: d8f8bc52c6c8554e422f7d25c8bfc66a38c5b5cabb1781044c7d0a7e4883876c11bceea543b47707f7c529969f136a86ecd433000fee25fe318a70ca0ec57f42
7
+ data.tar.gz: efdf14f397960e6562355b0e3c2791d7911ccbb2efe6f479cd724a40ee57bc98d3237c1fc967345a1f43d0421f6bbc8f62f6ec04dac4f860b3915fa0d8a92f91
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'normcore'))
4
+
5
+ μ, σ = Float(ARGV[0]), Float(ARGV[1])
6
+
7
+ d = Normcore::Normal.new(μ, σ)
8
+
9
+ loop do
10
+ begin
11
+ puts d.rng
12
+ rescue Errno::EPIPE
13
+ exit 0
14
+ end
15
+ end
@@ -0,0 +1,84 @@
1
+ # Normcore
2
+
3
+ [![Build Status](https://travis-ci.org/pivotbio/normcore.svg?branch=master)](https://travis-ci.org/pivotbio/normcore)
4
+
5
+ Simple library for sampling from random distributions
6
+
7
+ - `Normcore::Normal` - Gaussian/normal distribution.
8
+ - `Normcore::LogNormal` - exp(Gaussian/normal) distribution.
9
+
10
+ ## Installation
11
+
12
+ RubyGems
13
+
14
+ ```bash
15
+ gem install normcore
16
+ ```
17
+
18
+ Bundler
19
+
20
+ ```ruby
21
+ gem 'normcore'
22
+ ```
23
+
24
+ ## Usage
25
+
26
+ ```ruby
27
+ require 'normcore'
28
+
29
+ # μ = 0, σ = 1
30
+ d = Normcore::Normal.new(0, 1)
31
+
32
+ # return an Array of 100 samples
33
+ d.sample(100)
34
+ ```
35
+
36
+ ## Bonus
37
+
38
+ You can use Normcore as an executable:
39
+
40
+
41
+ ```bash
42
+ normcore 0 1
43
+ ```
44
+
45
+ Using [bashplotlib](https://github.com/glamp/bashplotlib):
46
+
47
+ ```bash
48
+ bin/normcore 1 5 | head -n 10000 |hist normcore
49
+
50
+ 2177| o
51
+ 2062| oo
52
+ 1948| oo
53
+ 1833| oo
54
+ 1719| oo
55
+ 1604| ooo
56
+ 1490| ooo
57
+ 1375| oooo
58
+ 1261| oooo
59
+ 1146| oooo
60
+ 1031| oooo
61
+ 917| oooo
62
+ 802| ooooo
63
+ 688| oooooo
64
+ 573| oooooo
65
+ 459| oooooo
66
+ 344| ooooooo
67
+ 230| oooooooo
68
+ 115| oooooooo
69
+ 1| oooooooooooooo
70
+ --------------
71
+
72
+ -------------------------------
73
+ | Summary |
74
+ -------------------------------
75
+ | observations: 10000 |
76
+ | min value: -18.768871 |
77
+ | mean : 0.995957 |
78
+ | max value: 19.428214 |
79
+ -------------------------------
80
+ ```
81
+
82
+ ## License
83
+
84
+ MIT (see `LICENSE` for details)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: normcore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Austin Davis-Richardson
@@ -12,14 +12,18 @@ date: 2017-02-12 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Generate random numbers from a Normal/Gaussian distribution
14
14
  email: harekrishna@gmail.com
15
- executables: []
15
+ executables:
16
+ - normcore
16
17
  extensions: []
17
- extra_rdoc_files: []
18
+ extra_rdoc_files:
19
+ - readme.md
18
20
  files:
19
21
  - "./lib/base.rb"
20
22
  - "./lib/log_normal.rb"
21
23
  - "./lib/normal.rb"
22
24
  - "./lib/normcore.rb"
25
+ - bin/normcore
26
+ - readme.md
23
27
  homepage: https://github.com/pivotbio/normcore
24
28
  licenses:
25
29
  - MIT