Commit 4da0534a authored by Mattia Mancini's avatar Mattia Mancini

Add return of return of RCU mode

parent b8832147
......@@ -5,6 +5,7 @@ from .rspctl_probe import produce_xcstatistics, set_xcsubband
import numpy
DEFAULT_URI = "http://lofar.eu"
NUM_RCU = 96
# method to be exposed through server
# uses a decorator to automatically convert to and from variants
@uamethod
......@@ -14,18 +15,20 @@ def get_crosslet_statistics(parent, subband, integration_time):
integration_time))
set_xcsubband(subband)
data = produce_xcstatistics(integration_time=integration_time, duration=integration_time)['data']
num_rcu = 96
time_slots = int(len(data) / num_rcu / num_rcu)
crosslets_complex = data.reshape((time_slots, num_rcu, num_rcu))
crosslets = numpy.zeros((2, num_rcu, num_rcu), dtype=float)
res = produce_xcstatistics(integration_time=integration_time, duration=integration_time)
data = res['data']
time_slots = int(len(data) / NUM_RCU / NUM_RCU)
crosslets_complex = data.reshape((time_slots, NUM_RCU, NUM_RCU))
crosslets = numpy.zeros((2, NUM_RCU, NUM_RCU), dtype=float)
crosslets[0, :, :] = crosslets_complex.real
crosslets[1, :, :] = crosslets_complex.imag
crosslets = crosslets.tolist()
timestamp = time.localtime()
rcu = res['rcus']
rcus_mode = [rcu[i]["mode"] for i in rcu]
return timestamp, crosslets
return timestamp, crosslets, rcus_mode
def define_get_crosslet_statistics_parameters(object, idx):
......@@ -50,6 +53,13 @@ def define_get_crosslet_statistics_parameters(object, idx):
cross.ArrayDimensions = [96, 96, 2]
cross.Description = ua.LocalizedText("crosscorrelation statistics")
rcusmode = ua.Argument()
rcusmode.Name = "rcus_mode"
rcusmode.DataType = ua.NodeId(ua.ObjectIds.UInt16)
rcusmode.ValueRank = 1
rcusmode.ArrayDimensions = [96]
rcusmode.Description = ua.LocalizedText("RCUs mode")
timestamp = ua.Argument()
timestamp.Name = "timestamp"
timestamp.DataType = ua.NodeId(ua.ObjectIds.DateTime)
......@@ -59,7 +69,7 @@ def define_get_crosslet_statistics_parameters(object, idx):
return object.add_method(idx, "record_cross", get_crosslet_statistics,
[subband, integration_time],
[timestamp, cross])
[timestamp, cross, rcu])
def connect_to_server(url, port):
client = Client("opc.tcp://{}:{}/".format(url, port))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment