Closed AstroBioAnto closed 1 year ago
I was having the same issue in Tutorial2.ipynb
, and may have tracked it down. Normally, the read_stellar_catalog()
function has the filename
kwarg default to DATA_DIR + 'LUVOIR_targets.dat'
, which is the correct pathing for the current file structure. However, the default imaging.pkl
generator file currently specifies filename = 'LUVOIR_targets.dat'
as a default argument value, so it is missing the DATA_DIR
path prefix.
The read_stellar_catalog()
function does have a check to see if the path specified by filename
exists (line 302 of functions.py), but if not it defaults to ROOT_DIR+'/'+filename
rather than DATA_DIR+'/'+filename
. As a result, any functions and examples that set up a generator with generator = Generator('imaging')
will break because they can't find the file.
Two solutions could be:
imaging.pkl
file so that its filename
argument value for read_stellar_catalog()
includes the proper path.read_stellar_catalog()
path check statement on line 302 to also check for a path with the DATA_DIR
prefix (or default to adding DATA_DIR
instead of ROOT_DIR
).Fixed by removing the DATA_DIR
prefix from line 273, and changing line 302 to be the same check as line 99 from the read_stars_Gaia function.
Running Example1.ipynb, I noticed that in cell #4, survey.quickrun returns a path error for step 0. Running generator.generate(), I get the same error, it seems that the path to LUVOIR_targets.dat is broken somewhere.
Traceback (most recent call last): File "/Users//.pyenv/versions/3.11.1/lib/python3.11/site-packages/bioverse/generator.py", line 158, in generate
d = self.steps[i].run(d,kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users//.pyenv/versions/3.11.1/lib/python3.11/site-packages/bioverse/generator.py", line 236, in run
return func(d, kwargs2)
^^^^^^^^^^^^^^^^^
File "/Users//.pyenv/versions/3.11.1/lib/python3.11/site-packages/bioverse/functions.py", line 303, in read_stellar_catalog
catalog = np.genfromtxt(path,unpack=False,names=True,dtype=None,encoding=None)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users//.pyenv/versions/3.11.1/lib/python3.11/site-packages/numpy/lib/npyio.py", line 1959, in genfromtxt
fid = np.lib._datasource.open(fname, 'rt', encoding=encoding)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users//.pyenv/versions/3.11.1/lib/python3.11/site-packages/numpy/lib/_datasource.py", line 193, in open
return ds.open(path, mode, encoding=encoding, newline=newline)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users//.pyenv/versions/3.11.1/lib/python3.11/site-packages/numpy/lib/_datasource.py", line 533, in open
raise FileNotFoundError(f"{path} not found.")
FileNotFoundError: /Users//.pyenv/versions/3.11.1/lib/python3.11/site-packages/bioverse/LUVOIR_targets.dat not found.