utils.py 630 B

12345678910111213141516171819202122
  1. """Provide functions commonly used in this dataset."""
  2. import yaml
  3. from pathlib import Path
  4. from ptpython.ipython import embed
  5. def get_marker_names(dataset):
  6. """Get all defined marker names from dataset specific yaml files."""
  7. yaml_path = Path(__file__).parent / ".." / "yamls" / f"{dataset}.yaml"
  8. with open(yaml_path, "r") as stream:
  9. try:
  10. dict_yaml = yaml.safe_load(stream)
  11. return ["BOLD_" + x["name"] for x in dict_yaml["markers"]]
  12. except yaml.YAMLError as exc:
  13. print(exc)
  14. if __name__ == "__main__":
  15. markers_piop1 = get_marker_names("PIOP1")
  16. embed()