astropy / SPISEA

Stellar Population Synthesis Modeling
https://spisea.readthedocs.io/en/stable/index.html
64 stars 32 forks source link

Path for spisea_models #47

Closed Shalmalee15 closed 3 years ago

Shalmalee15 commented 3 years ago

The way my current version of SPISEA worked is by making a slight change in PATH for evolution models in my bashrc file. Instead of export SPISEA_MODELS=/ <path to evolution>, I had to use export SPISEA_MODELS=/ <path to evolution/evolution> (i.e. I had to make an additional sub-directory named 'evolution' inside the original directory 'evolution' and had to move the models in to this newly made dir.).

This is how the PATH looks like for me: export SPISEA_MODELS=/home/shalmalee/Documents/SPISEA/evolution/evolution After making this change, SPISEA works on my system now.

Not sure if this is an issue, but if it, it'll be useful for the new users.

mwhosek commented 3 years ago

Hello,

Thank you for your interest in SPISEA! I think the issue might be that the SPISEA_MODELS environment variable should point to the directory where the evolution directory lives, rather than the evolution directory itself. For example, if the evolution directory is stored in

<user_path>/evolution

then SPISEA_MODELS should be set in a bash profile as:

export SPISEA_MODELS ="<user_path>"

Under the hood, SPISEA goes to the directory SPISEA_MODELS points to and expects to find the evolution directory there.

Does this path setup work for you?

-Matt

Shalmalee15 commented 3 years ago

Hi Matt,

I am not so sure if this is correct: Under the hood, SPISEA goes to the directory SPISEA_MODELS points to and expects to find the evolution directory there. Here's the reason why I think that. First, it didn't work for me. Second, SPISEA didn't recognize the 'evolution' directory when I setup the path like this in my bash profile.

So, the way I have setup the path for the evolution models is working for me, now. That's good news. :) My bash profile looks like this: export SPISEA_MODELS=/home/shalmalee/Documents/SPISEA/evolution/evolution This means I had to create an empty directory under the 'evolution' directory which was already made when I unzipped the model tar file. Later on, I had to move all the models to this newly made directory and setup the PATH that way in my bash profile.

Once this was done, all worked well. :) Not sure if everyone has to do this, but I did not get this suggestion from instructions on the readthedocs. Hence, reporting the issue. Not a major one, I know!

Thanks, Matt!

mwhosek commented 3 years ago

Hi Shalmalee,

I'm glad your installation setup is working, but I'm puzzled because that isn't the way the code was meant to work. So, I want to make sure this isn't some sort of strange bug manifesting. Here is how the SPISEA_MODELS environment variable is supposed to work:

In lines 18-19 of spisea/evolution.py, a global variable named models_dir is defined as:

models_dir = os.environ['SPISEA_MODELS']
models_dir += '/evolution/'

This is meant to be the path that points to the individual evolution model directories, e.g. MISTv1, Baraffe15, Ekstrom2012, etc.

Then, in the __init__ function of each evolution model class in evolution.py, a local variable self.model_dir is defined that uses the global models_dir variable to define the path to the specific evolution model sub-directory. For example, on line 131 of the Ekstrom12 class:

 self.model_dir = models_dir+'Ekstrom2012/'

This information is then used by the isochrone function in the class, which finds and reads in the appropriate isochrone (e.g. see variable full_iso_file on line 170 in Ekstrom12 class).

So, for your setup, I would expect that models_dir = /home/shalmalee/Documents/SPISEA/evolution/evolution/evolution. Is this the case? If so, then in order for SPISEA to work, the individual evolution model directories (e.g. MISTv1, Baraffe15, Ekstrom2012, etc) would be stored at that location. Is that true?

Thanks for your help! Matt

Shalmalee15 commented 3 years ago

Hi Matt,

I see, I think I might have unzipped the spisea_cdbs.tar.gz and spisea_models.tar.gz wrong way, then! Because, models_dir = /home/shalmalee/Documents/SPISEA/evolution/evolution/evolution does not work for me. Instead, it's just models_dir = /home/shalmalee/Documents/SPISEA/evolution/evolution/.

So, let me just tell you the steps I followed.

  1. I unzipped the spisea_cdbs.tar.gz and spisea_models.tar.gz in /home/shalmalee/Documents/SPISEA
  2. Step 1 created two dictionaries i) spisea_cdbs and ii) evolution.
  3. I set these two paths in my bash profile, but /home/shalmalee/Documents/SPISEA/evolution didn't work for me as I pointed out earlier. I noticed this error when I was testing my installation in jupyeter notebook by from spisea import synthetic. The error was something like "No such file or directory: '/home/shalmalee/Documents/SPISEA/evolution
  4. That's the reason why I had to create a new empty directory where I then copied all the models (Baraffe15, MISTv1 etc) in this new evolution dir which were present in the old evolution dir. This resulted in the path models_dir = /home/shalmalee/Documents/SPISEA/evolution/evolution/

So, I think I might have misunderstood the instructions in readthedocs. However, the current setup is working for me. So all good that way!

Once I finish my current work with SPISEA, I will uninstall and reinstall the code to see if installation proceeds well with the instructions and give you feedback, then.

mwhosek commented 3 years ago

Hi Shalmalee,

Thanks for describing your install process! I think I see what might have happened. In step 3, you want to set the SPISEA_MODELS variable in your bash_profile to be /home/shalmalee/Documents/SPISEA/, not /home/shalmalee/Documents/SPISEA/evolution. Then, when you run the code, you should see that models_dir = /home/shalmalee/Documents/SPISEA/evolution/. This should match the location of the evolution model sub-directories (Baraffe15, MISTv1, etc) created when you unzip the spisea_models.tar.gz file.

Hopefully this setup will work for you, when you get a chance to try it. I will update the installation instructions to make this more clear. Thanks for the feedback!

-Matt

Shalmalee15 commented 3 years ago

Okay. No worries, thanks, Matt!

I will close the issue for now. Thanks for all your help.