Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
KarsVeldkamp committed Mar 11, 2024
2 parents af88d1e + 0791b57 commit e471ca2
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 2 deletions.
Binary file added desktop.ini
Binary file not shown.
2 changes: 1 addition & 1 deletion scripts/matlab2python/mat2py_listnumpy.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

% Convert MATLAB arrays to NumPy arrays
for i = 1:numel(matlab_arrays)
np_array = py.numpy.array(matlab_arrays{i}(:).'); % Convert to column vector and then to NumPy array
np_array = py.numpy.array(matlab_arrays{i}); % Convert to column vector and then to NumPy array
py_arrays.append(np_array);
end
end
2 changes: 1 addition & 1 deletion scripts/save_tsdf_data.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
py_dir_path = py.str(mat_dir_path);
py_metadata_file_name = py.str(mat_metadata_file_name);


% Run the python script save_tsdf_data.py and get the 3 outputs
[py_succ, ~] = pyrunfile("tsdf_python_interface\save_tsdf_data.py",["Success" "Return_list_metadata" "Return_list_data"], py_list_metadata=py_list_metadata, py_list_data=py_list_data, py_dir_path=py_dir_path, py_metadata_file_name=py_metadata_file_name);

Expand Down
1 change: 1 addition & 0 deletions scripts/tsdf_python_interface/save_tsdf_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
for metadata, data in zip(py_list_metadata, py_list_data):
metadata = json.loads(metadata)
file_name = metadata["file_name"]
print(data.shape)
new_metadata = tsdf.write_binary_file(py_dir_path, file_name, data, metadata)
py_updated_list_metadata.append(new_metadata)

Expand Down
10 changes: 10 additions & 0 deletions tsdf_values_idx.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function indices = tsdf_values_idx(metadata_list, X, week)
indices = [];
for i = 1:length(metadata_list)
% Use regular expression to match the pattern
expression = sprintf('WatchData\\.(PPG|IMU|EDA|ECG)\\.Week%s\\.raw_segment\\d+_%s\\.bin', num2str(week), X);
if ~isempty(regexp(metadata_list{i}.file_name, expression, 'once'))
indices = [indices, i];
end
end
end

0 comments on commit e471ca2

Please sign in to comment.