Skip to content

Commit

Permalink
updated and cleaned codebase. minor bump to reflect these changes
Browse files Browse the repository at this point in the history
  • Loading branch information
JLSteenwyk committed Oct 24, 2023
1 parent 5cd45ac commit e9c1595
Show file tree
Hide file tree
Showing 49 changed files with 829 additions and 1,027 deletions.
9 changes: 5 additions & 4 deletions phykit/helpers/boolean_argument_parsing.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import argparse


def str2bool(v):
if isinstance(v, bool):
return v
if v.lower() in ('true', 't', '1'):
return v
if v.lower() in ("true", "t", "1"):
return True
elif v.lower() in ('false', 'f', '0'):
elif v.lower() in ("false", "f", "0"):
return False
else:
raise argparse.ArgumentTypeError('Boolean value expected.')
raise argparse.ArgumentTypeError("Boolean value expected.")
4 changes: 2 additions & 2 deletions phykit/helpers/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ def get_alignment_and_format(alignment_file_path: str):
print("Please check file name and pathing")
sys.exit()


def read_single_column_file_to_list(single_col_file_path: str) -> list:
try:
with open(single_col_file_path) as f:
return [line.rstrip('\n').strip() for line in f]
return [line.rstrip("\n").strip() for line in f]
except FileNotFoundError:
print(f"{single_col_file_path} corresponds to no such file or directory.")
print("Please check file name and pathing")
sys.exit()

35 changes: 15 additions & 20 deletions phykit/helpers/stats_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,25 @@
import numpy as np


def calculate_summary_statistics_from_arr(
arr
):
def calculate_summary_statistics_from_arr(arr):
"""
calcuate summary statistics for an input list
"""
stats = dict(
mean = stat.mean(arr),
median = stat.median(arr),
twenty_fifth = np.percentile(arr, 25),
seventy_fifth = np.percentile(arr, 75),
minimum = np.min(arr),
maximum = np.max(arr),
standard_deviation = stat.stdev(arr),
variance = stat.variance(arr)
mean=stat.mean(arr),
median=stat.median(arr),
twenty_fifth=np.percentile(arr, 25),
seventy_fifth=np.percentile(arr, 75),
minimum=np.min(arr),
maximum=np.max(arr),
standard_deviation=stat.stdev(arr),
variance=stat.variance(arr),
)

return stats

def calculate_summary_statistics_from_dict(
dat: dict
):

def calculate_summary_statistics_from_dict(dat: dict):
"""
calcuate summary statistics for a dictionary
"""
Expand All @@ -36,16 +33,14 @@ def calculate_summary_statistics_from_dict(
minimum=np.min([*dat.values()]),
maximum=np.max([*dat.values()]),
standard_deviation=stat.stdev([*dat.values()]),
variance=stat.variance([*dat.values()])
variance=stat.variance([*dat.values()]),
)

return stats

def print_summary_statistics(
stats: list
):
"""
"""

def print_summary_statistics(stats: list):
""" """
try:
print(f"mean: {round(stats['mean'], 4)}")
print(f"median: {round(stats['median'], 4)}")
Expand Down
Loading

0 comments on commit e9c1595

Please sign in to comment.