Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small fixes #238

Merged
merged 2 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions mesmerize_core/caiman_extensions/cnmf.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,11 @@ def get_contours(
@_component_indices_parser
@cnmf_cache.use_cache
def get_temporal(
self, component_indices: Union[np.ndarray, str] = None, add_background: bool = False, return_copy=True
self,
component_indices: Union[np.ndarray, str] = None,
add_background: bool = False,
add_residuals: bool = False,
return_copy=True
) -> np.ndarray:
"""
Get the temporal components for this CNMF item, basically ``CNMF.estimates.C``
Expand All @@ -329,8 +333,11 @@ def get_temporal(
| if ``"bad"`` uses bad components, i.e. ``Estimates.idx_components_bad``
| if ``np.ndarray``, uses the indices in the provided array

add_background: bool
if ``True``, add the temporal background, ``cnmf.estimates.C + cnmf.estimates.f``
add_background: bool, default False
if ``True``, add the temporal background, adds ``cnmf.estimates.f``

add_residuals: bool, default False
if ``True``, add residuals, i.e. ``cnmf.estimates.YrA``

return_copy: bool
| if ``True`` returns a copy of the cached value in memory.
Expand Down Expand Up @@ -369,10 +376,14 @@ def get_temporal(
C = cnmf_obj.estimates.C[component_indices]
f = cnmf_obj.estimates.f

temporal = C

if add_background:
return C + f
else:
return C
temporal += f
elif add_residuals:
temporal += cnmf_obj.estimates.YrA

return temporal

@validate("cnmf")
@_component_indices_parser
Expand Down
1 change: 0 additions & 1 deletion mesmerize_core/caiman_extensions/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ def remove_item(self, index: Union[int, str, UUID], remove_data: bool = True, sa
# Save new df to disc
self._df.to_pickle(self._df.paths.get_batch_path())

@warning_experimental("This feature is new and the might improve in the future")
def get_params_diffs(self, algo: str, item_name: str) -> pd.DataFrame:
"""
Get the parameters that differ for a given `item_name` run with a given `algo`
Expand Down
Loading