datafarming 1.1.0 → 1.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 190ba17087fafc8f7308e5e4decbe18b412fb99342c4d55011ac28b01735d329
4
- data.tar.gz: 2c9da6d6824f2899904f076a4d6184279a272b04fd3fc979538f8809dde83328
3
+ metadata.gz: 1b7990952b921edf51b1e85246ee4069994acc3a7bb2dcf53f2b8cc523dcd24d
4
+ data.tar.gz: ce46677ee89cb2c30b0455704eb87691cb44aafb87e0f24ec92c01cb9956e74e
5
5
  SHA512:
6
- metadata.gz: 77347491591b5d18612832d102618a84897e4be99e96116b946e75b09a1b71e1bad19d2bf44fafa4afff122cce4a3146ad9113731147e27c6e3fb3e47173c8bb
7
- data.tar.gz: c1a8f5d16b081d94731abb8e7c0cf6e6550a4e9929ddd6218e2b5e81cca25f9cf66789400173b510cd3c50143e8379d95966888e4d844c1651880c8aac0449d0
6
+ metadata.gz: 6f120f08238de3b7e950805c922cda8bb7a4385dc8220d22fcca7c2d7f4a5b32f3c39d640c429cc99e7bb96b63faa53a035f2ea63fdfb88026bf1becba131185
7
+ data.tar.gz: 461730ca7faf44c747c83684da6ca7c60b41c26c6cd26c749ef7ef04b9c6d2b6ce994afb95d767a544971e628f0ba1835ed8b1ead11be4167871d0bf3007b029
data/README.md CHANGED
@@ -37,8 +37,12 @@ run a model interactively with replication
37
37
  run control to replicate a designed experiment with a model
38
38
  - `pool_files.rb` —
39
39
  pool columns from separate files into a new file, useful for combining design file & output files or multiple output files
40
+ - `scaled_fde.rb` —
41
+ generate fully orthogonal quadratic designs based on discrete Fourier frequencies, with factor scaling
42
+ - `scaled_rf_cubed.rb` —
43
+ generate 2-level Resolution V fractional factorial designs and Central Composite Designs (CCDs), with factor scaling
40
44
  - `stack_nolhs.rb` —
41
- generate designs by reassigning columns from built-in NOLHs
45
+ generate designs by reassigning columns from built-in NOLHs, with factor scaling
42
46
  - `stripheaders.rb`, `stripheaderdups.rb` —
43
47
  used to remove headers from a file, or duplicate headers within a file, respectively
44
48
  - `augment_design.rb` —
@@ -1,10 +1,10 @@
1
1
  # -*- ruby -*-
2
- _VERSION = "1.1.0"
2
+ _VERSION = "1.1.2"
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "datafarming"
6
6
  s.version = _VERSION
7
- s.date = "2018-07-15"
7
+ s.date = "2018-07-16"
8
8
  s.summary = "Useful scripts for data farming."
9
9
  s.homepage = "https://gitlab.nps.edu/pjsanche/datafarmingrubyscripts.git"
10
10
  s.email = "pjs@alum.mit.edu"
@@ -4,61 +4,7 @@ require 'colorize'
4
4
  String.disable_colorization false
5
5
 
6
6
  require 'datafarming/error_handling'
7
- require 'fwt'
8
-
9
- # Generate a Resolution V Fractional Factorial design for the specified
10
- # number of factors. The design is guaranteed to yield unconfounded
11
- # interactions for all pairs of factors. The design uses standardized
12
- # notation, i.e., -1 represents a low setting and 1 represents a high
13
- # setting for each factor.
14
- #
15
- # *Arguments*::
16
- # - +number_of_factors+ -> the number of factors in your design. Limit is 120.
17
- # *Returns*::
18
- # - a two-dimensional array specifying the design, where each column
19
- # corresponds to a factor and each row is a design point.
20
- #
21
- # Author:: Paul J Sanchez (mailto:pjs@alum.mit.edu)
22
- # Copyright:: Copyright (c) Paul J Sanchez
23
- # License:: LGPL
24
- #
25
- def make_design(number_of_factors)
26
- index = [1, 2, 4, 8, 15, 16, 32, 51, 64, 85, 106, 128, 150, 171,
27
- 219, 237, 247, 256, 279, 297, 455, 512, 537, 557, 594, 643, 803,
28
- 863, 998, 1024, 1051, 1070, 1112, 1169, 1333, 1345, 1620, 1866,
29
- 2048, 2076, 2085, 2185, 2372, 2456, 2618, 2800, 2873, 3127, 3284,
30
- 3483, 3557, 3763, 4096, 4125, 4135, 4174, 4435, 4459, 4469, 4497,
31
- 4752, 5255, 5732, 5804, 5915, 6100, 6369, 6907, 7069, 8192, 8263,
32
- 8351, 8422, 8458, 8571, 8750, 8858, 9124, 9314, 9500, 10_026,
33
- 10_455, 10_556, 11_778, 11_885, 11_984, 13_548, 14_007, 14_514,
34
- 14_965, 15_125, 15_554, 16_384, 16_457, 16_517, 16_609, 16_771,
35
- 16_853, 17_022, 17_453, 17_891, 18_073, 18_562, 18_980, 19_030,
36
- 19_932, 20_075, 20_745, 21_544, 22_633, 23_200, 24_167, 25_700,
37
- 26_360, 26_591, 26_776, 28_443, 28_905, 29_577, 32_705
38
- ]
39
- power = [1, 2, 4, 8, 16, 16, 32, 64, 64, 128, 128, 128, 256, 256,
40
- 256, 256, 256, 256, 512, 512, 512, 512, 1024, 1024, 1024, 1024,
41
- 1024, 1024, 1024, 1024, 2048, 2048, 2048, 2048, 2048, 2048, 2048,
42
- 2048, 2048, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096,
43
- 4096, 4096, 4096, 4096, 4096, 8192, 8192, 8192, 8192, 8192, 8192,
44
- 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
45
- 16_384, 16_384, 16_384, 16_384, 16_384, 16_384, 16_384, 16_384,
46
- 16_384, 16_384, 16_384, 16_384, 16_384, 16_384, 16_384, 16_384,
47
- 16_384, 16_384, 16_384, 16_384, 16_384, 16_384, 16_384, 32_768,
48
- 32_768, 32_768, 32_768, 32_768, 32_768, 32_768, 32_768, 32_768,
49
- 32_768, 32_768, 32_768, 32_768, 32_768, 32_768, 32_768, 32_768,
50
- 32_768, 32_768, 32_768, 32_768, 32_768, 32_768, 32_768, 32_768,
51
- 32_768, 32_768, 32_768
52
- ]
53
-
54
- design = Array.new(number_of_factors)
55
- design.each_index do |i|
56
- design[i] = Array.new(power[number_of_factors], 0)
57
- design[i][index[i]] = 1
58
- design[i].hadamard
59
- end
60
- design.transpose
61
- end
7
+ require 'datafarming/factorial_generator'
62
8
 
63
9
  def print_descriptor
64
10
  description = [
@@ -76,28 +22,28 @@ def print_directions # :nodoc:
76
22
  '', 'Syntax:', '',
77
23
  " ruby #{prog} [Options] #factors | low/high-settings".yellow, '',
78
24
  "The vertical bar '|' indicates valid alternatives.", '',
79
- "Command-line args must specify either:",
25
+ 'Command-line args must specify either:',
80
26
  ' - the number of factors for the design; or',
81
27
  ' - low and hi values for all factors.', '',
82
28
  "\nOptions:",
83
29
  ' --help | -h | -? | ?'.green,
84
30
  "\tProduce this help message.",
85
- " --design-only | -d".green,
31
+ ' --design-only | -d'.green,
86
32
  "\tprint the design without labeling",
87
- " --csv | -c".green,
33
+ ' --csv | -c'.green,
88
34
  "\tprint the design as comma separated",
89
- " --center | -a".green,
35
+ ' --center | -a'.green,
90
36
  "\tadd global center pt to check linearity",
91
- " --star | -s".green,
37
+ ' --star | -s'.green,
92
38
  "\taugment with Central Composite Design pts (includes --center)",
93
- " --rotatable | -r".green,
39
+ ' --rotatable | -r'.green,
94
40
  "\tscale a CCD design to be rotatable (includes --star)",
95
41
  ''
96
42
  ]
97
43
  STDERR.puts help_msg
98
44
  end
99
45
 
100
- print_descriptor && print_directions && return if ARGV.length == 0
46
+ (print_descriptor && print_directions && exit) if ARGV.empty?
101
47
  begin
102
48
  labels = true
103
49
  csv = false
@@ -129,13 +75,13 @@ begin
129
75
  when '-h', '--help', '-?', '?'
130
76
  print_descriptor
131
77
  print_directions
132
- return
78
+ exit
133
79
  else
134
80
  raise "Unknown option #{arg}"
135
81
  end
136
82
  end
137
83
 
138
- if ARGV.length == 0
84
+ if ARGV.empty?
139
85
  raise 'Must specify a design size'
140
86
  elsif ARGV.length == 1
141
87
  n = ARGV.shift.to_i
@@ -0,0 +1,55 @@
1
+ require 'fwt'
2
+
3
+ # Generate a Resolution V Fractional Factorial design for the specified
4
+ # number of factors. The design is guaranteed to yield unconfounded
5
+ # interactions for all pairs of factors. The design uses standardized
6
+ # notation, i.e., -1 represents a low setting and 1 represents a high
7
+ # setting for each factor.
8
+ #
9
+ # *Arguments*::
10
+ # - +number_of_factors+ -> the number of factors in your design. Limit is 120.
11
+ # *Returns*::
12
+ # - a two-dimensional array specifying the design, where each column
13
+ # corresponds to a factor and each row is a design point.
14
+ #
15
+ # Author:: Paul J Sanchez (mailto:pjs@alum.mit.edu)
16
+ # Copyright:: Copyright (c) Paul J Sanchez
17
+ # License:: LGPL
18
+ #
19
+ def make_design(number_of_factors)
20
+ index = [1, 2, 4, 8, 15, 16, 32, 51, 64, 85, 106, 128, 150, 171,
21
+ 219, 237, 247, 256, 279, 297, 455, 512, 537, 557, 594, 643, 803,
22
+ 863, 998, 1024, 1051, 1070, 1112, 1169, 1333, 1345, 1620, 1866,
23
+ 2048, 2076, 2085, 2185, 2372, 2456, 2618, 2800, 2873, 3127, 3284,
24
+ 3483, 3557, 3763, 4096, 4125, 4135, 4174, 4435, 4459, 4469, 4497,
25
+ 4752, 5255, 5732, 5804, 5915, 6100, 6369, 6907, 7069, 8192, 8263,
26
+ 8351, 8422, 8458, 8571, 8750, 8858, 9124, 9314, 9500, 10_026,
27
+ 10_455, 10_556, 11_778, 11_885, 11_984, 13_548, 14_007, 14_514,
28
+ 14_965, 15_125, 15_554, 16_384, 16_457, 16_517, 16_609, 16_771,
29
+ 16_853, 17_022, 17_453, 17_891, 18_073, 18_562, 18_980, 19_030,
30
+ 19_932, 20_075, 20_745, 21_544, 22_633, 23_200, 24_167, 25_700,
31
+ 26_360, 26_591, 26_776, 28_443, 28_905, 29_577, 32_705
32
+ ]
33
+ power = [1, 2, 4, 8, 16, 16, 32, 64, 64, 128, 128, 128, 256, 256,
34
+ 256, 256, 256, 256, 512, 512, 512, 512, 1024, 1024, 1024, 1024,
35
+ 1024, 1024, 1024, 1024, 2048, 2048, 2048, 2048, 2048, 2048, 2048,
36
+ 2048, 2048, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096,
37
+ 4096, 4096, 4096, 4096, 4096, 8192, 8192, 8192, 8192, 8192, 8192,
38
+ 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
39
+ 16_384, 16_384, 16_384, 16_384, 16_384, 16_384, 16_384, 16_384,
40
+ 16_384, 16_384, 16_384, 16_384, 16_384, 16_384, 16_384, 16_384,
41
+ 16_384, 16_384, 16_384, 16_384, 16_384, 16_384, 16_384, 32_768,
42
+ 32_768, 32_768, 32_768, 32_768, 32_768, 32_768, 32_768, 32_768,
43
+ 32_768, 32_768, 32_768, 32_768, 32_768, 32_768, 32_768, 32_768,
44
+ 32_768, 32_768, 32_768, 32_768, 32_768, 32_768, 32_768, 32_768,
45
+ 32_768, 32_768, 32_768
46
+ ]
47
+
48
+ design = Array.new(number_of_factors)
49
+ design.each_index do |i|
50
+ design[i] = Array.new(power[number_of_factors], 0)
51
+ design[i][index[i]] = 1
52
+ design[i].hadamard
53
+ end
54
+ design.transpose
55
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datafarming
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul J Sanchez
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-07-15 00:00:00.000000000 Z
11
+ date: 2018-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fwt
@@ -94,6 +94,7 @@ files:
94
94
  - exe/stripheaders.rb
95
95
  - lib/datafarming/cross.rb
96
96
  - lib/datafarming/error_handling.rb
97
+ - lib/datafarming/factorial_generator.rb
97
98
  - lib/datafarming/freq_sets.rb
98
99
  - lib/datafarming/nolh_designs.rb
99
100
  homepage: https://gitlab.nps.edu/pjsanche/datafarmingrubyscripts.git