Skip to content

Commit

Permalink
Merge branch '613' of https://github.com/cbroz1/spyglass
Browse files Browse the repository at this point in the history
  • Loading branch information
CBroz1 committed Oct 9, 2023
2 parents 946f62c + 07d0a14 commit 9bed1c9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
17 changes: 13 additions & 4 deletions src/spyglass/common/common_position.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,15 @@ def generate_pos_components(
position.create_spatial_series(
name=f"{prefix}position",
conversion=METERS_PER_CM,
data=position_info[f"{prefix}position"],
data=position_info["position"],
description=f"{prefix}x_position, {prefix}y_position",
**time_comments_ref,
)

orientation.create_spatial_series(
name=f"{prefix}orientation",
conversion=1.0,
data=position_info[f"{prefix}orientation"],
data=position_info["orientation"],
description=f"{prefix}orientation",
**time_comments_ref,
)
Expand Down Expand Up @@ -216,18 +216,22 @@ def calculate_position_info(
spatial_df: pd.DataFrame,
meters_to_pixels: float,
position_smoothing_duration,
orient_smoothing_std_dev,
led1_is_front,
is_upsampled,
upsampling_sampling_rate,
upsampling_interpolation_method,
orient_smoothing_std_dev=None,
speed_smoothing_std_dev=None,
max_LED_separation=None,
max_plausible_speed=None,
**kwargs,
):
CM_TO_METERS = 100

if not orient_smoothing_std_dev:
orient_smoothing_std_dev = kwargs.get(
"head_orient_smoothing_std_dev"
)
if not speed_smoothing_std_dev:
speed_smoothing_std_dev = kwargs.get("head_speed_smoothing_std_dev")
if not max_LED_separation:
Expand All @@ -237,7 +241,12 @@ def calculate_position_info(
if not all(
[speed_smoothing_std_dev, max_LED_separation, max_plausible_speed]
):
raise ValueError("Missing required parameters")
raise ValueError(
"Missing required parameters:\n\t"
+ f"speed_smoothing_std_dev: {speed_smoothing_std_dev}\n\t"
+ f"max_LED_separation: {max_LED_separation}\n\t"
+ f"max_plausible_speed: {max_plausible_speed}"
)

# Accepts x/y 'loc' or 'loc1' format for first pos. Renames to 'loc'
DEFAULT_COLS = ["xloc", "yloc", "xloc2", "yloc2", "xloc1", "yloc1"]
Expand Down
3 changes: 1 addition & 2 deletions src/spyglass/position/v1/position_trodes_position.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from ...common.common_behav import RawPosition
from ...common.common_nwbfile import AnalysisNwbfile
from ...common.common_positon import IntervalPositionInfo
from ...common.common_position import IntervalPositionInfo
from ...utils.dj_helper_fn import fetch_nwb
from .dlc_utils import check_videofile, get_video_path

Expand Down Expand Up @@ -179,7 +179,6 @@ def make(self, key):
analysis_file_name=analysis_file_name,
**self.generate_pos_components(
spatial_series=spatial_series,
spatial_df=spatial_df,
position_info=position_info,
analysis_fname=analysis_file_name,
prefix="",
Expand Down

0 comments on commit 9bed1c9

Please sign in to comment.