datafarming 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.md +22 -0
- data/datafarming.gemspec +2 -2
- data/exe/scaled_fde.rb +169 -0
- data/exe/scaled_rf_cubed.rb +227 -0
- data/lib/datafarming/cross.rb +0 -0
- data/lib/datafarming/freq_sets.rb +318 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 190ba17087fafc8f7308e5e4decbe18b412fb99342c4d55011ac28b01735d329
|
4
|
+
data.tar.gz: 2c9da6d6824f2899904f076a4d6184279a272b04fd3fc979538f8809dde83328
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77347491591b5d18612832d102618a84897e4be99e96116b946e75b09a1b71e1bad19d2bf44fafa4afff122cce4a3146ad9113731147e27c6e3fb3e47173c8bb
|
7
|
+
data.tar.gz: c1a8f5d16b081d94731abb8e7c0cf6e6550a4e9929ddd6218e2b5e81cca25f9cf66789400173b510cd3c50143e8379d95966888e4d844c1651880c8aac0449d0
|
data/LICENSE.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
The MIT License (MIT)
|
3
|
+
|
4
|
+
Copyright (c) 2017-2018 Paul J. Sanchez
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
8
|
+
in the Software without restriction, including without limitation the rights
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
14
|
+
copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
SOFTWARE.
|
data/datafarming.gemspec
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# -*- ruby -*-
|
2
|
-
_VERSION = "1.
|
2
|
+
_VERSION = "1.1.0"
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "datafarming"
|
6
6
|
s.version = _VERSION
|
7
|
-
s.date = "2018-
|
7
|
+
s.date = "2018-07-15"
|
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"
|
data/exe/scaled_fde.rb
ADDED
@@ -0,0 +1,169 @@
|
|
1
|
+
#!/usr/bin/env ruby -w
|
2
|
+
|
3
|
+
require 'colorize'
|
4
|
+
String.disable_colorization false
|
5
|
+
|
6
|
+
require 'datafarming/error_handling'
|
7
|
+
require 'datafarming/freq_sets'
|
8
|
+
|
9
|
+
help_msg = [
|
10
|
+
'Generate scaled FDE designs with shifting and stacking. The resulting',
|
11
|
+
'design is written to ' +
|
12
|
+
'stdout'.light_blue + '.', '',
|
13
|
+
'Syntax:',
|
14
|
+
"\n\t#{$PROGRAM_NAME.split(%r{/|\\})[-1]} [--help]".yellow +
|
15
|
+
" [-c] [-d #] [-e] [-k #] [-s #] [file_name]\n".yellow,
|
16
|
+
"Arguments in square brackets are optional. A vertical bar '|'",
|
17
|
+
'indicates valid alternatives for invoking the option. Prefix',
|
18
|
+
'the command with "' + 'ruby'.yellow +
|
19
|
+
'" if it is not on your PATH.', '',
|
20
|
+
' --help | -h | -? | ?'.green,
|
21
|
+
"\tProduce this help message. Supersedes any other choices.",
|
22
|
+
' --csv | -c'.green,
|
23
|
+
"\tGenerate output as comma-separated-values.",
|
24
|
+
' --num_factors # | -k #'.green,
|
25
|
+
"\tSpecify number of factors using standard (+/-1) scaling.",
|
26
|
+
' --design # | -d #'.green,
|
27
|
+
"\tSpecify which design number you want. Default is highest",
|
28
|
+
"\tfrequency set available for the target number of factors.",
|
29
|
+
"\tAn input larger than the available number will produce an",
|
30
|
+
"\terror message that identifies the allowable range.",
|
31
|
+
' --stack # | -s #'.green,
|
32
|
+
"\t# specifies the number of stackings. The specified value cannot",
|
33
|
+
"\texceed the number of columns in the design being used. If this",
|
34
|
+
"\toption is omitted then only the base design is generated.",
|
35
|
+
' --excel-style-input | -e'.green,
|
36
|
+
"\tSpecify factor ranges similarly to the NOLH spreadsheet, i.e.,",
|
37
|
+
"\tthe first line is the set of minimum range values for all factors,",
|
38
|
+
"\tand the second line is maximum range values. Without this option,",
|
39
|
+
"\tthe default input format is one line per factor, comprised of the",
|
40
|
+
"\tmin and max separated by commas or whitespace.",
|
41
|
+
' file_name'.green,
|
42
|
+
"\tThe name of a file containing the factor specifications. If no",
|
43
|
+
"\tfilename is given, the user can enter the values interactively in",
|
44
|
+
"\tthe desired form or use file redirection with '<'.", '',
|
45
|
+
'Options may be given in any order, but must come before the file name',
|
46
|
+
'if one is provided.'
|
47
|
+
]
|
48
|
+
|
49
|
+
# Scaler objects will rescale a FDE design from standard units
|
50
|
+
# to a range specified by min and max
|
51
|
+
class Scaler
|
52
|
+
def initialize(min = -1, max = 1)
|
53
|
+
@mid = 0.5 * (max + min)
|
54
|
+
@amplitude = 0.5 * (max - min)
|
55
|
+
end
|
56
|
+
|
57
|
+
def scale(value)
|
58
|
+
@mid + @amplitude * value
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def make_design(number_of_factors, design_num = -1)
|
63
|
+
design = Array.new(number_of_factors)
|
64
|
+
ds = FDE::DESIGN_SETS[number_of_factors]
|
65
|
+
freqs = ds.freqs[design_num].map { |f| Rational(f, ds.nyq) }
|
66
|
+
design.each_index do |column|
|
67
|
+
omega = freqs[column]
|
68
|
+
design[column] = Array.new(ds.nyq) do |i|
|
69
|
+
Math.sin(((i * omega) % 1) * FDE::TWO_PI)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
design.transpose
|
73
|
+
end
|
74
|
+
|
75
|
+
excel_style_inputs = false
|
76
|
+
csv_out = false
|
77
|
+
design_num = -1
|
78
|
+
num_stackings = 1
|
79
|
+
n = nil
|
80
|
+
while ARGV[0] && (ARGV[0][0] == '-' || ARGV[0][0] == 45 || ARGV[0][0] == '?')
|
81
|
+
current_value = ARGV.shift
|
82
|
+
case current_value
|
83
|
+
when '--csv', '-c'
|
84
|
+
csv_out = true
|
85
|
+
when '--design', '-d'
|
86
|
+
design_num = ARGV.shift.to_i - 1
|
87
|
+
when '--num_factors', '-k'
|
88
|
+
n = ARGV.shift.to_i
|
89
|
+
when '--stack', '-s'
|
90
|
+
num_stackings = ARGV.shift.to_i
|
91
|
+
when '--excel-style-input', '-e'
|
92
|
+
excel_style_inputs = true
|
93
|
+
when '--help', '-h', '-help', '-?', '?'
|
94
|
+
ErrorHandling.clean_abort help_msg
|
95
|
+
else
|
96
|
+
ErrorHandling.message ['Unknown argument: '.red + current_value.yellow]
|
97
|
+
ErrorHandling.clean_abort help_msg
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
if n
|
102
|
+
factor = Array.new(n) { Scaler.new }
|
103
|
+
else
|
104
|
+
begin
|
105
|
+
if excel_style_inputs
|
106
|
+
if ARGF.filename == '-'
|
107
|
+
STDERR.puts 'Enter one line of min values, and one of max values.'.green
|
108
|
+
end
|
109
|
+
min_values = ARGF.gets.strip.split(/\s*[,;:]\s*|\s+/).map(&:to_f)
|
110
|
+
max_values = ARGF.gets.strip.split(/\s*[,;:]\s*|\s+/).map(&:to_f)
|
111
|
+
else
|
112
|
+
if ARGF.filename == '-'
|
113
|
+
STDERR.puts 'To terminate input enter '.green + 'ctrl-d'.cyan +
|
114
|
+
' (Mac/Unix/Linux)'.green + ' or '.green + 'ctrl-z'.cyan +
|
115
|
+
' (Windows).'.green
|
116
|
+
STDERR.puts 'Enter ranges for each factor on a separate line.'.green
|
117
|
+
STDERR.puts "\nMIN\tMAX".cyan
|
118
|
+
end
|
119
|
+
min_values = []
|
120
|
+
max_values = []
|
121
|
+
while line = ARGF.gets
|
122
|
+
values = line.strip.split(/\s*[,;:]\s*|\s+/).map(&:to_f)
|
123
|
+
min_values << values.shift
|
124
|
+
max_values << values.shift
|
125
|
+
end
|
126
|
+
end
|
127
|
+
rescue StandardError => e
|
128
|
+
ErrorHandling.message [e.message.red]
|
129
|
+
ErrorHandling.clean_abort help_msg
|
130
|
+
end
|
131
|
+
|
132
|
+
n = min_values.size
|
133
|
+
if max_values.size != n
|
134
|
+
ErrorHandling.message ['Unequal counts for min, max'.red]
|
135
|
+
ErrorHandling.clean_abort help_msg
|
136
|
+
end
|
137
|
+
|
138
|
+
factor = Array.new(n) do |i|
|
139
|
+
Scaler.new(min_values[i], max_values[i])
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
if design_num >= FDE::DESIGN_SETS[n].freqs.length
|
144
|
+
ErrorHandling.clean_abort [
|
145
|
+
"Design number cannot exceed #{FDE::DESIGN_SETS[n].freqs.length} for #{n} factors".red
|
146
|
+
]
|
147
|
+
end
|
148
|
+
|
149
|
+
design = make_design(n, design_num)
|
150
|
+
|
151
|
+
num_columns = design[0].length
|
152
|
+
if num_stackings > num_columns
|
153
|
+
ErrorHandling.clean_abort [
|
154
|
+
'Requested stacking exceeds number of columns in FDE '.red +
|
155
|
+
"(#{num_columns})".red
|
156
|
+
]
|
157
|
+
end
|
158
|
+
|
159
|
+
num_stackings.times do |_stack_num|
|
160
|
+
design.each_with_index do |dp, i|
|
161
|
+
scaled_dp = dp.slice(0, n).map.with_index { |x, k| factor[k].scale(x) }
|
162
|
+
if csv_out
|
163
|
+
puts scaled_dp.join ','
|
164
|
+
else
|
165
|
+
puts scaled_dp.join "\t"
|
166
|
+
end
|
167
|
+
design[i] = dp.rotate
|
168
|
+
end
|
169
|
+
end
|
@@ -0,0 +1,227 @@
|
|
1
|
+
#!/usr/bin/env ruby -w
|
2
|
+
|
3
|
+
require 'colorize'
|
4
|
+
String.disable_colorization false
|
5
|
+
|
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
|
62
|
+
|
63
|
+
def print_descriptor
|
64
|
+
description = [
|
65
|
+
"\nCreate a Resolution V fractional factorial design, either in standard +/-1",
|
66
|
+
'notation or scaled as per user-provided input. The design can optionally ',
|
67
|
+
'be supplemented with CCD center and star points. Output is written to',
|
68
|
+
'stdout'.blue + ' with formatting controlled by command-line options.'
|
69
|
+
]
|
70
|
+
STDERR.puts description
|
71
|
+
end
|
72
|
+
|
73
|
+
def print_directions # :nodoc:
|
74
|
+
prog = $PROGRAM_NAME.split(/\//)[-1]
|
75
|
+
help_msg = [
|
76
|
+
'', 'Syntax:', '',
|
77
|
+
" ruby #{prog} [Options] #factors | low/high-settings".yellow, '',
|
78
|
+
"The vertical bar '|' indicates valid alternatives.", '',
|
79
|
+
"Command-line args must specify either:",
|
80
|
+
' - the number of factors for the design; or',
|
81
|
+
' - low and hi values for all factors.', '',
|
82
|
+
"\nOptions:",
|
83
|
+
' --help | -h | -? | ?'.green,
|
84
|
+
"\tProduce this help message.",
|
85
|
+
" --design-only | -d".green,
|
86
|
+
"\tprint the design without labeling",
|
87
|
+
" --csv | -c".green,
|
88
|
+
"\tprint the design as comma separated",
|
89
|
+
" --center | -a".green,
|
90
|
+
"\tadd global center pt to check linearity",
|
91
|
+
" --star | -s".green,
|
92
|
+
"\taugment with Central Composite Design pts (includes --center)",
|
93
|
+
" --rotatable | -r".green,
|
94
|
+
"\tscale a CCD design to be rotatable (includes --star)",
|
95
|
+
''
|
96
|
+
]
|
97
|
+
STDERR.puts help_msg
|
98
|
+
end
|
99
|
+
|
100
|
+
print_descriptor && print_directions && return if ARGV.length == 0
|
101
|
+
begin
|
102
|
+
labels = true
|
103
|
+
csv = false
|
104
|
+
scaled = false
|
105
|
+
center = false
|
106
|
+
star = false
|
107
|
+
rotatable = false
|
108
|
+
fmt_size = '5'
|
109
|
+
fmt_type = 'd'
|
110
|
+
|
111
|
+
while ARGV[0] =~ /^(-\D|\?)/
|
112
|
+
arg = ARGV.shift
|
113
|
+
case arg
|
114
|
+
when '-c', '--csv'
|
115
|
+
csv = true
|
116
|
+
when '-d', '--design-only'
|
117
|
+
labels = false
|
118
|
+
when '-a', '--center'
|
119
|
+
center = true
|
120
|
+
when '-s', '--star'
|
121
|
+
star = true
|
122
|
+
center = true
|
123
|
+
when '-r', '--rotatable'
|
124
|
+
rotatable = true
|
125
|
+
star = true
|
126
|
+
center = true
|
127
|
+
fmt_size = '11.8'
|
128
|
+
fmt_type = 'f'
|
129
|
+
when '-h', '--help', '-?', '?'
|
130
|
+
print_descriptor
|
131
|
+
print_directions
|
132
|
+
return
|
133
|
+
else
|
134
|
+
raise "Unknown option #{arg}"
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
if ARGV.length == 0
|
139
|
+
raise 'Must specify a design size'
|
140
|
+
elsif ARGV.length == 1
|
141
|
+
n = ARGV.shift.to_i
|
142
|
+
elsif (ARGV.length & 1).nonzero? # Odd number of args remaining!
|
143
|
+
raise 'Number of levels is odd: low/hi values must occur in pairs'
|
144
|
+
else
|
145
|
+
n = ARGV.length / 2
|
146
|
+
scaled = true
|
147
|
+
unless rotatable
|
148
|
+
fmt_type = 's'
|
149
|
+
fmt_size = [ARGV.map(&:length).max + 1, fmt_size.to_i].max
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
my_design = make_design n
|
154
|
+
if rotatable && star
|
155
|
+
inverse_len = 1.0 / Math.sqrt(n)
|
156
|
+
my_design.each_with_index do |row, i|
|
157
|
+
my_design[i] = row.map { |elt| elt * inverse_len }
|
158
|
+
end
|
159
|
+
end
|
160
|
+
my_design += [Array.new(n, 0)] if center
|
161
|
+
|
162
|
+
if star
|
163
|
+
star_design = Array.new(2 * n)
|
164
|
+
star_design.each_index { |row| star_design[row] = Array.new(n, 0) }
|
165
|
+
n.times do |col|
|
166
|
+
row = 2 * col
|
167
|
+
star_design[row][col] = -1
|
168
|
+
star_design[row + 1][col] = 1
|
169
|
+
end
|
170
|
+
my_design += star_design
|
171
|
+
end
|
172
|
+
|
173
|
+
if scaled
|
174
|
+
temp = my_design.transpose
|
175
|
+
temp.each_with_index do |factor, idx|
|
176
|
+
factor.map! do |value|
|
177
|
+
case value
|
178
|
+
when -1
|
179
|
+
ARGV[2 * idx + 1]
|
180
|
+
when 1
|
181
|
+
ARGV[2 * idx]
|
182
|
+
when 0
|
183
|
+
begin
|
184
|
+
0.5 * (Float(ARGV[2 * idx + 1]) + Float(ARGV[2 * idx]))
|
185
|
+
rescue
|
186
|
+
raise 'All factors must be numeric for augmented designs.'
|
187
|
+
end
|
188
|
+
else
|
189
|
+
begin
|
190
|
+
lo = Float(ARGV[2 * idx])
|
191
|
+
hi = Float(ARGV[2 * idx + 1])
|
192
|
+
range = hi - lo
|
193
|
+
0.5 * (hi + lo + value * range)
|
194
|
+
rescue
|
195
|
+
raise 'All factors must be numeric for augmented designs.'
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|
200
|
+
my_design = temp.transpose
|
201
|
+
end
|
202
|
+
|
203
|
+
if labels
|
204
|
+
if csv
|
205
|
+
print ' DP#'
|
206
|
+
n.times { |i| print ",X#{i + 1}" }
|
207
|
+
else
|
208
|
+
print ' DP#'
|
209
|
+
n.times { |i| printf " %#{fmt_size}s", "X#{i + 1}" }
|
210
|
+
end
|
211
|
+
puts
|
212
|
+
end
|
213
|
+
|
214
|
+
my_design.each_with_index do |design_point, row_number|
|
215
|
+
if csv
|
216
|
+
printf('%d,', row_number + 1) if labels
|
217
|
+
puts design_point.join(',')
|
218
|
+
else
|
219
|
+
printf('%5d', row_number + 1) if labels
|
220
|
+
design_point.each { |value| printf " %#{fmt_size}#{fmt_type}", value }
|
221
|
+
puts
|
222
|
+
end
|
223
|
+
end
|
224
|
+
rescue Exception => e
|
225
|
+
STDERR.print "\n", e.message, "\n"
|
226
|
+
print_directions
|
227
|
+
end
|
data/lib/datafarming/cross.rb
CHANGED
File without changes
|
@@ -0,0 +1,318 @@
|
|
1
|
+
#!/usr/bin/env ruby -w
|
2
|
+
|
3
|
+
module FDE
|
4
|
+
TWO_PI = 2.0 * Math::PI
|
5
|
+
|
6
|
+
DesignSet = Struct.new(:nyq, :freqs)
|
7
|
+
|
8
|
+
DESIGN_SETS = {
|
9
|
+
2 => DesignSet.new(
|
10
|
+
nyq = 13, freqs = [
|
11
|
+
[1, 5],
|
12
|
+
[2, 3],
|
13
|
+
[4, 6]
|
14
|
+
]
|
15
|
+
),
|
16
|
+
3 => DesignSet.new(
|
17
|
+
nyq = 27, freqs = [
|
18
|
+
[1, 5, 8],
|
19
|
+
[2, 5, 13],
|
20
|
+
[2, 10, 11],
|
21
|
+
[4, 11, 13],
|
22
|
+
[8, 10, 13]
|
23
|
+
]
|
24
|
+
),
|
25
|
+
4 => DesignSet.new(
|
26
|
+
nyq = 46, freqs = [
|
27
|
+
[1, 4, 10, 17],
|
28
|
+
[1, 6, 16, 19],
|
29
|
+
[2, 3, 11, 18],
|
30
|
+
[2, 9, 10, 15],
|
31
|
+
[3, 5, 12, 16],
|
32
|
+
[4, 5, 7, 20],
|
33
|
+
[6, 8, 9, 13],
|
34
|
+
[7, 18, 19, 22],
|
35
|
+
[8, 11, 20, 21],
|
36
|
+
[12, 14, 15, 21],
|
37
|
+
[13, 14, 17, 22]
|
38
|
+
]
|
39
|
+
),
|
40
|
+
5 => DesignSet.new(
|
41
|
+
nyq = 69, freqs = [
|
42
|
+
[1, 4, 13, 19, 29],
|
43
|
+
[1, 10, 14, 17, 22],
|
44
|
+
[2, 5, 11, 25, 26],
|
45
|
+
[2, 8, 11, 26, 31],
|
46
|
+
[2, 10, 13, 31, 32],
|
47
|
+
[2, 11, 14, 31, 32],
|
48
|
+
[2, 20, 25, 28, 34],
|
49
|
+
[4, 5, 7, 20, 26],
|
50
|
+
[4, 7, 16, 17, 22],
|
51
|
+
[4, 10, 17, 19, 22],
|
52
|
+
[5, 7, 11, 26, 34],
|
53
|
+
[8, 10, 14, 17, 29],
|
54
|
+
[8, 14, 25, 32, 34],
|
55
|
+
[8, 20, 25, 31, 34],
|
56
|
+
[11, 16, 20, 28, 34],
|
57
|
+
[13, 17, 29, 31, 32]
|
58
|
+
]
|
59
|
+
),
|
60
|
+
6 => DesignSet.new(
|
61
|
+
nyq = 103, freqs = [
|
62
|
+
[1, 5, 22, 35, 42, 50],
|
63
|
+
[1, 7, 10, 25, 29, 41],
|
64
|
+
[1, 11, 18, 24, 27, 32],
|
65
|
+
[1, 11, 28, 31, 35, 49],
|
66
|
+
[1, 14, 21, 25, 30, 33],
|
67
|
+
[1, 28, 33, 40, 44, 50],
|
68
|
+
[2, 22, 36, 39, 48, 49],
|
69
|
+
[3, 4, 13, 28, 40, 42],
|
70
|
+
[3, 4, 17, 19, 29, 47],
|
71
|
+
[3, 16, 20, 21, 28, 30],
|
72
|
+
[4, 5, 7, 25, 31, 44],
|
73
|
+
[4, 9, 10, 21, 37, 44],
|
74
|
+
[5, 6, 14, 37, 41, 44],
|
75
|
+
[5, 13, 17, 32, 46, 48],
|
76
|
+
[5, 31, 37, 39, 48, 51],
|
77
|
+
[6, 8, 9, 34, 38, 45],
|
78
|
+
[6, 32, 40, 42, 43, 47],
|
79
|
+
[7, 15, 35, 39, 41, 51],
|
80
|
+
[8, 10, 14, 15, 41, 50],
|
81
|
+
[8, 11, 12, 18, 43, 45],
|
82
|
+
[8, 15, 18, 20, 29, 42],
|
83
|
+
[9, 12, 16, 38, 46, 51],
|
84
|
+
[9, 12, 17, 19, 23, 39],
|
85
|
+
[10, 12, 15, 21, 28, 29],
|
86
|
+
[11, 21, 25, 34, 49, 51],
|
87
|
+
[11, 27, 35, 36, 48, 50],
|
88
|
+
[12, 13, 16, 18, 27, 35],
|
89
|
+
[13, 23, 31, 32, 38, 43],
|
90
|
+
[14, 20, 22, 25, 35, 51],
|
91
|
+
[14, 27, 34, 36, 46, 51],
|
92
|
+
[16, 23, 24, 43, 45, 49],
|
93
|
+
[20, 24, 30, 42, 45, 47]
|
94
|
+
]
|
95
|
+
),
|
96
|
+
7 => DesignSet.new(
|
97
|
+
nyq = 130, freqs = [
|
98
|
+
[1, 4, 19, 31, 44, 53, 60],
|
99
|
+
[1, 7, 18, 22, 27, 57, 60],
|
100
|
+
[1, 9, 14, 21, 40, 46, 57],
|
101
|
+
[1, 10, 16, 29, 34, 37, 41],
|
102
|
+
[2, 3, 12, 29, 37, 50, 57],
|
103
|
+
[2, 17, 22, 23, 30, 33, 59],
|
104
|
+
[3, 7, 19, 28, 30, 43, 48],
|
105
|
+
[3, 8, 10, 27, 41, 42, 63],
|
106
|
+
[3, 21, 41, 49, 50, 54, 64],
|
107
|
+
[4, 7, 9, 24, 30, 49, 59],
|
108
|
+
[6, 9, 19, 20, 36, 41, 43],
|
109
|
+
[6, 31, 40, 47, 51, 61, 64],
|
110
|
+
[7, 9, 17, 20, 32, 62, 63],
|
111
|
+
[8, 33, 47, 48, 51, 53, 60],
|
112
|
+
[10, 11, 18, 23, 37, 53, 62],
|
113
|
+
[10, 11, 36, 44, 49, 51, 63],
|
114
|
+
[11, 14, 23, 24, 29, 31, 50],
|
115
|
+
[11, 16, 17, 20, 46, 59, 61],
|
116
|
+
[12, 17, 21, 27, 40, 47, 58],
|
117
|
+
[19, 29, 30, 33, 54, 56, 61],
|
118
|
+
[20, 33, 37, 42, 43, 58, 61],
|
119
|
+
[21, 27, 34, 51, 56, 59, 60],
|
120
|
+
[23, 28, 38, 47, 49, 50, 63],
|
121
|
+
[31, 32, 38, 40, 43, 53, 57]
|
122
|
+
]
|
123
|
+
),
|
124
|
+
8 => DesignSet.new(
|
125
|
+
nyq = 168, freqs = [
|
126
|
+
[1, 9, 13, 16, 40, 46, 51, 74],
|
127
|
+
[2, 8, 11, 25, 26, 57, 64, 69],
|
128
|
+
[2, 8, 15, 26, 27, 59, 64, 73],
|
129
|
+
[3, 19, 32, 34, 39, 62, 79, 80],
|
130
|
+
[3, 22, 23, 32, 37, 39, 50, 80],
|
131
|
+
[5, 32, 34, 45, 62, 65, 80, 81],
|
132
|
+
[8, 15, 17, 27, 53, 58, 64, 82],
|
133
|
+
[8, 31, 57, 58, 64, 67, 69, 82],
|
134
|
+
[9, 10, 16, 38, 40, 43, 51, 55],
|
135
|
+
[10, 16, 29, 33, 38, 40, 41, 75],
|
136
|
+
[16, 33, 40, 46, 71, 74, 75, 83],
|
137
|
+
[22, 32, 45, 47, 50, 61, 80, 81]
|
138
|
+
]
|
139
|
+
),
|
140
|
+
9 => DesignSet.new(
|
141
|
+
nyq = 209, freqs = [
|
142
|
+
[1, 5, 19, 22, 31, 56, 64, 71, 99],
|
143
|
+
[1, 22, 29, 38, 42, 48, 53, 56, 88],
|
144
|
+
[2, 19, 54, 61, 66, 72, 88, 97, 98],
|
145
|
+
[3, 13, 41, 62, 76, 77, 81, 99, 101],
|
146
|
+
[5, 25, 54, 63, 71, 77, 95, 98, 99],
|
147
|
+
[6, 7, 11, 26, 47, 55, 57, 82, 85],
|
148
|
+
[7, 20, 22, 26, 38, 43, 75, 99, 100],
|
149
|
+
[8, 30, 33, 39, 40, 44, 57, 59, 94],
|
150
|
+
[9, 11, 12, 38, 45, 51, 55, 70, 86],
|
151
|
+
[9, 11, 14, 40, 44, 52, 59, 76, 86],
|
152
|
+
[11, 17, 43, 44, 47, 85, 93, 95, 100],
|
153
|
+
[11, 19, 21, 24, 28, 44, 78, 90, 104],
|
154
|
+
[11, 28, 32, 55, 69, 89, 95, 102, 104],
|
155
|
+
[12, 14, 22, 39, 45, 52, 94, 95, 99],
|
156
|
+
[14, 16, 51, 52, 57, 60, 70, 77, 99],
|
157
|
+
[16, 21, 60, 66, 78, 80, 88, 91, 95],
|
158
|
+
[17, 19, 20, 33, 44, 65, 75, 87, 93],
|
159
|
+
[18, 22, 24, 37, 69, 76, 90, 99, 102],
|
160
|
+
[18, 22, 28, 37, 57, 80, 88, 91, 104],
|
161
|
+
[19, 27, 32, 33, 42, 49, 53, 77, 89],
|
162
|
+
[23, 34, 35, 38, 40, 59, 66, 79, 88],
|
163
|
+
[27, 49, 55, 57, 66, 69, 73, 92, 102],
|
164
|
+
[31, 38, 54, 55, 64, 66, 84, 98, 103],
|
165
|
+
[33, 46, 51, 68, 70, 76, 77, 80, 91],
|
166
|
+
[36, 42, 53, 66, 73, 74, 76, 88, 92]
|
167
|
+
]
|
168
|
+
),
|
169
|
+
10 => DesignSet.new(
|
170
|
+
nyq = 268, freqs = [
|
171
|
+
[1, 5, 13, 24, 51, 54, 71, 86, 93, 114],
|
172
|
+
[1, 5, 18, 21, 32, 62, 70, 77, 105, 117],
|
173
|
+
[1, 5, 23, 34, 42, 49, 74, 87, 101, 104],
|
174
|
+
[1, 14, 21, 50, 60, 66, 69, 77, 103, 107],
|
175
|
+
[1, 35, 51, 90, 93, 97, 107, 112, 118, 130],
|
176
|
+
[1, 49, 62, 71, 87, 107, 114, 117, 122, 128],
|
177
|
+
[2, 3, 11, 23, 53, 68, 86, 105, 115, 122],
|
178
|
+
[2, 5, 13, 25, 34, 65, 71, 87, 106, 120],
|
179
|
+
[2, 13, 22, 51, 56, 59, 87, 101, 119, 126],
|
180
|
+
[2, 15, 22, 33, 47, 56, 75, 83, 121, 126],
|
181
|
+
[2, 19, 29, 68, 81, 86, 111, 122, 123, 131],
|
182
|
+
[2, 34, 47, 63, 69, 106, 109, 120, 121, 129],
|
183
|
+
[3, 7, 15, 35, 44, 46, 69, 102, 121, 126],
|
184
|
+
[3, 7, 53, 55, 74, 82, 83, 98, 116, 121],
|
185
|
+
[3, 10, 11, 15, 39, 55, 72, 74, 106, 115],
|
186
|
+
[3, 15, 37, 47, 54, 58, 63, 82, 83, 96],
|
187
|
+
[3, 37, 41, 42, 53, 61, 63, 70, 88, 118],
|
188
|
+
[4, 9, 58, 79, 85, 86, 109, 111, 123, 126],
|
189
|
+
[4, 11, 23, 25, 49, 55, 58, 86, 125, 126],
|
190
|
+
[5, 11, 25, 42, 49, 82, 90, 105, 108, 117],
|
191
|
+
[5, 16, 23, 25, 31, 58, 98, 101, 102, 115],
|
192
|
+
[6, 7, 15, 39, 50, 55, 73, 75, 92, 102],
|
193
|
+
[6, 7, 35, 39, 66, 89, 91, 100, 110, 115],
|
194
|
+
[6, 9, 10, 33, 47, 64, 69, 77, 98, 109],
|
195
|
+
[6, 10, 25, 57, 64, 65, 87, 98, 101, 125],
|
196
|
+
[6, 19, 43, 45, 66, 95, 99, 100, 110, 127],
|
197
|
+
[6, 50, 59, 61, 79, 92, 95, 102, 119, 127],
|
198
|
+
[7, 18, 26, 30, 35, 73, 75, 76, 97, 107],
|
199
|
+
[7, 20, 22, 23, 55, 89, 94, 106, 115, 125],
|
200
|
+
[8, 17, 18, 31, 38, 85, 89, 91, 113, 118],
|
201
|
+
[8, 18, 21, 38, 43, 45, 49, 103, 117, 118]
|
202
|
+
]
|
203
|
+
),
|
204
|
+
11 => DesignSet.new(
|
205
|
+
nyq = 335, freqs = [
|
206
|
+
[1, 4, 14, 26, 33, 50, 71, 94, 110, 152, 163]
|
207
|
+
]
|
208
|
+
),
|
209
|
+
12 => DesignSet.new(
|
210
|
+
nyq = 440, freqs = [
|
211
|
+
[1, 4, 14, 21, 72, 84, 113, 137, 146, 173, 192, 203]
|
212
|
+
]
|
213
|
+
),
|
214
|
+
13 => DesignSet.new(
|
215
|
+
nyq = 579, freqs = [
|
216
|
+
[1, 4, 10, 17, 29, 52, 95, 117, 132, 172, 196, 243, 269]
|
217
|
+
]
|
218
|
+
),
|
219
|
+
14 => DesignSet.new(
|
220
|
+
nyq = 684, freqs = [
|
221
|
+
[1, 4, 10, 17, 29, 52, 83, 107, 150, 172, 221, 236, 268, 306]
|
222
|
+
]
|
223
|
+
),
|
224
|
+
15 => DesignSet.new(
|
225
|
+
nyq = 811, freqs = [
|
226
|
+
[1, 4, 10, 17, 29, 52, 78, 93, 143, 165, 202, 245, 277, 343, 383]
|
227
|
+
]
|
228
|
+
),
|
229
|
+
16 => DesignSet.new(
|
230
|
+
nyq = 811, freqs = [
|
231
|
+
[1, 4, 10, 17, 29, 52, 88, 131, 155, 196, 246, 312, 359, 408, 423, 445]
|
232
|
+
]
|
233
|
+
),
|
234
|
+
17 => DesignSet.new(
|
235
|
+
nyq = 1089, freqs = [
|
236
|
+
[1, 4, 10, 17, 29, 52, 67, 116, 181, 224, 264, 318, 359, 403, 450, 481, 526]
|
237
|
+
]
|
238
|
+
),
|
239
|
+
18 => DesignSet.new(
|
240
|
+
nyq = 1283, freqs = [
|
241
|
+
[1, 4, 10, 17, 29, 52, 67, 89, 165, 210, 265, 335, 400, 436, 480, 523, 563, 587]
|
242
|
+
]
|
243
|
+
),
|
244
|
+
19 => DesignSet.new(
|
245
|
+
nyq = 1458, freqs = [
|
246
|
+
[1, 4, 10, 17, 29, 52, 67, 89, 132, 176, 202, 299, 339, 413, 437, 468, 513, 595, 659]
|
247
|
+
]
|
248
|
+
),
|
249
|
+
20 => DesignSet.new(
|
250
|
+
nyq = 1673, freqs = [
|
251
|
+
[1, 4, 10, 17, 29, 52, 67, 89, 132, 164, 291, 335, 411, 437, 511, 535, 594, 648, 688, 749]
|
252
|
+
]
|
253
|
+
),
|
254
|
+
21 => DesignSet.new(
|
255
|
+
nyq = 1871, freqs = [
|
256
|
+
[1, 4, 10, 17, 29, 52, 67, 89, 132, 164, 218, 242, 312, 343, 425, 498, 598, 700, 755, 795, 882]
|
257
|
+
]
|
258
|
+
),
|
259
|
+
22 => DesignSet.new(
|
260
|
+
nyq = 2070, freqs = [
|
261
|
+
[1, 4, 10, 17, 29, 52, 67, 89, 132, 164, 205, 259, 335, 399, 444, 613, 691, 715, 841, 902, 942, 989]
|
262
|
+
]
|
263
|
+
),
|
264
|
+
23 => DesignSet.new(
|
265
|
+
nyq = 2306, freqs = [
|
266
|
+
[1, 4, 10, 17, 29, 52, 67, 89, 132, 164, 205, 259, 314, 438, 540, 564, 684, 758, 784, 924, 971, 1035, 1096]
|
267
|
+
]
|
268
|
+
),
|
269
|
+
24 => DesignSet.new(
|
270
|
+
nyq = 2625, freqs = [
|
271
|
+
[1, 4, 10, 17, 29, 52, 67, 89, 132, 164, 205, 259, 303, 350, 470, 529, 659, 737, 903, 977, 1017, 1103, 1127, 1285]
|
272
|
+
]
|
273
|
+
),
|
274
|
+
25 => DesignSet.new(
|
275
|
+
nyq = 2886, freqs = [
|
276
|
+
[1, 4, 10, 17, 29, 52, 67, 89, 132, 164, 205, 259, 303, 350, 405, 505, 618, 642, 728, 885, 1005, 1036, 1194, 1230, 1402]
|
277
|
+
]
|
278
|
+
),
|
279
|
+
26 => DesignSet.new(
|
280
|
+
nyq = 3227, freqs = [
|
281
|
+
[1, 4, 10, 17, 29, 52, 67, 89, 132, 164, 205, 259, 303, 350, 405, 505, 529, 634, 748, 824, 1071, 1130, 1238, 1321, 1465, 1529]
|
282
|
+
]
|
283
|
+
),
|
284
|
+
27 => DesignSet.new(
|
285
|
+
nyq = 3549, freqs = [
|
286
|
+
[1, 4, 10, 17, 29, 52, 67, 89, 132, 164, 205, 259, 303, 350, 405, 505, 529, 702, 941, 1092, 1168, 1251, 1277, 1359, 1542, 1582, 1722]
|
287
|
+
]
|
288
|
+
),
|
289
|
+
28 => DesignSet.new(
|
290
|
+
nyq = 3931, freqs = [
|
291
|
+
[1, 4, 10, 17, 29, 52, 67, 89, 132, 164, 205, 259, 303, 350, 405, 505, 529, 588, 757, 1046, 1072, 1270, 1377, 1490, 1535, 1702, 1738, 1915]
|
292
|
+
]
|
293
|
+
),
|
294
|
+
29 => DesignSet.new(
|
295
|
+
nyq = 4298, freqs = [
|
296
|
+
[1, 4, 10, 17, 29, 52, 67, 89, 132, 164, 205, 259, 303, 350, 405, 505, 529, 588, 680, 903, 1016, 1283, 1328, 1406, 1645, 1793, 1869, 1951, 2058]
|
297
|
+
]
|
298
|
+
),
|
299
|
+
30 => DesignSet.new(
|
300
|
+
nyq = 4692, freqs = [
|
301
|
+
[1, 4, 10, 17, 29, 52, 67, 89, 132, 164, 205, 259, 303, 350, 405, 505, 529, 588, 680, 903, 1061, 1131, 1171, 1358, 1502, 1721, 1898, 1934, 2012, 2106]
|
302
|
+
]
|
303
|
+
),
|
304
|
+
50 => DesignSet.new(
|
305
|
+
nyq = 17_853, freqs = [
|
306
|
+
[1, 4, 10, 17, 29, 52, 67, 89, 132, 164, 205, 259, 303, 350, 405, 505, 529, 588, 680, 903, 1016, 1061, 1248, 1358, 1445, 1838, 1878, 2086, 2117, 2195, 2613, 2840, 3060, 3314, 3422, 3816, 4097, 4247, 4565, 4705, 5326, 5511, 6620, 6857, 6983, 7235, 7964, 8058, 8287, 8655]
|
307
|
+
]
|
308
|
+
)
|
309
|
+
}.freeze
|
310
|
+
end
|
311
|
+
|
312
|
+
|
313
|
+
if __FILE__ == $PROGRAM_NAME
|
314
|
+
require 'colorize'
|
315
|
+
String.disable_colorization false
|
316
|
+
require_relative 'error_handling'
|
317
|
+
ErrorHandling.message ['This module is not intended to be executable.'.yellow]
|
318
|
+
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.
|
4
|
+
version: 1.1.0
|
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-
|
11
|
+
date: 2018-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fwt
|
@@ -66,12 +66,15 @@ executables:
|
|
66
66
|
- mser.rb
|
67
67
|
- pool_files.rb
|
68
68
|
- rundesign_general.rb
|
69
|
+
- scaled_fde.rb
|
70
|
+
- scaled_rf_cubed.rb
|
69
71
|
- stack_nolhs.rb
|
70
72
|
- stripheaderdups.rb
|
71
73
|
- stripheaders.rb
|
72
74
|
extensions: []
|
73
75
|
extra_rdoc_files: []
|
74
76
|
files:
|
77
|
+
- LICENSE.md
|
75
78
|
- README.md
|
76
79
|
- datafarming.gemspec
|
77
80
|
- exe/augment_design.rb
|
@@ -84,11 +87,14 @@ files:
|
|
84
87
|
- exe/mser.rb
|
85
88
|
- exe/pool_files.rb
|
86
89
|
- exe/rundesign_general.rb
|
90
|
+
- exe/scaled_fde.rb
|
91
|
+
- exe/scaled_rf_cubed.rb
|
87
92
|
- exe/stack_nolhs.rb
|
88
93
|
- exe/stripheaderdups.rb
|
89
94
|
- exe/stripheaders.rb
|
90
95
|
- lib/datafarming/cross.rb
|
91
96
|
- lib/datafarming/error_handling.rb
|
97
|
+
- lib/datafarming/freq_sets.rb
|
92
98
|
- lib/datafarming/nolh_designs.rb
|
93
99
|
homepage: https://gitlab.nps.edu/pjsanche/datafarmingrubyscripts.git
|
94
100
|
licenses:
|