Skip to content

Commit e444a15

Browse files
committed
cleanup
1 parent 32964ac commit e444a15

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

element_moseq/moseq_report.py

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -90,31 +90,25 @@ def make(self, key):
9090
results_file = (moseq_infer.Inference & key).fetch1(
9191
"syllable_segmentation_file"
9292
)
93-
94-
# Load results from H5 file
9593
results = h5py.File(results_file, "r")
9694

9795
# Generate syllable frequencies plot
9896
fig, _ = plot_syllable_frequencies(results=results, path=inference_output_dir)
9997
fig.savefig(inference_output_dir / "syllable_frequencies.png")
10098
plt.close(fig)
10199

102-
# Get coordinates and config for similarity dendrogram
100+
# Generate similarity dendrogram plots
103101
model_key = (moseq_infer.Model * moseq_train.SelectedFullFit & key).fetch1(
104102
"KEY"
105103
)
106104
coordinates = (moseq_train.PreProcessing & model_key).fetch1("coordinates")
107-
108-
# Get fps from config
109105
config_file = (moseq_train.FullFit.ConfigFile & model_key).fetch1("config_file")
110-
kpms_dj_config = kpms_reader.load_kpms_dj_config(config_path=config_file)
111-
112-
# Generate similarity dendrogram plots
106+
kpms_dj_config_dict = kpms_reader.load_kpms_dj_config(config_path=config_file)
113107
plot_similarity_dendrogram(
114108
coordinates=coordinates,
115109
results=results,
116110
save_path=(inference_output_dir / "similarity_dendrogram").as_posix(),
117-
**kpms_dj_config,
111+
**kpms_dj_config_dict,
118112
)
119113

120114
# Insert the record
@@ -159,22 +153,17 @@ def make(self, key):
159153

160154
start_time = datetime.now(timezone.utc)
161155

162-
# Get inference data
163156
results_file = (moseq_infer.Inference & key).fetch1(
164157
"syllable_segmentation_file"
165158
)
166159
model_dir = (moseq_infer.Model & key).fetch1("model_dir")
167160
inference_output_dir = (moseq_infer.InferenceTask & key).fetch1(
168161
"inference_output_dir"
169162
)
170-
171-
# Get model data from training schema
172163
model_key = (moseq_infer.Model * moseq_train.SelectedFullFit & key).fetch1(
173164
"KEY"
174165
)
175166
coordinates_dict = (moseq_train.PreProcessing & model_key).fetch1("coordinates")
176-
177-
# Get config
178167
kpms_dj_config_file = (moseq_train.FullFit.ConfigFile & model_key).fetch1(
179168
"config_file"
180169
)
@@ -215,7 +204,6 @@ def make(self, key):
215204
# Calculate duration
216205
duration_seconds = (datetime.now(timezone.utc) - start_time).total_seconds()
217206

218-
# Insert main record
219207
self.insert1(
220208
{
221209
**key,
@@ -224,8 +212,6 @@ def make(self, key):
224212
"traj_duration": duration_seconds,
225213
}
226214
)
227-
228-
# Insert per-syllable visuals
229215
for syllable in (moseq_infer.MotionSequence.SampledInstance & key).fetch(
230216
"syllable"
231217
):

0 commit comments

Comments
 (0)