Skip to content
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

change size of hits in local phoenix event display #677

Open
davzuliani opened this issue Aug 29, 2024 · 9 comments
Open

change size of hits in local phoenix event display #677

davzuliani opened this issue Aug 29, 2024 · 9 comments

Comments

@davzuliani
Copy link

I have managed to create an event-display locally.
Now, I would like to play with physics objects, particularly creating new classes to handle physics collection.

But first, I would like to play with already existing physics collections, particularly with hits. I'm loading a edm4hep.json event data file, using the import option, but I would like to change the size of the points. How to do so?

Also, let's say that I want to include some modification in the phoenix loader, how should I do to re-build the applications?

Apologies in advance for the naive questions and thanks for your help!

@EdwardMoyse
Copy link
Collaborator

Hi - I'm not sure I completely understand your question. What do you mean by you "created an event-display locally"? Did you check out phoenix and want to modify it? If so, maybe this guide will help:
https://github.com/HSF/phoenix/blob/main/guides/developers/event-data-loader.md

If you have build a new angular app which uses phoenix, and you want to use a locally modified version of phoenix, then you can modify your package.json to point to the local version e.g.

    "phoenix-event-display": "../path/to/phoenix",

instead of the release version number.

@davzuliani
Copy link
Author

davzuliani commented Aug 29, 2024

I managed to create an Angular app using this guide: https://github.com/HSF/phoenix/blob/main/guides/developers/set-up-phoenix.md.

If I understood correctly, I'm simply checking out phoenix by doing npm install phoenix-event-display.
So does this mean that I have to build a local modified version and point to that one?

@EdwardMoyse
Copy link
Collaborator

EdwardMoyse commented Aug 29, 2024 via email

@davzuliani
Copy link
Author

Ok, I might need a few details here (just to be sure that I' m doing things right).

  1. I checked out out Phoenix
  2. I changed the hits size in the edm4hep-json-loader.ts file and then I installed phoenix by doing
yarn install
  1. Then, inside my app I changed package.json by putting
"phoenix-event-display": "/home/dav.zuliani/Desktop/software/phoenix/phoenix"

Here I have a question: does it have to point to phoenix folder, or to a specific folder/file?
4. I run my app by doing npm start

So far, I get some errors like

✘ [ERROR] TS2307: Cannot find module 'phoenix-event-display' or its corresponding type declarations. [plugin angular-compiler]

    src/app/main-display/main-display.component.ts:3:91:
      3 │ ...w, ClippingSetting, PhoenixMenuNode } from 'phoenix-event-display';
         ╵                                               ~~~~~~~~~~~~~~~~~~~~~~~

when launching the app.

@davzuliani
Copy link
Author

davzuliani commented Aug 29, 2024

A small update: I changed the path to point to (sounded more reasonable to me)

"phoenix-event-display": "/home/dav.zuliani/Desktop/software/phoenix/phoenix/packages/phoenix-event-display",

Now, when launching npm start is complaining about

Watch mode enabled. Watching for file changes...
  ➜  Local:   http://localhost:4200/
  ➜  press h + enter to show help
✘ [ERROR] Could not resolve "jszip"

    node_modules/phoenix-ui-components/dist/fesm2022/phoenix-ui-components.mjs:40:18:
      40 │ import JSZip from 'jszip';
         ╵                   ~~~~~~~

  You can mark the path "jszip" as external to exclude it from the bundle, which will remove this
  error and leave the unresolved path in the bundle.

@EdwardMoyse
Copy link
Collaborator

Hmm. Let me ping @9inpachi here - he is the expert.

@9inpachi
Copy link
Collaborator

Hey @davzuliani, have you built the local phoenix-event-display that you have? As you mentioned in your last comment, it indeed needs to be the full path to the workspace package of phoenix-event-display (/home/dav.zuliani/Desktop/software/phoenix/phoenix/packages/phoenix-event-display in your case).

You need to build Phoenix at that path as it doesn't automatically happen.

cd /home/dav.zuliani/Desktop/software/phoenix/phoenix/packages/phoenix-event-display
npm start
# or fully build the package but it won't support hot-reloading.
npm build

And once you have done that, you can start your Angular app and it should work. Make sure you do an npm install after updating the phoenix-event-display to use the local path to make sure that the lock file is updated to use the local version and not the one from node_modules.

@davzuliani
Copy link
Author

Hi @9inpachi, and thanks for the explanation.
So, this is what I did:

  1. I rebuilt Phoenix in /home/dav.zuliani/Desktop/software/phoenix/phoenix/packages/phoenix-event-display by doing npm start (apparently npm build is not working)
  2. I went to my angular app and changed the path in package.json
  "dependencies": {
    "@angular/animations": "^17.3.0",
    "@angular/common": "^17.3.0",
    "@angular/compiler": "^17.3.0",
    "@angular/core": "^17.3.0",
    "@angular/forms": "^17.3.0",
    "@angular/platform-browser": "^17.3.0",
    "@angular/platform-browser-dynamic": "^17.3.0",
    "@angular/router": "^17.3.0",
    "phoenix-event-display": "/home/dav.zuliani/Desktop/software/phoenix/phoenix/packages/phoenix-event-display",
    "phoenix-ui-components": "^2.16.0",
    "rxjs": "~7.8.0",
    "tslib": "^2.3.0",
    "zone.js": "~0.14.3"
  },

  1. I do npm install inside my angular app
  2. I do npm start to launch the app

Unfortunately, I get the same error as before. Am I missing something?

@9inpachi
Copy link
Collaborator

@davzuliani I tried it on a brand new application and it's working perfectly fine. Make sure you are on the main branch and do yarn workspace phoenix-event-display tsc:build in the phoenix repo to properly build the phoenix-event-display package.

image

I generated the sample application with this guide we have: https://github.com/HSF/phoenix/blob/main/guides/developers/set-up-phoenix.md

If it still doesn't work for you, please share a reproducable example on codesandbox so I can test it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants