convert_nirs_NIRx_to_SNIRF.py 838 B

123456789101112131415161718192021222324252627
  1. """Pipeline to convert .nirx to SNIRF."""
  2. import logging
  3. from almirah import index
  4. from almirah import Layout
  5. from almirah import Specification
  6. from almirah.utils.convert import convert
  7. logging.basicConfig(filename="logs/convert_nirs_to_SNIRF.log", level=logging.DEBUG)
  8. logging.getLogger().addHandler(logging.StreamHandler())
  9. SRC = ""
  10. DST = ""
  11. source_spec = Specification.create_from_file("configs/specifications/sourcedata.yaml")
  12. src_lay = Layout(root=SRC, specification_name="sourcedata")
  13. bids_spec = Specification.create_from_file("configs/specifications/bids.yaml")
  14. dst_lay = Layout(root=DST, specification_name="bids")
  15. src_lay.index(f"{SRC}/nirs")
  16. index.commit()
  17. files = src_lay.query(sourcetype="nirs", extension=".nirx")
  18. anonymize = {"daysback": "", "keep_his": False}
  19. convert(files, "SNIRF", dst_lay, anonymize=anonymize)