##// END OF EJS Templates
Few fixes to build on CentOS 7 and adds simple example of virtual product...
jeandet -
r1505:4bf34af32858
parent child
Show More
@@ -0,0 +1,38
1 import traceback
2 from SciQLopBindings import PyDataProvider, Product, VectorTimeSerie, ScalarTimeSerie, DataSeriesType
3 import numpy as np
4 from spwc.cache import _cache
5 from spwc.common.datetime_range import DateTimeRange
6 from datetime import datetime, timedelta, timezone
7 from spwc.common.variable import SpwcVariable
8 from spwc.amda import AMDA
9
10 amda = AMDA()
11
12
13 def vp_make_scalar(var=None):
14 if var is None:
15 return (((np.array([]), np.array([])), np.array([])), DataSeriesType.SCALAR)
16 else:
17 return (((var.time, np.array([])), var.data), DataSeriesType.SCALAR)
18
19 class DemoVP(PyDataProvider):
20 def __init__(self):
21 super().__init__()
22 self.register_products([Product("/VP/thb_fgm_gse_mod",[],{"type":"scalar"})])
23
24 def get_data(self,metadata,start,stop):
25 try:
26 tstart = datetime.fromtimestamp(start, tz=timezone.utc)
27 tend = datetime.fromtimestamp(stop, tz=timezone.utc)
28 thb_bs = amda.get_parameter(start_time=tstart, stop_time=tend, parameter_id='thb_bs', method="REST")
29 thb_bs.data = np.sqrt((thb_bs.data*thb_bs.data).sum(axis=1))
30 return vp_make_scalar(thb_bs)
31 except Exception as e:
32 print(traceback.format_exc())
33 print(f"Error in {__file__} ",str(e))
34 return (((np.array([]), np.array([])), np.array([])), ts_type)
35
36
37 t=DemoVP()
38
@@ -17,6 +17,11 shiboken2_build_flags = run_command(python3, 'shiboken-helper.py', '--includes',
17 17 shiboken2_link_flags = run_command(python3, 'shiboken-helper.py', '--libs', modules_arg).stdout().strip('\n').split(' ')
18 18 shiboken2_typesystem = run_command(python3, 'shiboken-helper.py', '--typesystem').stdout().strip('\n')
19 19
20 message('shiboken2_build_flags = @0@'.format(shiboken2_build_flags))
21 message('shiboken2_link_flags = @0@'.format(shiboken2_link_flags))
22 message('shiboken2_typesystem = @0@'.format(shiboken2_typesystem))
23
24
20 25 sciqlop_bindings_incs = shiboken2_build_flags + [
21 26 '-I'+meson.current_source_dir()+'/../../gui/include',
22 27 '-I'+meson.current_source_dir()+'/../../core/include',
@@ -1,3 +1,4
1 1
2 2 configure_file(input:'TestPlugin.py', output:'TestPlugin.py', copy:true)
3 3 configure_file(input:'SPWC-Amda.py', output:'SPWC-Amda.py', copy:true)
4 configure_file(input:'Demo-virtual-product.py', output:'Demo-virtual-product.py', copy:true)
@@ -29,14 +29,14 if shiboken2.__file__ and shiboken2_generator.__file__ and PySide2.__file__:
29 29 PySide2_inc = first_existing_path([PySide2.__path__[0]+'/include','/usr/include/PySide2'])
30 30 PySide2_typesys = first_existing_path([PySide2.__path__[0]+'/typesystems','/usr/share/PySide2/typesystems'])
31 31 PySide2_includes = first_existing_path([PySide2.__path__[0]+'/include','/usr/include/PySide2'])
32 shiboken2_includes = first_existing_path([shiboken2.__path__[0]+'/include','/usr/include/shiboken2'])
32 shiboken2_includes = first_existing_path([shiboken2.__path__[0]+'/include',shiboken2_generator.__path__[0]+'/include','/usr/include/shiboken2'])
33 33
34 34 if args.typesystem:
35 35 print(PySide2_typesys)
36 36 modules = args.modules.split(',')
37 37 if args.libs:
38 main_lib = (glob(shiboken2.__path__[0]+'/libshiboken2'+importlib.machinery.EXTENSION_SUFFIXES[0])+glob("/usr/lib64/"+'/libshiboken2'+importlib.machinery.EXTENSION_SUFFIXES[0]))[0]
39 main_lib += " "+(glob(PySide2.__path__[0]+'/libpyside2'+importlib.machinery.EXTENSION_SUFFIXES[0])+glob("/usr/lib64/"+'/libpyside2'+importlib.machinery.EXTENSION_SUFFIXES[0]))[0]
38 main_lib = (glob(shiboken2.__path__[0]+'/libshiboken2'+importlib.machinery.EXTENSION_SUFFIXES[0]+'*')+glob("/usr/lib64/"+'/libshiboken2'+importlib.machinery.EXTENSION_SUFFIXES[0]+'*'))[0]
39 main_lib += " "+(glob(PySide2.__path__[0]+'/libpyside2'+importlib.machinery.EXTENSION_SUFFIXES[0]+'*')+glob("/usr/lib64/"+'/libpyside2'+importlib.machinery.EXTENSION_SUFFIXES[0]+'*'))[0]
40 40 modules_libs = [importlib.import_module(f'PySide2.{module}').__file__ for module in modules]
41 41 print(" ".join([main_lib]+ modules_libs))
42 42 if args.includes:
General Comments 0
You need to be logged in to leave comments. Login now