RemDelaporteMathurin / h-transport-materials

:bar_chart: Easily access hydrogen transport properties
https://h-transport-materials.readthedocs.io
MIT License
15 stars 12 forks source link

Re-organize `property_database` folder to include different files for different property classes #200

Open tplobo opened 1 year ago

tplobo commented 1 year ago

As a suggestion to open the discussion on how to organize the database, perhaps the property_database folder should include folders for each material, and each these material folders should include files for the different property classes that are expected to be present in the package. These files should not be a requirement, however, since there might be no references for a particular property class for a given material. Files for treating/analyzing a particular reference (e.g. from WebPlotDigitizer) should be added to their own sub-folder. A file in the database folder could contain an update_database (__init.py__?) function to automatically add all properties in property_database to the package. The tree below displays an example structure:

property_database/
├─ alumina/
│  ├─ permeabilities.py
│  ├─ diffusivities.py
│  ├─ solubilities.py
│  ├─ fowler_1977/
│  │  ├─ data.csv
│  │  ├─ project.tar
├─ gold/
│  ├─ diffusivities.py
│  ├─ solubilities.py
├─ iron/
│  ├─ recombinations.py
│  ├─ diffusivities.py
├─ update_database.py
RemDelaporteMathurin commented 1 year ago

I thought about this. I can see the advantage for materials that contain a lot of properties like tungsten. But some materials only have two or three.

Yes all the subfolders (submodules) need a __init__.py file. The properties need to be added to htm.database somehow, we have two options, either add it at the level of the file were they were created, or from outside, but in any case, I can't see an "automatic" way of doing this. We have to manually write Option 1:

from .alumina import my_diffusivity

htm.database.append(my_diffusivity)

Option 2:

my_diffusivity = htm.Diffusivity(........)

htm.database.append(my_diffusivity)
RemDelaporteMathurin commented 1 year ago

@tplobo any more thoughts about this?