Skip to content

Commit

Permalink
don't normalize locations
Browse files Browse the repository at this point in the history
  • Loading branch information
ErinWeisbart committed Feb 22, 2022
1 parent fe3d844 commit 50455de
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions 1.generate-profiles/2.normalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ def handle_excepthook(exc_type, exc_value, exc_traceback):
normalize_output_files[data_level].parents[0],
output_file.name.replace(".csv.gz", f"_{data_split_site}.csv.gz"),
)

if os.path.exists(output_file):
if force:
print(f"Force overwriting {output_file}")
Expand All @@ -124,9 +125,16 @@ def handle_excepthook(exc_type, exc_value, exc_traceback):
)
df = read_csvs_with_chunksize(file_to_normalize)

# Don't normalize locations
meta_cols=list(df.columns[df.columns.str.contains("Metadata")])
remove_locs = list(filter(lambda x: "_Location_Center_X" in x or "_Location_Center_Y" in x , df.columns))
remove_cents = list(filter(lambda x: "AreaShape_Center_X" in x or "AreaShape_Center_Y" in x , df.columns))
meta_cols = meta_cols + remove_locs + remove_cents

normalize(
profiles=df,
features=normalize_these_features,
meta_features=meta_cols,
samples=normalize_by_samples,
method=normalize_method,
output_file=output_file,
Expand All @@ -142,9 +150,16 @@ def handle_excepthook(exc_type, exc_value, exc_traceback):
)
df = read_csvs_with_chunksize(file_to_normalize)

# Don't normalize locations
meta_cols=list(df.columns[df.columns.str.contains("Metadata")])
remove_locs = list(filter(lambda x: "_Location_Center_X" in x or "_Location_Center_Y" in x , df.columns))
remove_cents = list(filter(lambda x: "AreaShape_Center_X" in x or "AreaShape_Center_Y" in x , df.columns))
meta_cols = meta_cols + remove_locs + remove_cents

normalize(
profiles=df,
features=normalize_these_features,
meta_features=meta_cols,
samples=normalize_by_samples,
method=normalize_method,
output_file=output_file,
Expand Down

0 comments on commit 50455de

Please sign in to comment.