Exemple #1
0
    def __init__(self):
        with open(os.path.join(os.path.dirname(__file__), 'Config.json'),
                  'r') as json_file:
            config = json.load(json_file)
        self._shots = dict()

        self._shots['train'] = config['shots']['train']
        self._shots['test'] = config['shots']['test']
        self._shots['val'] = config['shots']['test']

        self._tags = config['diagnosis']['tags']
        # 截取信号的起始时间(ms)
        self._start_time = config['diagnosis']['start_time']
        # 重采样的信号频率(kHz)
        self._sample_rate = config['diagnosis']['sample_rate']
        self._normalized = config['normalized']
        self._directory = config['directory']
        if not os.path.exists(self._directory):
            os.makedirs(self._directory)

        # 复制配置文件到输出路径
        with open(os.path.join(self._directory, 'Config.json'),
                  'w') as json_file:
            json.dump(config, json_file, indent=4)
        exit()
        ddb = Query()
        if self._normalized:
            self._normalize_param = ddb.get_normalize_parm(self._tags)
 def __init__(self, normalized=False):
     config = configparser.ConfigParser()
     config.read(
         os.path.join(os.path.dirname(__file__), 'DataSetConfig.ini'))
     self._tags = ast.literal_eval(config['Diagnosis']['tags'])
     self._sample_rate = int(config['Diagnosis']['sample_rate'])
     self._frame_size = int(config['Diagnosis']['frame_size'])
     self._step = int(config['Diagnosis']['step'])
     self._npy_path = config['path']['npy']
     if not os.path.exists(self._npy_path):
         os.makedirs(self._npy_path)
     ddb = Query()
     self._normalized = normalized
     if normalized:
         self._normalize_param = ddb.get_normalize_parm(self._tags)
     my_query = {'IsValidShot': True, 'IsDisrupt': False}
     self._shots = ddb.query(my_query)
     my_query = {
         'IsValidShot': True,
         'IsDisrupt': True,
         'CqTime': {
             "$gte": 0.05
         },
         'IpFlat': {
             '$gte': 110
         }
     }
     self._shots += ddb.query(my_query)