|
| 1 | +import logging |
1 | 2 | from pathlib import Path |
2 | 3 | from typing import List, Tuple |
3 | 4 |
|
@@ -30,20 +31,19 @@ def add_optogenetics(nwbfile: NWBFile, metadata: dict, device_metadata: List[dic |
30 | 31 | device_metadata : list |
31 | 32 | List of dictionaries containing metadata for devices used in the experiment. |
32 | 33 | """ |
| 34 | + logger = logging.getLogger("convert") |
33 | 35 | if not all( |
34 | 36 | [ |
35 | 37 | x in metadata |
36 | 38 | for x in [ |
37 | | - # "optogenetic_experiment", |
38 | 39 | "virus_injection", |
39 | 40 | "opto_excitation_source", |
40 | 41 | "optical_fiber", |
41 | 42 | "optogenetic_stimulation_software", |
42 | 43 | ] |
43 | 44 | ] |
44 | 45 | ): |
45 | | - print("missing optogenetic metadata") |
46 | | - # TODO Log lack of metadata |
| 46 | + logger.info("No available optogenetic metadata") |
47 | 47 | return |
48 | 48 |
|
49 | 49 | # Add optogenetic experiment metadata |
@@ -80,6 +80,16 @@ def add_optogenetics(nwbfile: NWBFile, metadata: dict, device_metadata: List[dic |
80 | 80 | def make_optogenetic_source( |
81 | 81 | nwbfile: NWBFile, source_metadata: dict, device_metadata: List[dict] |
82 | 82 | ) -> ExcitationSource: |
| 83 | + """Create an ExcitationSource object and add it to the NWB file. |
| 84 | +
|
| 85 | + Args: |
| 86 | + nwbfile (NWBFile): The NWB file to which the excitation source will be added. |
| 87 | + source_metadata (dict): Metadata for the excitation source. |
| 88 | + device_metadata (List[dict]): Metadata for the excitation device used in the experiment. |
| 89 | +
|
| 90 | + Returns: |
| 91 | + ExcitationSource: The created ExcitationSource object. |
| 92 | + """ |
83 | 93 | model_metadata = get_optogenetic_source_device( |
84 | 94 | source_metadata["model_name"], device_metadata |
85 | 95 | ) |
@@ -108,6 +118,16 @@ def make_optical_fiber( |
108 | 118 | excitation_source: ExcitationSource, |
109 | 119 | device_metadata: List[dict], |
110 | 120 | ) -> OpticalFiber: |
| 121 | + """Create an OpticalFiberLocationsTable and populate it with optical fiber data. |
| 122 | +
|
| 123 | + Args: |
| 124 | + nwbfile (NWBFile): The NWB file to which the optical fiber locations table will be added. |
| 125 | + fiber_metadata_list (dict): Metadata for the optical fibers. |
| 126 | + excitation_source (ExcitationSource): The excitation source associated with the optical fibers. |
| 127 | +
|
| 128 | + Returns: |
| 129 | + OpticalFiber: The created OpticalFiber object. |
| 130 | + """ |
111 | 131 | # make the locations table |
112 | 132 | optical_fiber_locations_table = OpticalFiberLocationsTable( |
113 | 133 | description="Information about implanted optical fiber locations", |
@@ -172,6 +192,13 @@ def make_virus_injecton( |
172 | 192 | ---------- |
173 | 193 | virus_injection_metadata : dict |
174 | 194 | Metadata containing information about the virus injection. |
| 195 | + device_metadata : list |
| 196 | + List of dictionaries containing metadata for virus "devices" used in the experiment. |
| 197 | +
|
| 198 | + Returns |
| 199 | + ------- |
| 200 | + Tuple[OptogeneticViruses, OptogeneticVirusInjections] |
| 201 | + A tuple containing the OptogeneticViruses and OptogeneticVirusInjections objects. |
175 | 202 | """ |
176 | 203 | included_viruses = {} |
177 | 204 | injections_list = [] |
|
0 commit comments