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

Save latest spectra #631

Open
erwanp opened this issue Aug 18, 2022 · 0 comments
Open

Save latest spectra #631

erwanp opened this issue Aug 18, 2022 · 0 comments
Labels
🤔 backend backend related stuff 🌱 radis

Comments

@erwanp
Copy link
Collaborator

erwanp commented Aug 18, 2022

Save N latest computed spectra to improve performances when computing the same one twice


The SpectrumFactory (machinery behind calc_spectrum) can be connected to a SpecDatabase, which is really only a local folder, to automatically retrieve a Spectrum if it's already there; and store it if it's not.

This is not implemented at the calc_spectrum level, but it could be done quite easily (already asked for a few years ago in radis/radis#135 ). The api would be something like :

s = calc_spectrum(..., local_folder="~/radis_spectra")  # automatically retrieve spectra if needed, computes and stores then if not  

Advantages :

  • similarities & tests are kept at the Radis backend level; we're sure Radis-App is not mistakently returning a different spectrum it thoughts was the same
  • Radis has HDF5 read/write of spectra, so ready/writing will be almost instantaneous (if we're smart in the computation conditions ; retrieving a spectrum on a narrower spectrum than the one already computed would work too )
  • no need to change much in Radis-app
  • we'd probably only have to add a feature to keep only the N latest spectra ; or clean the cache periodically.

Originally posted by @erwanp in #619 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤔 backend backend related stuff 🌱 radis
Projects
None yet
Development

No branches or pull requests

2 participants