Skip to content

Commit 50455de

Browse files
committed
don't normalize locations
1 parent fe3d844 commit 50455de

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

1.generate-profiles/2.normalize.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ def handle_excepthook(exc_type, exc_value, exc_traceback):
112112
normalize_output_files[data_level].parents[0],
113113
output_file.name.replace(".csv.gz", f"_{data_split_site}.csv.gz"),
114114
)
115+
115116
if os.path.exists(output_file):
116117
if force:
117118
print(f"Force overwriting {output_file}")
@@ -124,9 +125,16 @@ def handle_excepthook(exc_type, exc_value, exc_traceback):
124125
)
125126
df = read_csvs_with_chunksize(file_to_normalize)
126127

128+
# Don't normalize locations
129+
meta_cols=list(df.columns[df.columns.str.contains("Metadata")])
130+
remove_locs = list(filter(lambda x: "_Location_Center_X" in x or "_Location_Center_Y" in x , df.columns))
131+
remove_cents = list(filter(lambda x: "AreaShape_Center_X" in x or "AreaShape_Center_Y" in x , df.columns))
132+
meta_cols = meta_cols + remove_locs + remove_cents
133+
127134
normalize(
128135
profiles=df,
129136
features=normalize_these_features,
137+
meta_features=meta_cols,
130138
samples=normalize_by_samples,
131139
method=normalize_method,
132140
output_file=output_file,
@@ -142,9 +150,16 @@ def handle_excepthook(exc_type, exc_value, exc_traceback):
142150
)
143151
df = read_csvs_with_chunksize(file_to_normalize)
144152

153+
# Don't normalize locations
154+
meta_cols=list(df.columns[df.columns.str.contains("Metadata")])
155+
remove_locs = list(filter(lambda x: "_Location_Center_X" in x or "_Location_Center_Y" in x , df.columns))
156+
remove_cents = list(filter(lambda x: "AreaShape_Center_X" in x or "AreaShape_Center_Y" in x , df.columns))
157+
meta_cols = meta_cols + remove_locs + remove_cents
158+
145159
normalize(
146160
profiles=df,
147161
features=normalize_these_features,
162+
meta_features=meta_cols,
148163
samples=normalize_by_samples,
149164
method=normalize_method,
150165
output_file=output_file,

0 commit comments

Comments
 (0)