Closed shervin86 closed 1 year ago
A corresponding test is missing...
My test script:
import sys
from mcstasscript.interface import functions
from mcstasscript.interface import instr as mcinstr
# this is needed to get the location of McStas executables and libraries
# my_configurator = functions.Configurator()
calc1 = mcinstr.McStas_instr(
"OriginTest",
executable_path="/usr/local/mcstas/2.7.1/bin",
package_path="/usr/local/mcstas/2.7.1/",
)
instr = calc1
Origin = instr.add_component("Origin", "Progress_bar")
Origin.set_AT(["0", "0", "0"], RELATIVE="ABSOLUTE")
src = instr.add_component("Source_simple", "Source_simple")
src.set_parameters(xwidth=0.1, yheight=0.1, dist=2, E0=5, dE=4)
guide_start = instr.add_component("Source_end", "Arm")
guide_start.set_AT([0, 0, 2], RELATIVE=src)
guide_1 = instr.add_component("guide_1", "Guide_gravity")
guide_1.set_parameters(w1=0.03, h1=0.03, m=3, l=10)
guide_1.set_RELATIVE(guide_start)
guide_end = instr.add_component("Guide_end", "Arm")
guide_end.set_AT(guide_1.l, RELATIVE=guide_1)
sample_position = instr.add_component(
"Sample_position",
"Arm",
)
sample_position.set_AT(0.5, RELATIVE=guide_end)
vout = instr.add_component("vout", "MCPL_output", AT=[0, 0, 0], RELATIVE="PREVIOUS")
vout.filename = '"vout"'
output = instr.backengine()
# print(mycalculator.output["mcpl"])
calc2 = mcinstr.McStas_instr(
"MCPLTest",
# input_path="/dev/shm/mcstasscript",
executable_path="/usr/local/mcstas/2.7.1/bin",
package_path="/usr/local/mcstas/2.7.1/",
)
calc2.input = calc1.output
instr = calc2
Origin = instr.add_component("Origin", "Progress_bar")
Origin.set_AT(["0", "0", "0"], RELATIVE="ABSOLUTE")
src = instr.add_component("mcpl", "MCPL_input")
src.filename = '"none"'
guide_start = instr.add_component("Source_end", "Arm")
guide_start.set_AT([0, 0, 2], RELATIVE=src)
guide_1 = instr.add_component("guide_1", "Guide_gravity")
guide_1.set_parameters(w1=0.03, h1=0.03, m=3, l=10)
guide_1.set_RELATIVE(guide_start)
guide_end = instr.add_component("Guide_end", "Arm")
guide_end.set_AT(guide_1.l, RELATIVE=guide_1)
sample_position = instr.add_component(
"Sample_position",
"Arm",
)
sample_position.set_AT(0.5, RELATIVE=guide_end)
banana = instr.add_component("banana", "Monitor_nD", RELATIVE=sample_position)
banana.xwidth = 2.0
banana.yheight = 0.3
banana.restore_neutron = 1
banana.filename = '"banana.dat"'
banana.options = '"theta limits=[5 175] bins=150, banana"'
calc2.backengine()
sys.exit(0)
from libpyvinyl.Instrument import Instrument
libpyvinylINSTR = Instrument("testInstr")
libpyvinylINSTR.add_calculator(calc1)
libpyvinylINSTR.add_calculator(calc2)
libpyvinylINSTR.run()
My testing script should be a simple but valid example. Would you like something different?
I rebased w.r.t. to the master. The tests are failing because of libpyvinyl. I fixed that in https://github.com/PaNOSC-ViNYL/libpyvinyl/pull/74
MCPLDataFormat
is defined to keep the path of an MCPL file.pyvinylMCPLData
data class is defined