-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
342 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import typer | ||
app = typer.Typer() | ||
|
||
|
||
@app.command() | ||
def edit_experimental( | ||
ctx: typer.Context, | ||
): | ||
try: | ||
from fastapi import FastAPI | ||
from starlette.staticfiles import StaticFiles | ||
import uvicorn | ||
import os | ||
from pathlib import Path | ||
from decolace.processing.project_managment import AcquisitionAreaPreProcessing, process_experimental_conditions | ||
from pydantic import BaseModel | ||
class AcquisitionAreaExperimentalConditions(BaseModel): | ||
area_name: str | ||
experimental_conditions: dict | ||
current_directory = Path(__file__).parent.absolute() | ||
api = FastAPI() | ||
@api.get("/aa") | ||
async def get_aa() -> list[AcquisitionAreaExperimentalConditions]: | ||
experiment_consitions_dicts = process_experimental_conditions(ctx.obj.acquisition_areas) | ||
return [AcquisitionAreaExperimentalConditions(area_name=aa.area_name, experimental_conditions=experiment_consitions_dicts[i]) for i, aa in enumerate(ctx.obj.acquisition_areas)] | ||
api.mount("/", StaticFiles(directory=current_directory/'web_components/acquisition_area_spreadsheet/',html=True), name="static") | ||
|
||
|
||
# serve the ctx.aa object using FastAPI | ||
|
||
|
||
|
||
|
||
|
||
uvicorn.run(api, host="127.0.0.1", port=8000, log_level="info") | ||
except ModuleNotFoundError as e: | ||
print(e) | ||
typer.echo("FastAPI not installed. Please install using 'pip install fastapi'.") | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import typer | ||
from pathlib import Path | ||
from typing import List, Optional | ||
from decolace.processing.project_managment import DLContext | ||
|
||
app = typer.Typer() | ||
|
||
@app.command() | ||
def render_matches_via_blender( | ||
ctx: DLContext, | ||
filter_set_name: str = typer.Argument(..., help="Name of filter set"), | ||
): | ||
""" | ||
Render matches via blender | ||
""" | ||
from decolace.processing.match_visualization import render_aa | ||
|
||
for aa in ctx.obj.project.acquisition_areas: | ||
filename = ctx.obj.project.project_path / "visualization" / "matches" / f"{aa.area_name}_{ctx.obj.match_template_job.run_id}_tm_package_filtered_{filter_set_name}.png" | ||
filename.parent.mkdir(parents=True, exist_ok=True) | ||
render_aa(ctx.obj.project, aa, ctx.obj.match_template_job, filter_set_name, filename) |
Oops, something went wrong.