Skip to content

Commit 5706df4

Browse files
committed
Fix sqlite issue
1 parent 270cc3d commit 5706df4

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

ace/database.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,16 +238,19 @@ def add_col(self, key, val):
238238
# Depending on config, either excludes peak, or allows it through
239239
# but flags potential problems for later inspection.
240240
def validate(self):
241-
241+
self.is_valid = True
242+
242243
for c in [self.x, self.y, self.z]:
243244
if c == '' or c is None:
244245
logger.debug('Missing x, y, or z coordinate information: [%s, %s, %s]' % tuple(
245246
[str(e) for e in [self.x, self.y, self.z]]))
247+
self.is_valid = False
246248
return False
247249
try:
248250
if abs(c) >= 100:
249251
logger.debug(
250252
'Invalid coordinates: at least one dimension (x,y,z) >= 100.')
253+
self.is_valid = False
251254
return False
252255
except:
253256
print(c)
@@ -258,6 +261,7 @@ def validate(self):
258261
if sorted_xyz[0] == 0 and sorted_xyz[1] == 0:
259262
logger.debug(
260263
"At least two dimensions have value == 0; coordinate is probably not real.")
264+
self.is_valid = False
261265
return False
262266

263267
return True

ace/tableparser.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,8 @@ def parse_table(data):
336336
# If we don't have to worry about groups, the entire row is a single activation
337337
if not len(group_cols):
338338
activation = create_activation(r, labels, standard_cols, group_row)
339-
if activation.validate():
339+
activation.validate() # Now sets is_valid attribute
340+
if activation.is_valid:
340341
table.activations.append(activation)
341342

342343
# ...otherwise we need to iterate over groups and select appropriate columns for each.
@@ -365,7 +366,8 @@ def parse_table(data):
365366

366367
# Create activation and add to table if it passes validation
367368
activation = create_activation(activation_columns, activation_labels, activation_scs, groups)
368-
if activation.validate():
369+
activation.validate() # Now sets is_valid attribute
370+
if activation.is_valid:
369371
table.activations.append(activation)
370372

371373
table.finalize()

0 commit comments

Comments
 (0)