honeybee_radiance_command.rmtxop module

rmtxop command.

class honeybee_radiance_command.rmtxop.Rmtxop(options=None, output=None, matrices=None, transforms=None, transposes=None, scalars=None, operators=None)[source]

Bases: Command

Rmtxop command.

Concatenate, add, multiply, divide, transpose, scale, and convert matrices. The implementation here allows for matrix operations on upto four matrices at the same time. While the Radiance binary allows for even more, this restriction has been imposed here to keep the code somewhat clean.

In standard Radiance syntax, the entire command is specified in a single line. In the implementation here, the matrices and all the corresponding scaling factors, transformations and operators are specified through individual list. So, care must be taken to ensure that the order of transformations, scaling etc. is correctly assigned to the sequence of the matrices.

An extensive number of input and parameter possibilities are evaluated in the test module for this class. A review of that module is higly recommended to understand how to specify inputs, scalars, transforms and transposition options for this class.

Args: options: Command options. It will be set to Radiance default values

if unspecified.

output: File path to the output file (Default: None). matrices: A single file path or a list/tuple of multiple file paths of matrix

files.

transforms: A nested list of tuples/lists containing floating point numbers that

are meant to transform the matrix/matrices specified through the ‘matrices’ input. Defaults to None, implying no transformations. For a calculation involving 3 matrices, if a specific transformation, say weighting by (1,2,3.4) is to be done to the second matrix, then the input for this argument will be (None, (1,2,3.4), None).

scalars: A nested list of tuples/lists containing floating point numbers that

are meant to scale the matrix/matrices specified through the ‘matrices’ input. Defaults to None, implying no scaling. For a calculation involving 3 matrices, if scaling by -1.5 is to be done to the second matrix, then the input for this argument will be (None, -1.5, None).

transposes: A boolean value or a list of boolean values (in case of multiple

matrices) to specify transpose operation on the matrix/matrices. Defaults to None, implying no transpositions. For a calculation involving 3 matrices, if the first and third matrices are to be transposed, then the input for this argument will be [True,None,True].

operators: A character string or list of character strings indicating the

operation between two or more matrices. The default value is None indicating concatenation. If this input is specified then its length should be equal to one less than the number of matrices. For calculation involving 3 matrices, if the first and second matrices are to be added, and the result is to be multiplied by the third matrix, then the input will be [‘+’,’*]

Properties: * options * output * matrices * transforms * transposes * scalars * operators

after_run()

After run script.

Overwrite this method to add extra tasks that runs right after run method.

enclose_command(stdin_input=False)

Enclose command in quotes and exclamation point (‘!’). This method should be used when reading the input of a command from another Radiance command.

Example: rmtxop -c 47.4 119.9 11.6 “!rmtxop view transmission daylight sky” > output

run(env=None, cwd=None)

Run command as a subprocess.

Parameters:
  • env – Environmental variables (default: None).

  • cwd – Working directory (Default: ‘.’).

Returns:

Command return code.

Return type:

  • int

to_radiance(stdin_input=False)[source]

Command in Radiance format.

Parameters:

stdin_input – A boolean that indicates if the input for this command comes from stdin. This is for instance the case when you pipe the input from another command (default: False).

validate(stdin_input=False)[source]

Overwrite this method to add extra specific checks for the command. For instance for rcontrib you want to make sure there is at least one modifier set in the command.

This method will be executed right before running the command.

property command
property matrices

List of matrix files on which operations are to be performed.

property operators

The operator for specifying addition(‘+’), subtraction(‘-‘), multiplication(‘*’), division(/) or concatenation(.) between two matrices. The default operation is concatenation. In the case of addition, the two matrices involved must have the same number of components. If subtraction is desired, use addition (‘+’) with a scaling parameter of -1 for the second matrix (the -s option). For element-wise multiplication and division, the second matrix is permitted to have a single component per element, which will be applied equally to all components of the first matrix. If element-wise division is specified, any zero elements in the second matrix will result in a warning and the corresponding component(s) in the first matrix will be set to zero. In case of posix based systems the multiplication operator will be quoted ‘*’ automatically by the script.

property options

Rmtxop options.

property output

output file.

property pipe_to

Second command to pipe the outputs from this command.

property scalars

Scalar factor to scale the elements of the matrix that are specified as a single floating point number or a tuple or list of floating point numbers. If specified as a tuple or list, then its length should be equal to the original matrix components. If a single matrix is being considered for operation, then the input for this can be single number or a single list. If more than one matrix has been considered for operation then the input for this should be a list/tuple containing numbers or nested tuple/lists whose length is equal to the number of matrices. For the same matrix both transforms and scalars cannot be specified at the same time.

property transforms

Transformation coefficients that are specified as a single floating point number or a tuple or list of floating point numbers. If specified as tuple or list, then its length should be an even multiple of the original matrix components. If a single matrix is being considered for operation, then the input for this can be single number or a single list. If more than one matrix has been considered for operation then the input for this should be a list/tuple containing numbers or nested tuple/lists whose length is equal to the number of matrices. For the same matrix both transforms and scalars cannot be specified at the same time.

property transposes

If a single matrix is being considered for operation, then the input for this can be single a single boolean. If more than one matrix has been considered for operation then the input for this should be a list/tuple containing booleans.