Skip to content

Commit

Permalink
Update CHANGELOG.md
Browse files Browse the repository at this point in the history
  • Loading branch information
hyanwong committed Jun 4, 2024
1 parent 3e8cc6b commit f730460
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
- The standalone `preprocess_ts` function also applies the `split_disjoint_nodes`
method, which creates extra nodes but improves dating accuracy.

- Json metadata for mean time and variance in the mutation and node tables is now saved
with a suitable schema. This means `json.loads()` is no longer needed to read it.

## [0.1.6] - 2024-01-07

**Breaking changes**
Expand Down
10 changes: 5 additions & 5 deletions tsdate/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1023,17 +1023,19 @@ def get_modified_ts(self, result, eps):

def set_time_metadata(self, table, mean, var, default_schema, overwrite=False):
if var is not None:
table_name = type(table).__name__
assert len(mean) == len(var) == table.num_rows
if table.metadata_schema.schema is None or overwrite:
if len(table.metadata) == 0 or overwrite:
table.metadata_schema = default_schema
md_iter = ({} for _ in range(table.num_rows))
# For speed, assume we don't need to validate
encoder = table.metadata_schema.encode_row
logging.info(f"Set metadata schema on {type(table).__name__}")
logging.info(f"Set metadata schema on {table_name}")
else:
logging.warning(
"Could not set metadata: existing data with no schema"
f"Could not set metadata on {table_name}: "
"data already exists with no schema"
)
return
else:
Expand All @@ -1052,9 +1054,7 @@ def set_time_metadata(self, table, mean, var, default_schema, overwrite=False):
metadata_array.append(encoder(metadata_dict))
table.packset_metadata(metadata_array)
except tskit.MetadataValidationError as e:
logging.warning(
f"Could not set time data in {type(table).__name__} metadata: {e}"
)
logging.warning(f"Could not set time metadata in {table_name}: {e}")

def parse_result(self, result, epsilon, extra_posterior_cols=None):
# Construct the tree sequence to return and add other stuff we might want to
Expand Down

0 comments on commit f730460

Please sign in to comment.