KashyapiNagaHarshitha commited on
Commit
ed7655b
·
verified ·
1 Parent(s): 7b40883

Update Background_Substraction.py

Browse files
Files changed (1) hide show
  1. Background_Substraction.py +1 -63
Background_Substraction.py CHANGED
@@ -51,7 +51,7 @@ warnings.filterwarnings('ignore', category= UserWarning)
51
  #set_name = 'Set_A'
52
  #set_name = 'test'
53
 
54
- '''
55
  present_dir = os.path.dirname(os.path.realpath(__file__))
56
 
57
  input_path = os.path.join(present_dir, 'wetransfer_data-zip_2024-05-17_1431')
@@ -138,68 +138,6 @@ compare_headers(exp_cols, metadata.columns.values, "Marker metadata file")
138
  metadata = metadata.dropna()
139
  metadata.head()
140
 
141
- '''
142
- import os
143
-
144
- # Get the current script directory
145
- present_dir = os.path.dirname(os.path.realpath(__file__))
146
-
147
- # Define the input path
148
- input_path = os.path.join(present_dir, 'wetransfer_data-zip_2024-05-17_1431')
149
- base_dir = input_path
150
- set_path = 'test'
151
- selected_metadata_files = ['Slide_B_DD1s1.one_1.tif.csv', 'Slide_B_DD1s1.one_2.tif.csv']
152
- ls_samples = ['Ashlar_Exposure_Time.csv', 'new_data.csv', 'DD3S1.csv', 'DD3S2.csv', 'DD3S3.csv', 'TMA.csv']
153
-
154
- set_name = set_path
155
-
156
- # Project and step names
157
- project_name = set_name # Project name
158
- step_suffix = 'bs' # Current part (here part II)
159
- previous_step_suffix_long = "_qc_eda" # Previous part (here QC/EDA NOTEBOOK)
160
-
161
- # Initial input data directory
162
- input_data_dir = os.path.join(base_dir, project_name + previous_step_suffix_long)
163
-
164
- # Define writable directory
165
- writable_directory = '/tmp'
166
-
167
- # BS output directories redirected to writable directory
168
- output_data_dir = os.path.join(writable_directory, project_name + "_" + step_suffix)
169
- # BS images subdirectory redirected to writable directory
170
- output_images_dir = os.path.join(output_data_dir, "images")
171
-
172
- # Metadata directories
173
- metadata_dir = os.path.join(base_dir, project_name + "_metadata")
174
- # images subdirectory
175
- metadata_images_dir = os.path.join(metadata_dir, "images")
176
-
177
- # Ensure the output directories exist
178
- os.makedirs(output_data_dir, exist_ok=True)
179
- os.makedirs(output_images_dir, exist_ok=True)
180
-
181
- # Print paths to verify
182
- print("Input Data Directory:", input_data_dir)
183
- print("Output Data Directory:", output_data_dir)
184
- print("Output Images Directory:", output_images_dir)
185
- print("Metadata Directory:", metadata_dir)
186
- print("Metadata Images Directory:", metadata_images_dir)
187
-
188
- # Example of writing a file to the new output directory
189
- example_data = {'Column1': [1, 2, 3], 'Column2': ['A', 'B', 'C']}
190
- example_df = pd.DataFrame(example_data)
191
-
192
- output_file_path = os.path.join(output_data_dir, 'example_output.csv')
193
-
194
- try:
195
- example_df.to_csv(output_file_path, index=False)
196
- print(f"Output written successfully to {output_file_path}")
197
- except PermissionError as e:
198
- print(f"Permission denied: Unable to write the file at {output_file_path}. Error: {e}")
199
- except Exception as e:
200
- print(f"An error occurred: {e}")
201
-
202
-
203
  # ### II.3.2. NOT_INTENSITIES
204
 
205
  # In[10]:
 
51
  #set_name = 'Set_A'
52
  #set_name = 'test'
53
 
54
+
55
  present_dir = os.path.dirname(os.path.realpath(__file__))
56
 
57
  input_path = os.path.join(present_dir, 'wetransfer_data-zip_2024-05-17_1431')
 
138
  metadata = metadata.dropna()
139
  metadata.head()
140
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
  # ### II.3.2. NOT_INTENSITIES
142
 
143
  # In[10]: