| Project Member | Contact address | Role | Unit |
|---|---|---|---|
| Zeynep AKI | zeynep.aki@dur.ac.uk | Research Software Engineer (RSE) | Advanced Research Computing |
| Prof. Sarah SEMPLE | s.j.semple@durham.ac.uk | Professor in the Department of Archaeology | Department of Archaeology |
| Dr. Tudor SKINNER | alexis.t.skinner@durham.ac.uk | Lecturer in the Department of Archaeology | Department of Archaeology |
- Python installed on your machine. Download and install Python from python.org.
-
You can create a Virtual Environment for your code using:
python -m venv venv -
After you create your VENV, you can activate it by using:
source venv/Scripts/activate #On Windowssource venv/bin/activate #On MacOS & Linux -
Once you finish setting up your VENV, you can install the libraries used into your VENV using python's
pip.pip install -r requirements.txt -
If you already have a 'conda' environment you can run this for a quick set up:
conda create --name CASSS conda activate CASSS conda install pip pip install -r requirements.txt
This script processes Excel files, condenses the data, and generates merged data in CSV format.
-
Open a terminal or command prompt.
-
Navigate to the directory containing the
condenser.pyscript.cd path/to/pre-preparation -
Run the script with optional command-line arguments:
python condenser.py --excel_path path/to/excel/files/*.xlsx --output_path path/to/output/merged_data.csv --with_images--excel_path: Path to Excel files. Default:dataset/unformatted/spreadsheets/*.xlsx--output_path: Path to the output CSV file. Default:dataset/formatted/merged_data.csv--with_images: Include images in the output (optional).
The --with_images flag is an optional command-line argument in the condenser.py script. This flag controls whether
the script includes images in the generated output or not. Below are the details of how the script behaves based on the
presence or absence of this flag:
- The script includes rows in the output CSV file where the 'image-id' column contains the substring 'images/wee/'.
- A new column named 'cleaned_id' is added, containing the cleaned IDs extracted from the 'image-id' column.
-
The script includes rows in the output CSV file where the 'image-id' column contains the substring ' images/no-image2.jpg'.
-
No 'cleaned_id' column is added in this case, as it is specific to rows with images.
If you are using Python 3, replace
pythonwithpython3in the command.
-
Press Enter to execute the command.
-
Check the specified output path for the generated CSV file.
-
Run the script with default settings:
python condenser.py
-
Run the script with custom paths and include images:
python condenser.py --excel_path custom/path/to/excel/files/*.xlsx --output_path custom/path/to/output/merged_data.csv --with_images
This script processes Excel files, cleans and standardizes tags, and formats the data into a new CSV file.
-
Open a terminal or command prompt.
-
Navigate to the directory containing the
reformatter.pyscript, which by default is the same as yourcondenser.pyscript. You don't need to re-establish your path if you're already there.cd path/to/reformatter -
Run the script with optional command-line arguments:
python reformatter.py --excel_path path/to/excel/files/*.xlsx --output_path path/to/output/reformatted_data.csv --training_data--excel_path: Path to Excel files. Default:dataset/unformatted/spreadsheets/*.xlsx--output_path: Path to the output CSV file. Default:dataset/formatted/reformatted_data.csv--training_data: Generate training data (optional).
-
Press Enter to execute the command.
-
Check the specified output path for the reformatted CSV file.
-
Run the script with default settings:
python reformatter.py
-
Run the script with custom paths and generate training data:
python reformatter.py --excel_path custom/path/to/excel/files/*.xlsx --output_path custom/path/to/output/reformatted_data.csv --training_data
This script converts images from a specified input folder to PNG format and saves them in a designated output folder.
-
Open a terminal or command prompt.
-
Navigate to the directory containing the
image_converter.pyscript. again, if you've runcondenser.pyand/orreformatter.pyyou should already be in the right directory by default.cd path/to/image_converter -
Run the script with optional command-line arguments:
python image_converter.py --input_folder path/to/input/images --output_folder path/to/output/images
--input_folder: Path to the input folder containing images. Default:dataset/unformatted/images--output_folder: Path to the output folder where converted images will be saved. Default:dataset/formatted/images
-
Press Enter to execute the command.
-
Check the specified output path for the converted images.
-
Run the script with default settings:
python image_converter.py
-
Run the script with custom paths:
python image_converter.py --input_folder custom/path/to/input/images --output_folder custom/path/to/output/images
- To avoid crashes, ensure that the input folder contains images in a supported format (e.g., JPEG, PNG) which in this case was mostly TIF.
- The code may crash if an image is corrupted or is an unsupported file. If this happens, check your terminal to see
which image the code crashed on, take note of the image, delete it and temporarily remove the directories that the
code has already successfully finished running from the
dataset/unformatted/imagesdirectory by default or the directory you have yourImages_Vol_N. - For example, If the code has successfully finished converting images in
Images_Vol_1,Images_Vol_2andImages_Vol_3and crashed while trying to convert4_010.tifinImages_Vol_4, take note of4_010.tif, then temporarily remove foldersImages_Vol_1,Images_Vol_2andImages_Vol_3from the directory you're running the code in, and re-run the code.
- If no command-line arguments are provided, the script will use default paths.
- Ensure that all your files are in specified format before you run the code.
- Once you're done preparing your data, you can go back to the main project directory using:
cd ..