Code Monkey home page Code Monkey logo

ptyweb's Introduction

PtyWeb - a web based viewer for ptychography

Overview

PtyWeb is a collection of tools for visualizing ptychography data. It is made up of three parts:

  • @ptyweb/lib - a set of components (most of which are built on top of @h5web/lib) for visualizing ptychography data. This is a standalone package so that it can be used in any React app.
  • @ptyweb/app - a React app that uses the components from @ptyweb/lib to provide a web-based viewer for PtyPy ptychography data.
  • @ptyweb/backend - a Python package coded using FastAPI that provides a REST API for fetching data from PtyPy. This is used by @ptyweb/app to fetch data.

We are using pnpm instead of vanilla npm to manage the dependencies of this project. This is because we encountered this issue when using npm.

Installation

There are 2 installation methods, however the steps below are required for both.

  1. Clone the repository:
git clone https://github.com/ptycho/ptyweb.git

You now have some options on how to install the PtyWeb backend

  1. Installing the frontend dependencies:
cd ptyweb/packages/app/frontend
pnpm install

Installing @ptyweb/lib (for @ptyweb/lib development only)

The following steps are only required if you want to develop the @ptyweb/lib package. You can skip these steps if you only want to use the PtyWeb frontend (@ptyweb/app).

cd ptyweb/packages/lib
pnpm install

Installing PtyWeb backend into the PtyPy environment (recommended)

To complete these steps, please ensure that you have installed PtyPy and created an environment for it (see PtyPy's installation instructions)

  1. Activate the PtyPy environment (see PtyPy's installation instructions)
  2. Install the PtyWeb backend into the PtyPy environment:
cd ptyweb/packages/app/backend
conda env update --name your_ptypy_env --file environment.yml
  1. You should now be good to go ๐ŸŽ‰, try following the Usage instructions below.

Installing PtyWeb backend into a separate environment (development)

  1. Create new environment and install dependencies:
cd ptyweb/packages/app/backend
conda env create -f environment.yml
conda activate ptyweb
  1. Install PtyPy and its dependencies into the ptyweb environment (see PtyPy's installation instructions)

When installing PtyPy, make sure to install the conda dependencies into the ptyweb environment, instead of creating a new environment

Example:

cd ptypy
conda activate ptyweb # If not already activated
conda env update --name ptyweb --file your_ptypy_env.yml
pip install .
  1. You should now be good to go ๐ŸŽ‰, try following the Usage instructions below.

Building

Building @ptyweb/lib (for @ptyweb/lib development only)

The following steps are only required if you want to develop the @ptyweb/lib package. You can skip these steps if you only want to use the PtyWeb frontend (@ptyweb/app).

Once you are happy with your changes and want to test them in @ptyweb/app, you will need to build the @ptyweb/lib package:

cd ptyweb/packages/lib
pnpm run build
pnpm pack
mv <package_name>.tgz release

Now we have packaged our build, we can install it into @ptyweb/app

cd ptyweb/packages/app/frontend
pnpm uninstall @ptyweb/lib
cp ../../lib/release/<package_name>.tgz lib/
pnpm lib/<package_name>.tgz

Usage

Frontend

  1. Start the development server:
cd ptyweb/packages/app/frontend
pnpm run start
  1. Open the app in your browser at http://localhost:3000.

Backend

  1. Make sure that the correct environment is activated (see Installation)
  2. Start the development server:
cd ptyweb/packages/app/backend
uvicorn app:app --reload

ptyweb's People

Contributors

daurer avatar thomas-milburn avatar

Watchers

Aaron Parsons avatar  avatar  avatar Pierre Thibault avatar Bjoern Enders avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.