zhuwq0 commited on
Commit
084120a
1 Parent(s): 7c9b222

update data

Browse files
Files changed (1) hide show
  1. quakeflow_demo.py +12 -4
quakeflow_demo.py CHANGED
@@ -41,10 +41,10 @@ class BatchBuilderConfig(datasets.BuilderConfig):
41
  :param num_stations_list: possible number of stations in a batch
42
  """
43
 
44
- def __init__(self, batch_size: int, num_stations_list: List, **kwargs):
45
  super().__init__(**kwargs)
46
  self.batch_size = batch_size
47
- self.num_stations_list = num_stations_list
48
 
49
 
50
  class QuakeFlow_NC(datasets.GeneratorBasedBuilder):
@@ -89,6 +89,8 @@ class QuakeFlow_NC(datasets.GeneratorBasedBuilder):
89
  features = datasets.Features(
90
  {
91
  "data": datasets.Array2D(shape=(3, self.nt), dtype="float32"),
 
 
92
  }
93
  )
94
 
@@ -96,6 +98,8 @@ class QuakeFlow_NC(datasets.GeneratorBasedBuilder):
96
  features = datasets.Features(
97
  {
98
  "data": datasets.Array3D(shape=(None, 3, self.nt), dtype="float32"),
 
 
99
  }
100
  )
101
 
@@ -165,7 +169,11 @@ class QuakeFlow_NC(datasets.GeneratorBasedBuilder):
165
  for i, station_id in enumerate(station_ids):
166
  waveforms[:, : self.nt] = event[station_id][:, : self.nt]
167
 
168
- yield f"{event_id}/{station_id}", {"data": waveforms}
 
 
 
 
169
 
170
  elif (
171
  (self.config.name == "event")
@@ -185,4 +193,4 @@ class QuakeFlow_NC(datasets.GeneratorBasedBuilder):
185
  waveforms = (waveforms - np.mean(waveforms, axis=1, keepdims=True)) / std
186
  waveforms = waveforms.astype(np.float32)
187
 
188
- yield event_id, {"data": waveforms}
 
41
  :param num_stations_list: possible number of stations in a batch
42
  """
43
 
44
+ def __init__(self, batch_size: int, num_stations: List, **kwargs):
45
  super().__init__(**kwargs)
46
  self.batch_size = batch_size
47
+ self.num_stations = num_stations
48
 
49
 
50
  class QuakeFlow_NC(datasets.GeneratorBasedBuilder):
 
89
  features = datasets.Features(
90
  {
91
  "data": datasets.Array2D(shape=(3, self.nt), dtype="float32"),
92
+ "event_id": datasets.Value("string"),
93
+ "station_id": datasets.Value("string"),
94
  }
95
  )
96
 
 
98
  features = datasets.Features(
99
  {
100
  "data": datasets.Array3D(shape=(None, 3, self.nt), dtype="float32"),
101
+ "event_id": datasets.Value("string"),
102
+ "station_ids": datasets.Sequence(datasets.Value("string")),
103
  }
104
  )
105
 
 
169
  for i, station_id in enumerate(station_ids):
170
  waveforms[:, : self.nt] = event[station_id][:, : self.nt]
171
 
172
+ yield f"{event_id}/{station_id}", {
173
+ "data": waveforms,
174
+ "event_id": event_id,
175
+ "station_id": station_id,
176
+ }
177
 
178
  elif (
179
  (self.config.name == "event")
 
193
  waveforms = (waveforms - np.mean(waveforms, axis=1, keepdims=True)) / std
194
  waveforms = waveforms.astype(np.float32)
195
 
196
+ yield event_id, {"data": waveforms, "event_id": event_id, "station_ids": station_ids}