示例#1
0
def write_timed_dataframe(path, df):
    df = df.copy()
    df.index = pd.Index([i.strftime(get_cern_time_format()) for i in df.index],
                        dtype=str)
    tfs.write(str(path), df, save_index=get_time_col())
示例#2
0
"""
import datetime
import re
from contextlib import suppress
from typing import Dict, List, NewType, Sequence, Tuple, Union

import numpy as np
import tfs

# from jpype import JException, java
from omc3.tune_analysis import constants as const
from omc3.utils import logging_tools
from omc3.utils.mock import cern_network_import
from omc3.utils.time_tools import CERNDatetime

TIME_COL = const.get_time_col()
START_TIME = const.get_tstart_head()
END_TIME = const.get_tend_head()

LOG = logging_tools.get_logger(__name__)
pytimber = cern_network_import("pytimber")
jpype = cern_network_import("jpype")

MAX_RETRIES = 10  # number of retries on retryable exception
AcceptableTimeStamp = NewType("AcceptableTimeStamp", Union[CERNDatetime, int,
                                                           float])


def lhc_fill_to_tfs(fill_number: int,
                    keys: Sequence[str] = None,
                    names: Dict[str, str] = None) -> tfs.TfsDataFrame:
示例#3
0
def read_timed_dataframe(path):
    df = tfs.read(path, index=get_time_col())
    df.index = pd.Index(
        [CERNDatetime.from_cern_utc_string(i) for i in df.index], dtype=object)
    return df