Quick Tip: Variable Formatting in Templates

Rescale makes it easy to run a design of experiments, as previously discussed in this post. Here we will provide some quick tips on template generation so your variables are formatted to your liking.
We support two methods for specifying a range of variables:
1. Uploading a comma-separated values (CSV) file, where each row is a case–also known as a “run” in Rescale parlance
2. Specifying the variable ranges directly in your browser
Once your variables are defined, you can then create templates, where the basic placeholder for a variable, such as “x”, looks like this:

${x}

If you use this syntax and specify your variables in a CSV file, then we will replace the placeholder with the value from your CSV without any modification. This can be useful if you would like to include non-numeric data in a file specific to that case. For example, you might include a description of each case as a comment in an input file, which may be more meaningful than the identifier we automatically assign to that case. So if your CSV looks like this:

description, v, z
case 1a, 2.2, 3.4
case 1b, 2.3, 3.4
case 2a, 3.1, 3.2

And your input file template looks like this:

# ${description}
v: ${v}
z: ${z}

Then the processed template for the first case would look like this:

# case 1a
vel: 2.2
z: 3.4

You may prefer to have a specific consistent number format in the file, regardless of how the variable was specified in the CSV or how you specified it in the browser. For this situation, you can supply an additional format instruction, using a “0” or “#” for a digit, where trailing zeros are absent if the “#” symbol is used. Here are some examples:

x ${x?string(“0”)} ${x?string(“0.0”)} ${x?string(“0.00##”)}
0.9 1 0.9 0.90
1.49 1 1.5 1.49
-55.123 -55 -55.1 -55.123
9810 9810 9810.0 9810.00

Notice that when the format string has fewer digits to the right of the decimal place than the value, then the value will be rounded accordingly. We also support scientific notation:

x ${x?string(“0E0”)} ${x?string(“00E00”)} ${x?string(“0.0##E0”)}
0.9 9E-1 90E-02 9.0E-1
1.49 1E0 15E-01 1.49E0
-55.123 -6E1 -55E00 -5.512E1
9810 1E4 98E02 9.81E3

We hope this system makes it easier for you to run design of experiments on Rescale.

Author

  • Adam McKenzie

    As CTO, Adam is responsible for managing the HPC and customer success teams. Adam began his career at Boeing, where he spent seven years working on the 787, managing structural and software engineering projects designing, analyzing, and optimizing the wing. Adam holds a B.S. in Mechanical Engineering cum laude from Oregon State University.

Similar Posts