Skip to content

Commit

Permalink
update description and data collection inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
stephprince committed Sep 6, 2024
1 parent cb7552d commit 6a913bb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
11 changes: 9 additions & 2 deletions src/nwb/NWBFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@ NWBFile::NWBFile(const std::string& idText, std::shared_ptr<BaseIO> io)

NWBFile::~NWBFile() {}

Status NWBFile::initialize()
Status NWBFile::initialize(const std::string description,
const std::string dataCollection)
{
this->description = description;
this->dataCollection = dataCollection;

if (std::filesystem::exists(io->getFileName())) {
return io->open(false);
} else {
Expand Down Expand Up @@ -68,6 +72,9 @@ Status NWBFile::createFileStructure()
io->createGroup("/general");
io->createGroup("/general/devices");
io->createGroup("/general/extracellular_ephys");
if (dataCollection != "") {
io->createStringDataSet("/general/data_collection", dataCollection);
}

io->createGroup("/specifications");
io->createReferenceAttribute("/specifications", "/", ".specloc");
Expand All @@ -84,7 +91,7 @@ Status NWBFile::createFileStructure()
std::string time = getCurrentTime();
std::vector<std::string> timeVec = {time};
io->createStringDataSet("/file_create_date", timeVec);
io->createStringDataSet("/session_description", "a recording session");
io->createStringDataSet("/session_description", description);
io->createStringDataSet("/session_start_time", time);
io->createStringDataSet("/timestamps_reference_time", time);
io->createStringDataSet("/identifier", identifierText);
Expand Down
8 changes: 7 additions & 1 deletion src/nwb/NWBFile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@ class NWBFile
/**
* @brief Initializes the NWB file by opening and setting up the file
* structure.
* @param description A description of the NWBFile session.
* @param dataCollection Information about the data collection methods.
*/
Status initialize();
Status initialize(const std::string description = "a recording session",
const std::string dataCollection = "");

/**
* @brief Finalizes the NWB file by closing it.
Expand Down Expand Up @@ -124,6 +127,9 @@ class NWBFile
const std::string identifierText;
std::shared_ptr<BaseIO> io;
static std::vector<SizeType> emptyContainerIndexes;

std::string description;
std::string dataCollection;
};

} // namespace AQNWB::NWB

0 comments on commit 6a913bb

Please sign in to comment.