How to force gem that converts all bins to 93k multibins to output 93k native bins? - origen-sdk

My need is to get good old fashioned 93k native bad bins defined in my testflow. My ruby file compiles but looks like the gem is converting all bins to multibins. Is there a way to force this from my ruby file instead of hacking the gem files? If yes, going ahead with this, I couldn't find how to specify hardbin description and softbin description in origen. That is something I would like to add in the ruby code instead of on ATE.
Also on a side note, I am trying to force the output file name to something i want. Like in the sample code below i want the output file to be test.tf. The gem is adding some string and an underscore in front of "test". I don't need that either.
sample code:
Flow.create interface: 'MyTester::Interface', params: :room, unique_test_names: nil, flow_name:
:test, file_name: :test, insertion: :prb do
test_info1 = {"key_1" =>
[{:testname => "t1",
:sbin => 100,
:patternname => "p1"}],
"key_2" =>
[{:testname => "t2",
:sbin => 200,
:patternname => "t3"}]
}
testnum = 100000
test_info1.each do |key,val|
puts key
val.each do |info|
tname, sb, pname = info.values_at(:testname, :sbin, :patternname)
puts "#{tname} : #{sb} : #{pname}"
test_suites.add("#{tname}", pattern: "#{pname}", tim_spec_set: 1, timset: 1, lev_equ_set: 1,
lev_spec_set: 10, levset: 1, test_method: test_methods.ac_tml.ac_test.functional_test)
testnum = testnum+100
test :"#{tname}", bin: 10, softbin: "#{sb}", tnum: testnum
end
end
end

Related

string difference in jsondiffpatch nodejs

I am using jsondiffpatch npm module for the difference.
left JSON contains
"inclusionParams": "{\"internalCode\":{\"isIncluded\":true,\"type\":\"string\",\"searchStr\":\"320150,320285,321887,322866,322867,323007,323009,323011,323037,323051,323907,323914\"}}",
right JSON contains
"inclusionParams": "{\"country\":{\"isIncluded\":true,\"type\":\"string\",\"searchStr\":\"US\",\"expr\":null,\"ids\":null},\"ext.dmaCode\":{\"isIncluded\":false,\"type\":\"string\",\"searchStr\":\"868, 801, 641, 597, 504\",\"expr\":null,\"ids\":null},\"status\":{\"isIncluded\":true,\"type\":\"string\",\"searchStr\":\"Active\",\"expr\":null,\"ids\":null}}",
getting difference something like
inclusionParams=["## -80,76 +80,32 ##\n ,855\n-,%22%7D,%22status%22:%7B%22isIncluded%22:true,%22type%22:%22string%22,%22searchStr%22:%22Active%22\n+%22,%22expr%22:null,%22ids%22:null\n %7D,%22c\n## -163,10 +163,33 ##\n tr%22:%22US%22\n+,%22expr%22:null,%22ids%22:null\n %7D%7D\n",0,2];
but I want to get the difference as of right JSON value instead of the above value[character wise difference].
how to achieve it?
are there any configurations?
differ = jsondiffpatch.create({
textDiff: {
// default 60, minimum string length (left and right sides) to use text diff algorythm: google-diff-match-patch
minLength: 10000
},
});

test_ids gem allow for bin grouping based on test metadata?

Is there a way for the test_ids gem to group tests such that the same softbin gets assigned? For example, here are 3 tests passed in the flow file:
func :test1, speed: 1000, vdd: :vmin
func :test2, speed: 1200, vdd: :vmin
func :test3, speed: 1000, vdd: :vmax
Would like to be able to tell test_ids gem to group by :vdd and get the following softbins assigned (assume the range is 200-299):
200, func_vmin
201, func_vmax
If I passed speed as the grouping arg I would get the following softbins:
200, func_1000
201, func_1200
The examples shown above only pass one piece of metadata but the ask would be that any combination of test metadata could be used to create the softbin group name.
thx
With no special options, the test IDs plugin will use the test name as a unique ID. In that case, tests with different names will be assigned different test numbers, bins and softbins, while tests with the same name will use the same numbers.
Sometimes, like in this case, it is desired for differently named tests to share all or some of their number allocations, and there are a few options available to control this.
Firstly, you can supply a test_id: option, this explicitly defines the ID that should be used for the test when assigning numbers, now your tests will all have the same test numbers, bins and softbins:
func :test1, speed: 1000, vdd: :vmin, test_id: :t1
func :test2, speed: 1200, vdd: :vmin, test_id: :t1
func :test3, speed: 1000, vdd: :vmax, test_id: :t1
This can be further fine-tuned by supplying number:, bin: and/or softbin: options with symbol values and these will be used as the test ID when assigning that specific number type.
For example, this will assign the softbin as you want based on vdd:
func :test1, speed: 1000, vdd: :vmin, softbin: :func_vmin
func :test2, speed: 1200, vdd: :vmin, softbin: :func_vmin
func :test3, speed: 1000, vdd: :vmax, softbin: :func_vmax
This is covered in the docs here - https://origen-sdk.org/test_ids/#Multiple_Instances_of_the_Same_Test
Use your test program interface to programatically assign the IDs based on your business rules, for example in your func method:
def func(name, options)
options[:softbin] = "func_#{options[:vdd] || :nom}".to_sym
# ...
end
It is recommended to have all of your test handlers like this func method handover to a single method to add the test to the flow - https://origen-sdk.org/origen//guides/program/interface/#Detecting_Changes_in_the_Execution_Context
That would then give you a single place to implement more global rules like using vdd. vs. speed to group by.
For example, if you wanted to group by the test type and then speed, you could do something like:
def func(name, options)
options[:softbin] = "func"
# ...
add_to_flow(my_test, options)
end
def add_to_flow(test, options)
if group_by_speed?
options[:softbin] = "#{options[:softbin]_#{options[:speed] || 1000}".to_sym
else
options[:softbin] = "#{options[:softbin]_#{options[:vdd] || :nom}".to_sym
end
# ...
end

logstash - output single event into multiple line output file

I have a jdbc input with a select statement. each row in the restult set has 3 columns. c1, c2, c3. the event emitted has the following structure:
{"c1":"v1", "c2":"v2", "c3":"v3", "file_name":"tmp.csv"}
I want to output the values in a file in the following manner:
output file:
v1
v2
v3
this is the output configuration:
file {
path => "/tmp/%{file_name}"
codec => plain { format => "%{c1}\n%{c2}\n%{c3}" }
write_behavior => "overwrite"
flush_interval => 0
}
but what is generated is
outputfile:
v1\nv2\nv3
is the plain codec plugin not the one i need? is there any other codec plugin for the output file plugin that i can use? or is the only option i have is to write my own plugin?
Thanks!
A bit late to the party, but maybe this helps others. Although it looks funky, you should be able to get away with simply hitting Enter within the format string (using the line codec).
file {
path => "/tmp/%{file_name}"
codec => line {
format => "%{c1}
%{c2}
%{c3}"
}
write_behavior => "overwrite"
flush_interval => 0
}
Not the prettiest approach, but it works. Not sure if there is a better way.
what you are looking for is the line codec plugin: https://www.elastic.co/guide/en/logstash/current/plugins-codecs-line.html

Minimal self-compiling to .pdf Rmarkdown file

I need to compose a simple rmarkdown file, with text, code and the results of executed code included in a resulting PDF file. I would prefer if the source file is executable and self sifficient, voiding the need for a makefile.
This is the best I have been able to achieve, and it is far from good:
#!/usr/bin/env Rscript
library(knitr)
pandoc('hw_ch4.rmd', format='latex')
# TODO: how to NOT print the above commands to the resulting .pdf?
# TODO: how to avoid putting everyting from here on in ""s?
# TODO: how to avoid mentioning the file name above?
# TODO: how to render special symbols, such as tilde, miu, sigma?
# Unicode character (U+3BC) not set up for use with LaTeX.
# See the inputenc package documentation for explanation.
# nano hw_ch4.rmd && ./hw_ch4.rmd && evince hw_ch4.pdf
"
4E1. In the model definition below, which line is the likelihood?
A: y_i is the likelihood, based on the expectation and deviation.
4M1. For the model definition below, simulate observed heights from the prior (not the posterior).
A:
```{r}
points <- 10
rnorm(points, mean=rnorm(points, 0, 10), sd=runif(points, 0, 10))
```
4M3. Translate the map model formula below into a mathematical model definition.
A:
```{r}
flist <- alist(
y tilda dnorm( mu , sigma ),
miu tilda dnorm( 0 , 10 ),
sigma tilda dunif( 0 , 10 )
)
```
"
Result:
What I eventually came to use is the following header. At first it sounded neat, but later I realized
+ is indeed easy to compile in one step
- this is code duplication
- mixing executable script and presentation data in one file is a security risk.
Code:
#!/usr/bin/env Rscript
#<!---
library(rmarkdown)
argv <- commandArgs(trailingOnly=FALSE)
fname <- sub("--file=", "", argv[grep("--file=", argv)])
render(fname, output_format="pdf_document")
quit(status=0)
#-->
---
title:
author:
date: "compiled on: `r Sys.time()`"
---
The quit() line is supposed to guarantee that the rest of the file is treated as data. The <!--- and --> comments are to render the executable code as comments in the data interpretation. They are, in turn, hidden by the #s from the shell.

Has anyone seen a simplex library for javascript/nodejs

I've been writing a lot of my scripts in NodeJs, but I need to use something like the GLPK libraries in order to handle some of the optimizations in my scripts. Has anyone heard of a javascript driver? I wonder how hard it would be to port coin to a V8 library.. probably above my pay grade.
Not sure if its what the OP is looking for, but I'm working on something here that might work. You would use it like this:
var solver = new Solver,
results,
model = {
optimize: "profit",
opType: "max",
constraints: {
"Costa Rican" : {max: 200},
"Etheopian": {max: 330}
},
variables: {
"Yusip": {"Costa Rican" : 0.5, "Etheopian": 0.5, profit: 3.5},
"Exotic": {"Costa Rican" : 0.25, "Etheopian": 0.75, profit: 4}
}
};
results = solver.solve(model);
console.log(results);
Where the results would end up being:
{feasible: true, Yusip: 270, Exotic: 260, result: 1985}
Its probably not the fastest solver in the world, but its easy enough to work with.
Javascript Simplex Libraries
SimplexJS
SimpleSimplex
YASMIJ.js
YASMIJ Example:
var input = {
type: "maximize",
objective : "x1 + 2x2 - x3",
constraints : [
"2x1 + x2 + x3 <= 14",
"4x1 + 2x2 + 3x3 <= 28",
"2x1 + 5x2 + 5x3 <= 30"
]
};
YASMIJ.solve( input ).toString();
// returns
"{"result":{"slack1":0,"slack2":0,"slack3":0,"x1":5,"x2":4,"x3":0,"z":13}}"
I don't know if this will help, but please have a look at numericjs.com. It's a javascript numerical analysis library that I'm working on that has a rudimentary implementation of a linear programming algorithm.
GLPK has actually been ported to JavaScript using emScripten. The resulting js is about 1 MB minified and 230 KB zipped.
As of today August 2018
1) Last committed Dec 2015:
https://github.com/hgourvest/node-glpk
2) Last committed Dec 2017:
https://github.com/jvail/glpk.js
Try them out!

Resources