Skip to content

Commit 8f7a701

Browse files
authored
Merge pull request #39 from brain-image-library/11-new-metric-request
Update get.py
2 parents 0f82b4f + 75e52cd commit 8f7a701

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

braininventory/get.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,49 @@
2323
import matplotlib.pyplot as plt
2424
import squarify
2525

26+
def __get_md5_coverage(df):
27+
"""
28+
Calculate the average MD5256 coverage from a DataFrame.
29+
30+
Parameters:
31+
df (pandas.DataFrame): The DataFrame containing the 'md5_coverage' column.
32+
33+
Returns:
34+
float: The average MD5 coverage.
35+
36+
Raises:
37+
KeyError: If the 'sha256_coverage' column is not present in the DataFrame.
38+
39+
Example:
40+
>>> data = {'md5_coverage': [0.75, 0.82, 0.91, 0.68, 0.79]}
41+
>>> df = pd.DataFrame(data)
42+
>>> __get_md5_coverage(df)
43+
0.79
44+
"""
45+
average = df['md5_coverage'].mean()
46+
return average
47+
48+
def __get_sha256_coverage(df):
49+
"""
50+
Calculate the average SHA256 coverage from a DataFrame.
51+
52+
Parameters:
53+
df (pandas.DataFrame): The DataFrame containing the 'sha256_coverage' column.
54+
55+
Returns:
56+
float: The average SHA256 coverage.
57+
58+
Raises:
59+
KeyError: If the 'sha256_coverage' column is not present in the DataFrame.
60+
61+
Example:
62+
>>> data = {'sha256_coverage': [0.75, 0.82, 0.91, 0.68, 0.79]}
63+
>>> df = pd.DataFrame(data)
64+
>>> __get_sha256_coverage(df)
65+
0.79
66+
"""
67+
average = df['sha256_coverage'].mean()
68+
return average
2669

2770
def __create_general_modality_plot(df):
2871
"""

0 commit comments

Comments
 (0)