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

TypeError in Version2.0.1 #278

Open
diyiliaoya opened this issue Sep 23, 2024 · 9 comments
Open

TypeError in Version2.0.1 #278

diyiliaoya opened this issue Sep 23, 2024 · 9 comments

Comments

@diyiliaoya
Copy link

When I run the star class like this:
st = pb.star(ID, pg, numax, dnu, teff, bp_rp)
TypeError will show:

TypeError                                 Traceback (most recent call last)
Cell In[10], [line 1](vscode-notebook-cell:?execution_count=10&line=1)
----> [1](vscode-notebook-cell:?execution_count=10&line=1) st = pb.star(ID, pg, numax, dnu, teff, bp_rp)

File ~/anaconda3/envs/pbjam2/lib/python3.12/site-packages/pbjam/core.py:916, in star.__init__(self, ID, f, s, addObs, outpath, priorpath)
    [912](https://file+.vscode-resource.vscode-cdn.net/home/lishijie/Tools/PBjam/~/anaconda3/envs/pbjam2/lib/python3.12/site-packages/pbjam/core.py:912) def __init__(self, ID, f, s, addObs, outpath=None, priorpath=None):
    [914](https://file+.vscode-resource.vscode-cdn.net/home/lishijie/Tools/PBjam/~/anaconda3/envs/pbjam2/lib/python3.12/site-packages/pbjam/core.py:914)     self.__dict__.update((k, v) for k, v in locals().items() if k not in ['self'])
--> [916](https://file+.vscode-resource.vscode-cdn.net/home/lishijie/Tools/PBjam/~/anaconda3/envs/pbjam2/lib/python3.12/site-packages/pbjam/core.py:916)     self.outpath = IO._set_outpath(ID, self.outpath)
    [918](https://file+.vscode-resource.vscode-cdn.net/home/lishijie/Tools/PBjam/~/anaconda3/envs/pbjam2/lib/python3.12/site-packages/pbjam/core.py:918)     if priorpath is None:
    [919](https://file+.vscode-resource.vscode-cdn.net/home/lishijie/Tools/PBjam/~/anaconda3/envs/pbjam2/lib/python3.12/site-packages/pbjam/core.py:919)         self.priorpath = IO.get_priorpath()

File ~/anaconda3/envs/pbjam2/lib/python3.12/site-packages/pbjam/IO.py:895, in _set_outpath(ID, rootPath)
    [892](https://file+.vscode-resource.vscode-cdn.net/home/lishijie/Tools/PBjam/~/anaconda3/envs/pbjam2/lib/python3.12/site-packages/pbjam/IO.py:892)     rootPath = os.getcwd()
    [894](https://file+.vscode-resource.vscode-cdn.net/home/lishijie/Tools/PBjam/~/anaconda3/envs/pbjam2/lib/python3.12/site-packages/pbjam/IO.py:894) if not os.path.basename == ID:
--> [895](https://file+.vscode-resource.vscode-cdn.net/home/lishijie/Tools/PBjam/~/anaconda3/envs/pbjam2/lib/python3.12/site-packages/pbjam/IO.py:895)     path = os.path.join(*[rootPath, f'{ID}'])
    [896](https://file+.vscode-resource.vscode-cdn.net/home/lishijie/Tools/PBjam/~/anaconda3/envs/pbjam2/lib/python3.12/site-packages/pbjam/IO.py:896) else:
    [897](https://file+.vscode-resource.vscode-cdn.net/home/lishijie/Tools/PBjam/~/anaconda3/envs/pbjam2/lib/python3.12/site-packages/pbjam/IO.py:897)     path = rootPath

File <frozen posixpath>:76, in join(a, *p)

TypeError: expected str, bytes or os.PathLike object, not tuple
@grd349
Copy link
Owner

grd349 commented Sep 23, 2024

@nielsenmb - is this anticipated in 2.0.1?

@nielsenmb
Copy link
Collaborator

nielsenmb commented Sep 23, 2024 via email

@diyiliaoya
Copy link
Author

Hi Shijie, The star class isn't currently functioning with the updates in v2.0.1. I think your best bet is to look at one of the example notebooks that should be in the main directory of the repo. Hope that helps!

On Mon, 23 Sept 2024, 09:31 Guy Davies, @.> wrote: @nielsenmb https://github.com/nielsenmb - is this anticipated in 2.0.1? — Reply to this email directly, view it on GitHub <#278 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEJWO336XDG636TY6NJWQALZX7GXDAVCNFSM6AAAAABOVDQNKWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNRXGU2DOMZYGQ . You are receiving this because you were mentioned.Message ID: @.>

Hi @nielsenmb ,

The error listed above is the one I encountered when running docs/example-star.ipynb

@grd349
Copy link
Owner

grd349 commented Sep 24, 2024

Hi @diyiliaoya,

Could you post the error message from example-star here together with your os details and I will look in to it.

Thanks - Guy

@diyiliaoya
Copy link
Author

example-star

Hi @grd349 ,

example-star was running fine until it hit the line st = pb.star(ID, pg, numax, dnu, teff, bp_rp), and then I got the following error:

TypeError                                 Traceback (most recent call last)
Cell In[9], [line 1](vscode-notebook-cell:?execution_count=9&line=1)
----> [1](vscode-notebook-cell:?execution_count=9&line=1) st = pb.star(ID, pg, numax, dnu, teff, bp_rp)

File ~/anaconda3/envs/pbjam2/lib/python3.12/site-packages/pbjam/core.py:916, in star.__init__(self, ID, f, s, addObs, outpath, priorpath)
    [912](https://file+.vscode-resource.vscode-cdn.net/home/lishijie/Tools/PBjam/~/anaconda3/envs/pbjam2/lib/python3.12/site-packages/pbjam/core.py:912) def __init__(self, ID, f, s, addObs, outpath=None, priorpath=None):
    [914](https://file+.vscode-resource.vscode-cdn.net/home/lishijie/Tools/PBjam/~/anaconda3/envs/pbjam2/lib/python3.12/site-packages/pbjam/core.py:914)     self.__dict__.update((k, v) for k, v in locals().items() if k not in ['self'])
--> [916](https://file+.vscode-resource.vscode-cdn.net/home/lishijie/Tools/PBjam/~/anaconda3/envs/pbjam2/lib/python3.12/site-packages/pbjam/core.py:916)     self.outpath = IO._set_outpath(ID, self.outpath)
    [918](https://file+.vscode-resource.vscode-cdn.net/home/lishijie/Tools/PBjam/~/anaconda3/envs/pbjam2/lib/python3.12/site-packages/pbjam/core.py:918)     if priorpath is None:
    [919](https://file+.vscode-resource.vscode-cdn.net/home/lishijie/Tools/PBjam/~/anaconda3/envs/pbjam2/lib/python3.12/site-packages/pbjam/core.py:919)         self.priorpath = IO.get_priorpath()

File ~/anaconda3/envs/pbjam2/lib/python3.12/site-packages/pbjam/IO.py:895, in _set_outpath(ID, rootPath)
    [892](https://file+.vscode-resource.vscode-cdn.net/home/lishijie/Tools/PBjam/~/anaconda3/envs/pbjam2/lib/python3.12/site-packages/pbjam/IO.py:892)     rootPath = os.getcwd()
    [894](https://file+.vscode-resource.vscode-cdn.net/home/lishijie/Tools/PBjam/~/anaconda3/envs/pbjam2/lib/python3.12/site-packages/pbjam/IO.py:894) if not os.path.basename == ID:
--> [895](https://file+.vscode-resource.vscode-cdn.net/home/lishijie/Tools/PBjam/~/anaconda3/envs/pbjam2/lib/python3.12/site-packages/pbjam/IO.py:895)     path = os.path.join(*[rootPath, f'{ID}'])
    [896](https://file+.vscode-resource.vscode-cdn.net/home/lishijie/Tools/PBjam/~/anaconda3/envs/pbjam2/lib/python3.12/site-packages/pbjam/IO.py:896) else:
    [897](https://file+.vscode-resource.vscode-cdn.net/home/lishijie/Tools/PBjam/~/anaconda3/envs/pbjam2/lib/python3.12/site-packages/pbjam/IO.py:897)     path = rootPath

File <frozen posixpath>:76, in join(a, *p)

TypeError: expected str, bytes or os.PathLike object, not tuple

Environment:
Rocky linux9,python 3.12.5

@grd349
Copy link
Owner

grd349 commented Sep 26, 2024

Thanks - The new syntax for running can be found in ...

https://github.com/grd349/PBjam/blob/master/example-Star.ipynb

The docs/example-Star.ipynb is out of date and should be removed/updated.

@diyiliaoya Could you see if the new syntax fixes your error?

Thanks,

Guy

@diyiliaoya
Copy link
Author

diyiliaoya commented Sep 27, 2024

Thanks - The new syntax for running can be found in ...

https://github.com/grd349/PBjam/blob/master/example-Star.ipynb

The docs/example-Star.ipynb is out of date and should be removed/updated.

@diyiliaoya Could you see if the new syntax fixes your error?

Thanks,

Guy

Hi @grd349 ,

It still can't work.

First, you need to change from pbjam.star import star to from pbjam import star, or you'll get an error like this:

ModuleNotFoundError                       Traceback (most recent call last)
Cell In[21], line 4
      2 get_ipython().run_line_magic('autoreload', '2')
      3 from pbjam import IO
----> 4 from pbjam.star import star

Next, S = star('KIC10963065', f, s, addObs) gives an error like this:

AttributeError                            Traceback (most recent call last)
Cell In[20], [line 1](vscode-notebook-cell:?execution_count=20&line=1)
----> [1](vscode-notebook-cell:?execution_count=20&line=1) S = star('KIC10963065', f, s, addObs)

File ~/anaconda3/envs/pbjam2/lib/python3.12/site-packages/pbjam/core.py:919, in star.__init__(self, ID, f, s, addObs, outpath, priorpath)
    [916](https://file+.vscode-resource.vscode-cdn.net/home/lishijie/Tools/PBjam/~/anaconda3/envs/pbjam2/lib/python3.12/site-packages/pbjam/core.py:916) self.outpath = IO._set_outpath(ID, self.outpath)
    [918](https://file+.vscode-resource.vscode-cdn.net/home/lishijie/Tools/PBjam/~/anaconda3/envs/pbjam2/lib/python3.12/site-packages/pbjam/core.py:918) if priorpath is None:
--> [919](https://file+.vscode-resource.vscode-cdn.net/home/lishijie/Tools/PBjam/~/anaconda3/envs/pbjam2/lib/python3.12/site-packages/pbjam/core.py:919)     self.priorpath = IO.get_priorpath()

AttributeError: module 'pbjam.IO' has no attribute 'get_priorpath'

@grd349
Copy link
Owner

grd349 commented Sep 27, 2024

@diyiliaoya Thanks.

I can't recreate your bug right now, but I have another bug to solve first. I'll continue to look at this.

@diyiliaoya
Copy link
Author

@diyiliaoya Thanks.

I can't recreate your bug right now, but I have another bug to solve first. I'll continue to look at this.

OK,Thanks!

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