sterbini / cl2pd

A simple package to convert CERN Logging information (using pytimber/CALS, mat-files, massi-files, TFS-files...) in to pandas dataframes.
GNU General Public License v3.0
1 stars 7 forks source link

importLSA.LHCLsa2pd : Non "_END" beam processes #41

Open nkarast opened 6 years ago

nkarast commented 6 years ago

Hello,

Can you reproduce the situtation below?

t1 = pd.Timestamp("2018-07-25 20:26:41")
t2 = pd.Timestamp("2018-07-26 02:11:49")
importLSA.LHCLsa2pd(parameterList=['ADTHorM1.B2/PH_SHIFT_1'], beamprocessList=['RAMP_PELP-SQUEEZE-ATS-65cm_HighTele_V1'], t1=t1, t2=t2)
ValueErrorTraceback (most recent call last)
<ipython-input-104-9f858522582a> in <module>()
----> 1 importLSA.LHCLsa2pd(parameterList=['ADTHorM1.B2/PH_SHIFT_1'], beamprocessList=['RAMP_PELP-SQUEEZE-ATS-65cm_HighTele_V1'], t1=t1, t2=t2)

/eos/user/n/nkarast/.local/lib/python2.7/site-packages/cl2pd/importLSA.pyc in LHCLsa2pd(parameterList, beamprocessList, t1, t2, verbose)
     54                              start=t1, end=t2)
     55             if len(trims):
---> 56                 a=pd.merge(a,pd.DataFrame(index=pd.to_datetime(trims[i].time,unit='s'),data=trims[i].data, columns=[i]), how='outer',left_index=True,right_index=True)
     57 
     58         beamprocessDFList.append(a);

/cvmfs/sft.cern.ch/lcg/views/LCG_93/x86_64-slc6-gcc62-opt/lib/python2.7/site-packages/pandas/core/frame.pyc in __init__(self, data, index, columns, dtype, copy)
    383                 else:
    384                     mgr = self._init_ndarray(data, index, columns, dtype=dtype,
--> 385                                              copy=copy)
    386             else:
    387                 mgr = self._init_dict({}, index, columns, dtype=dtype)

/cvmfs/sft.cern.ch/lcg/views/LCG_93/x86_64-slc6-gcc62-opt/lib/python2.7/site-packages/pandas/core/frame.pyc in _init_ndarray(self, values, index, columns, dtype, copy)
    511         # by definition an array here
    512         # the dtypes will be coerced to a single dtype
--> 513         values = _prep_ndarray(values, copy=copy)
    514 
    515         if dtype is not None:

/cvmfs/sft.cern.ch/lcg/views/LCG_93/x86_64-slc6-gcc62-opt/lib/python2.7/site-packages/pandas/core/frame.pyc in _prep_ndarray(values, copy)
   6222         values = values.reshape((values.shape[0], 1))
   6223     elif values.ndim != 2:
-> 6224         raise ValueError('Must pass 2-d input')
   6225 
   6226     return values

ValueError: Must pass 2-d input

While for the '_END' point of the BP it's working fine.

importLSA.LHCLsa2pd(parameterList=['ADTHorM1.B2/PH_SHIFT_1'], beamprocessList=['RAMP_PELP-SQUEEZE-ATS-65cm_HighTele_V1@1210_[END]'], t1=t1, t2=t2)
ADTHorM1.B2/PH_SHIFT_1
2018-07-25 23:03:33+00:00 -147.0

I think it is related to the fact that the trim tuple returned by pjLSA contains a single index array for the time record and then for the data record you get a 2D ndarray with times and data points. I can have a look at some point.

importLSA.lsa.getTrims(beamprocess='RAMP_PELP-SQUEEZE-ATS-65cm_HighTele_V1', parameter=['ADTHorM1.B2/PH_SHIFT_1'], start=t1, end=t2)

`{u'ADTHorM1.B2/PH_SHIFT_1': TrimTuple(time=[1532559603L], data=[array([[ 0. , 241. , 293. , 545. , 649. , 749. , 824. ,

  1. , 925. , 1025. , 1169. , 1210. ], [ 154. , 154. , 154. , 154. , 158.5, 167.2, 179.9, -179.9, -165. , -154.8, -147. , -147. ]])])}`

N.