diff --git a/Dockerfile b/Dockerfile index 681677b..6b8b1a5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,5 @@ FROM python:3.12 -ENV AS_HDF5_MASTER_FILE=/share_data/datasets_full/minimalInsulinMX1/030/testcrystal_0014_master.h5 ENV POETRY_VERSION=1.8.3 # Install OS packages @@ -12,7 +11,7 @@ RUN useradd -ms /bin/bash asuser WORKDIR /home/asuser/ # Setup Poetry environment -COPY pyproject.toml poetry.lock /home/asuser/ +COPY pyproject.toml poetry.lock README.md /home/asuser/ RUN pip install "poetry==$POETRY_VERSION" RUN poetry config virtualenvs.create false RUN poetry install diff --git a/README.md b/README.md index 029cad2..5e628a8 100644 --- a/README.md +++ b/README.md @@ -32,12 +32,16 @@ Follow these steps to run the simulated SIMPLON API and ensure its proper functi ``` For other operating systems, Install the equivalent libraries for `gcc` and `libhdf5-serial-dev`. -2. **Set the HDF5 File Path** +2. **(Optional) Set the HDF5 File Path** - Before running the API, set the `AS_HDF5_MASTER_FILE` environment variable using the following command: + The master file used by simplon API can be specified via the `AS_HDF5_MASTER_FILE` environment variable: ```bash export HDF5_MASTER_FILE=/path/to/HDF5_master_file ``` + If ``AS_HDF5_MASTER_FILE`` is not specified, the default master file included in this repo is used (`example_1_master.h5`) + + Additionally, the master file can also be set dynamically during runtime using the ANSTO endpoints: + `/ansto_endpoints/hdf5_master_file` (see the swagger documentation for more information) 3. **Run the FAST-API application** ```bash @@ -68,4 +72,4 @@ After running this script, you should see messages being received by the `receiv [Stream V2]: https://github.com/dectris/documentation/tree/main/stream_v2 ## Documentation -You can see the endpoints currently implemented by accessing the interactive API documentation at [http://localhost:8000/docs](http://localhost:8000/docs). Ensure that the simulated SIMPLON API is up and running to access the documentation. +You can see the endpoints currently implemented by accessing the interactive API documentation at [http://localhost:8000/swagger](http://localhost:8000/swagger). Ensure that the simulated SIMPLON API is up and running to access the documentation. diff --git a/ansto_simplon_api/config.py b/ansto_simplon_api/config.py index 79afffa..9f454c0 100644 --- a/ansto_simplon_api/config.py +++ b/ansto_simplon_api/config.py @@ -56,6 +56,9 @@ class ZMQStreamSettings(BaseSettings): GetPydanticSchema(lambda _, _h: _h.generate_schema(FilePath)), ] = Field( title="HDF5 Master File", + default=os_realpath( + os_joinpath(CUR_DIR, "master_file_examples", "example_1_master.h5") + ), ) DELAY_BETWEEN_FRAMES: float = Field( title="Delay Between Frames", diff --git a/ansto_simplon_api/master_file_examples/example_1_data_000001.h5 b/ansto_simplon_api/master_file_examples/example_1_data_000001.h5 new file mode 100644 index 0000000..e9c6087 Binary files /dev/null and b/ansto_simplon_api/master_file_examples/example_1_data_000001.h5 differ diff --git a/ansto_simplon_api/master_file_examples/example_1_master.h5 b/ansto_simplon_api/master_file_examples/example_1_master.h5 new file mode 100644 index 0000000..e1b4e90 Binary files /dev/null and b/ansto_simplon_api/master_file_examples/example_1_master.h5 differ diff --git a/docker-compose.yml b/docker-compose.yml index f0fbdd0..65cca05 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,7 +13,9 @@ services: - "AS_ZMQ_ADDRESS=tcp://*:5555" #To access the masterfile, you can either copy it to the container by modifying # the dockerfile, or you can mount a volume containing the masterfile. - - "AS_HDF5_MASTER_FILE=/path/to/HDF5_master_file" + # If the AS_HDF5_MASTER_FILE is not specified, the default mastef file included + # in this repos is used (example_1_master.h5) + #- "AS_HDF5_MASTER_FILE=/path/to/HDF5_master_file" - "AS_DELAY_BETWEEN_FRAMES=0.0" # seconds - "AS_NUMBER_OF_DATA_FILES=1" # 2 seems to be the maximum number of files we can load into memory (16M data) - "AS_NUMBER_OF_FRAMES_PER_TRIGGER=30" diff --git a/pyproject.toml b/pyproject.toml index 88b3064..a48ffb9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "ansto-simplon-api" -version = "0.3.0" +version = "0.3.1" description = "Simulated simplon api" authors = [ "Francisco Hernandez Vivanco ",