-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Elizabeth/try local install #10
base: main
Are you sure you want to change the base?
Changes from all commits
0846390
5325732
a3df74e
9aaa6ce
64e98fa
4404211
62319e6
64f67db
3f2f95c
3f36738
bea3e58
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -2,17 +2,27 @@ | |||||||||
|
||||||||||
## Installation | ||||||||||
|
||||||||||
1. Create `./.env` in this directory (see `.env.example`). | ||||||||||
2. Edit `./.env` with an appropriate database file location. | ||||||||||
3. Create `$HOME/.bloom/desktop-config.yaml` (see `desktop-config.yaml.example`). | ||||||||||
4. Edit `$HOME/.bloom/desktop-config.yaml` with the correct database file location and other values. | ||||||||||
5. Run `npm install`. | ||||||||||
6. Run `npm run client:generate` to generate Typescript client for the new schema. | ||||||||||
7. Run `npm run db:deploy` to create the database. | ||||||||||
1. `mamba activate bloom-desktop` | ||||||||||
2. Follow the instructions in (bloom)[https://gitlab.com/salk-tm/bloom/-/tree/main?ref_type=heads] to setup a local supabase instance to interact with, and add some test data. | ||||||||||
Comment on lines
+5
to
+6
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix link formatting and grammar in Supabase setup instruction. The new steps are helpful, but there are two issues to address:
Please apply the following changes: -2. Follow the instructions in (bloom)[https://gitlab.com/salk-tm/bloom/-/tree/main?ref_type=heads] to setup a local supabase instance to interact with, and add some test data.
+2. Follow the instructions in [bloom](https://gitlab.com/salk-tm/bloom/-/tree/main?ref_type=heads) to set up a local Supabase instance to interact with, and add some test data. 📝 Committable suggestion
Suggested change
🧰 Tools🪛 LanguageTool
🪛 Markdownlint
|
||||||||||
3. Create `./.env` in this directory (see `.env.example`). | ||||||||||
4. Edit `./.env` with an appropriate database file location. | ||||||||||
5. Create `$HOME/.bloom/desktop-config.yaml` (see `desktop-config.yaml.example`). | ||||||||||
- References test images located at `test\sample_scan`. | ||||||||||
- Use the same environment variables as in https://gitlab.com/salk-tm/bloom/-/blob/main/web/env.dev to configure bloom-desktop to work with your local supabase instance. | ||||||||||
6. Edit `$HOME/.bloom/desktop-config.yaml` with the correct database file location and other values. | ||||||||||
7. Run `npm install`. | ||||||||||
- Make sure you are in `app` directory. | ||||||||||
- Build tools required for this step: | ||||||||||
- https://visualstudio.microsoft.com/ C++ for Desktop Development on Windows | ||||||||||
- XCode for Mac | ||||||||||
- `build-essential` for Linux | ||||||||||
- Use `npm cache clean` to cleanup | ||||||||||
8. Run `npm run client:generate` to generate Typescript client for the new schema (`app\prisma\schema.prisma`) | ||||||||||
9. Run `npm run db:deploy` to create the database and apply the migrations. | ||||||||||
|
||||||||||
## Quickstart | ||||||||||
|
||||||||||
Run `npm run start`. | ||||||||||
Run `npm run start` from `app` directory. | ||||||||||
|
||||||||||
## Modifying the database | ||||||||||
|
||||||||||
|
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -6,6 +6,7 @@ | |||||||
import sys | ||||||||
import time | ||||||||
import pathlib | ||||||||
import logging | ||||||||
|
||||||||
import base64 | ||||||||
from io import BytesIO | ||||||||
|
@@ -14,12 +15,18 @@ | |||||||
|
||||||||
import imageio.v2 as iio | ||||||||
|
||||||||
sample_scan = "/Users/djbutler/dev/bloom-desktop-pilot/test/sample_scan" | ||||||||
logging.basicConfig(level=logging.INFO) | ||||||||
|
||||||||
# Test images are in "test/sample_scan" directory from the root of the repo | ||||||||
sample_scan = pathlib.Path(__file__).parent.parent / "test" / "sample_scan" | ||||||||
logging.info(f"sample_scan: {sample_scan}") | ||||||||
|
||||||||
|
||||||||
|
||||||||
def stream_frames(camera_settings): | ||||||||
n = camera_settings["num_frames"] | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove unused variable 'n'. The local variable 'n' is assigned but never used in the function. This was detected by the static analysis tool. Consider removing the unused variable: def stream_frames(camera_settings):
- n = camera_settings["num_frames"]
src_frames = glob.glob(os.path.join(sample_scan, "*.png")) If the 📝 Committable suggestion
Suggested change
🧰 Tools🪛 Ruff
|
||||||||
src_frames = glob.glob(os.path.join(sample_scan, "*.png")) | ||||||||
logging.debug(f"Found {len(src_frames)} frames.") | ||||||||
src_frames.sort(key=lambda x: int(os.path.basename(x).split(".")[0])) | ||||||||
i = 0 | ||||||||
while True: | ||||||||
|
@@ -29,6 +36,7 @@ def stream_frames(camera_settings): | |||||||
# time the function call | ||||||||
start = time.time() | ||||||||
img = iio.imread(src_frame) | ||||||||
logging.debug(f"Read {src_frame}.") | ||||||||
end = time.time() | ||||||||
# print(f"iio.imread took {end - start} seconds", file=sys.stderr) | ||||||||
# time the function call | ||||||||
|
@@ -41,11 +49,17 @@ def stream_frames(camera_settings): | |||||||
|
||||||||
|
||||||||
def img_to_base64(img): | ||||||||
buffer = BytesIO() | ||||||||
pil_img = Image.fromarray(img) | ||||||||
pil_img.save(buffer, format="PNG", compress_level=0) | ||||||||
# iio.imwrite(buffer, img, ".png") | ||||||||
base64_img = base64.b64encode(buffer.getvalue()).decode("utf-8") | ||||||||
if img is None or img.size == 0: | ||||||||
logging.error("Invalid image encountered!") | ||||||||
return "" | ||||||||
|
||||||||
with BytesIO() as buffer: | ||||||||
with Image.fromarray(img) as pil_img: | ||||||||
logging.debug(f"{pil_img} opened.") | ||||||||
pil_img.save(buffer, format="PNG", compress_level=0) | ||||||||
logging.debug(f"{pil_img} saved to buffer.") | ||||||||
base64_img = base64.b64encode(buffer.getvalue()).decode("utf-8") | ||||||||
logging.debug(f"base64_img: {base64_img[:100]}") | ||||||||
return base64_img | ||||||||
|
||||||||
|
||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Clarify the change in installation method
The updated instruction simplifies the setup process by focusing solely on pip requirements, which aligns with the PR objectives regarding
nidaqmx
installation issues. However, it might be beneficial to provide more context for this change.Consider adding a brief explanation:
3. Install pip requirements: `pip install -r requirements.txt` + Note: We now use pip to install all requirements, including `nidaqmx`, due to issues with the conda version.
This addition would help future contributors understand the reasoning behind the installation method change.