<jupyter_start><jupyter_text>Movshon lab - OpenEphys + Expo Converter<jupyter_code>from movshon_lab_to_nwb import MovshonOpenEphysNWBConverter
from pynwb import NWBHDF5IO
from nwbwidgets import nwb2widget
from pathlib import Path
# Source data
base_path = Path('/home/luiz/storage/taufferconsulting/client_ben/project_movshon/movshon_data/expo/exampledata/expo_openephys/m666l3#7')

oephys_dir = base_path / 'openephys/'
expo_file = base_path / 'm666l3#7[ori16].xml'
ttl_file = oephys_dir / '100_ADC1.continuous'

source_data = dict(
    OpenEphysRecordingExtractorInterface=dict(folder_path=str(oephys_dir)),
    ExpoDataInterface=dict(
        expo_file=str(expo_file),
        ttl_file=str(ttl_file)
    )
)

# Initialize converter
converter = MovshonOpenEphysNWBConverter(source_data=source_data)

# Get metadata from source data and modify any values you want
metadata = converter.get_metadata()
metadata['NWBFile']['session_description'] = 'my example conversion'

# Get conversion options and modify any values you want
conversion_options = converter.get_conversion_options()
conversion_options['OpenEphysRecordingExtractorInterface'] = dict(stub_test=True)  # Set to True for a quick test with partial data

# OPTIONAL - Validate source_data, metadata and conversion_options
converter.validate_source(source_data)
converter.validate_metadata(metadata)
converter.validate_conversion_options(conversion_options)

# Run conversion
output_file = 'out_example_openephys.nwb'

converter.run_conversion(
    metadata=metadata, 
    nwbfile_path=output_file, 
    save_to_file=True,
    overwrite=True,
    conversion_options=conversion_options
)<jupyter_output>Source data is valid!
Loading Open-Ephys: reading settings...
Decoding data from  openephys  format
Source data is valid!
Metadata is valid!
conversion_options is valid!
Metadata is valid!
conversion_options is valid!
Adding expo data...<jupyter_text>Check NWB file with widgets<jupyter_code>io = NWBHDF5IO(output_file, 'r')
nwbfile = io.read()
nwb2widget(nwbfile)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.07976653696498054, 'fraction_numerical': 0.009727626459143969, 'mean_word_length': 6.7330827067669174, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 1}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '370824', 'license': 'MIT', 'n_tokens_mistral': 712, 'n_tokens_neox': 677, 'n_words': 143, 'path': 'tutorials/openephys_nwb_conversion_simple.ipynb', 'repo_name': 'catalystneuro/movshon-lab-to-nwb', 'size': '2056'}