mcstasscript.tests.test_Instr.DummyComponent

mcstasscript.tests.test_Instr.DummyComponent

class mcstasscript.tests.test_Instr.DummyComponent(*args, **kwargs)
__init__(*args, **kwargs)

Initializes McStas component with specified name and component

Parameters
  • instance_name (str) – name of the instance of the component

  • component_name (str) – name of the component type e.g. Arm, Guide_gravity, …

  • arguments (keyword) –

    ATlist of 3 floats, default [0, 0, 0]

    Sets AT_data describing position of component

    AT_RELATIVEstr, default “ABSOLUTE”

    sets AT_relative, describing position reference

    ROTATEDlist of 3 floats, default [0, 0, 0]

    Sets ROTATED_data, describing rotation of component

    ROTATED_RELATIVEstr, default “ABSOLUTE”

    Sets ROTATED_relative, sets reference for rotation

    RELATIVEstr

    Sets both AT_relative and ROTATED_relative

    WHENstr, default “”

    Sets WHEN string, should contain logical c expression

    EXTENDstr, default “”

    Sets initial EXTEND string, should contain c code

    GROUPstr, default “”

    Sets name of group the component should belong to

    JUMPstr, default “”

    Sets JUMP str

    SPLITint, default 0 (disabled)

    Sets SPLIT value

    comment: str, default “”

    Sets comment string

    c_code_before: str, default “”

    Sets c code before component

    c_code_after: str, default “”

    Sets c code after component

Methods

__init__(*args, **kwargs)

Initializes McStas component with specified name and component

add_search(statement[, SHELL])

Adds a search statement to the component

append_EXTEND(string)

Method for adding line of c to EXTEND section of this component

check_parameters(instrument_variables)

Checks the current component parameters are in given name list

clear_search()

Clears the component of all search statements

print_long()

Prints information about the component

print_short([longest_name])

Prints short description of component to list print

set_AT(at_list[, RELATIVE])

Method for setting position of component

set_AT_RELATIVE(relative)

Sets AT RELATIVE with string or Component instance

set_GROUP(string)

Method for setting GROUP keyword of this component

set_JUMP(string)

Method for setting JUMP expression of this component

set_RELATIVE(relative)

Method for setting reference of component position and rotation

set_ROTATED(rotated_list[, RELATIVE])

Method for setting rotation of component

set_ROTATED_RELATIVE(relative)

Sets ROTATED RELATIVE with string or Component instance

set_SPLIT(value)

Method for setting SPLIT value of this component

set_WHEN(string)

Method for setting WHEN c expression of this component

set_c_code_after(string)

Method for setting c code after this component

set_c_code_before(string)

Method for setting c code before this component

set_comment(string)

Sets a comment displayed before the component in written files

set_keyword_input([AT, AT_RELATIVE, ...])

set_parameters(*args, **kwargs)

Set Component parameters from dictionary input or keyword arguments

show_parameters([line_length])

Shows available parameters and their defaults for the component

show_parameters_simple()

Shows available parameters and their defaults for the component

show_search()

Shows all search statements of component

write_component(fo)

Method that writes component to file

set_parameters(*args, **kwargs)

Set Component parameters from dictionary input or keyword arguments

Relies on attributes added when McCode_Instr creates a subclass from the Component class where each component parameter is added as an attribute.

An error is raised if trying to set a parameter that does not exist

Parameters

args_as_dict (dict) – Parameters names and their values as dictionary