Advanced hybrid AI-methods for mineral predictive mapping
⚠ Please read all sections carefully to setup your local environment and work with the package. The provided code can run on Windows, Mac and Linux and Docker.
Last update: 06-01-2025
What's new?
- Updated installation routines
- Updated examples
- Full SOM support
- Full BNN support
Ongoing tasks
- Docker integration to USGS
A backup of the older version of the main branch can be found here.
If you build the environment before 06-01-2025, please rebuild with the current updates. If you set-up the environment, please always use the main branch for the initial setup ❗
The repository is structured as following:
├── beak-ta3/
│ └── docs/ # documentations
│ └── ...
│ └── examples # examples how to run selected workflows and prediction methods
│ └── ...
│ └── setup/
│ ├── docker/ # installation routine for Docker
│ ├── unix/ # installation routine fo Linux and MacOS
│ └── win/ # installation routine for Windows
│ └── src/
│ └── beak/
│ ├── data/ # data folder
│ └── ...
│ ├── evaluation/ # module for calculating evaluation metrics
│ ├── experimental/ # former utilities module for first phase events
│ ├── integration/
│ └── statmagic # call functions for integration of SOM and BNN into StatMaGIC
│ ├── methods/ # algorithms for SOM and BNN predictions
│ ├── bnn
│ └── som
│ ├── models # place for model definitions used in first phase
│ └── utilities # helper functions and modules for second phase
All contributing developers/users need git, and a copy of the repository. Clone the repository with:
git clone <https://github.com/DARPA-CRITICALMAAS/beak-ta3.git>
- Install a conda environment on your machine
- Execute the
setup.sh
script located in theunix
orwin
folder, respectively
The Conda environment is called beak-ta3.
Docker is recommended as it containerizes the whole development environment, making sure it stays identical across different developers and operating systems. Using a container also keeps your own computer clean of all dependencies.
- Install Docker
- Execute the
build.sh
script to build the container. The image is calledbeak-ta3:latest
- Execute the
run.sh
script to run the container
Under Windows, either use GIT or the command-line-interface.
For the latter, add bash
as prefix to the script names.
The container will be removed automatically after stopping. To avoid this behaviour, open a terminal and
navigate to the root directory of the cloned repository.
Start the container manually from here with:
docker run -it --name beak-ta3 -p 8888:8888 -v .:/beak-ta3 beak-ta3:latest /bin/bash
The Docker installation uses Poetry and does not have an environment to be activated.
The installation is now ready to be attached to your IDE.
For VSCode
- Start the Docker container
- Start VSCode
- Select the "Attach to running container" option
- Select the beak-ta3 container
For PyCharm
- Start Docker
- Add a new interpreter based on the
beak-ta3:latest
image
Note that your local repository clone gets automatically mounted into the container. This means that:
- The container has a folder that redirects to the local repository called beak-ta3
- The repository in your computer's filesystem and in the container are exactly the same
Local desktop installation
- Activate the environment with
conda activate beak-ta3
- Check the installation by executing
conda list
to see all installed environments.
Docker installation
- Run the container using the provided commands above
- Check the installation with
poetry show
orpoetry run pip list
in the terminal
If the beak package is listed, the installation was successfull. Because the repository behaves as a local python package 🐍, all functions can be accessed like so:
# Import
from beak.module.submodule import function
# Call
function(arguments)
Data 💾 located in the ../src/beak/data
folder can be accessed by:
# Import files module
from importlib.resources import files
# Set Path
file_path = files("beak.data") / "subfolder" / "file_name.ext"
Thanks to MTRI, we can use the repository code like a package.
To install everything from scratch, follow the instructions on the linked page.
We have updated the process by replacing the setup.py
with a pyproject.toml
file, which enables to install the
environment in multiple ways.
The provided installation methods contain the pip install -e .
execution, which is necessary for treating the
code as local package. If you are going to do a complete manual installation, you may need to execute this command
at the very end within your Conda or Docker installation after setting up the environment.
There are some bottlenecks regarding the installation of packages, mainly due to different versions on the repositories, for
- platform (Unix, Windows, Docker) and
- platform architecture (x86, ARM)
Particularly, gdal
and somoclu
packages may raise some issues if installed from PyPi.
These are not part of the pyproject.toml
environment requirements and installed separately from within the dockerfile
.
If possible, stick to one of the Conda installations, which are based on Conda-Forge.
To build the documentation, the sphinx
package is used. It currently works only in Linux/Docker. The provided template builddocs.bash
may not work for everyone directly. The documentation files can be generated by running the builddocs.bash
file from within the top-level folder of the package.
Here is how to solve common command not found
or encoding
issues (Windows, Linux and Mac systems have different file endings that may cause erros when executing scripts in the terminal).
How to solve the Command not found
error:
- Add the path with the
builddocs.bash
file to thePATH
variables: export PATH=$PATH:/beak-ta3/
How to solve the /bin/bash^M: bad interpreter: No such file or directory
error:
- Use a text editor like Notepad++ or even VSCode
- Change the line ending to Unix (LF)
- Save the file
Alternative:
- Set the preferences for new documents to Unix (LF)
- Copy/paste the file content
- Save as another/overwrite the original file