parsotat / BatAnalysis

A python HEASOFT wrapper for processing Swift-BAT data.
MIT License
30 stars 11 forks source link

Error in importing batanalysis #28

Closed drsadaula closed 4 months ago

drsadaula commented 4 months ago

I followed the installation instructions in GitHub.

git clone https://github.com/parsotat/BatAnalysis.git cd BatAnalysis/ pip install -e .

This worked fine.

When I try to run a notebook, the following error pops up. The issue arises when trying to import bat analysis as BA. It says CALDB has not been installed or initialized. I am using the CALDB for remote access. This is working fine on my computer for NICER and SWIFT XRT. Could anyone help me with this?

I got this in the notebook when I ran the os.environ["CALDB"] command. It may help you figure out the issue.

os.environ["CALDB"]

'https://heasarc.gsfc.nasa.gov/FTP/caldb'


AttributeError
Cell In [8], line 4 2 import os 3 import sys ----> 4 import batanalysis as ba 5 import matplotlib.pyplot as plt 6 import numpy as np

File ~/xray_analysis/sibasish/swift/bat_obs/BatAnalysis/batanalysis/init.py:21 15 raise EnvironmentError('CALDB does not seem to be initialized/installed. ' 16 'BatAnalysis cannot be imported without this.')


parsotat commented 4 months ago

can you uninstall BatAnalysis with pip uninstall BatAnalysis and then try to install from pypi with pip install BatAnalysis? I expect the error will be the same, but I would like to verify that first.

drsadaula commented 4 months ago

It still shows the same error. To inform you, I tried in the sciserver the same way, it worked fine. I could import batanalysis without any issues.

parsotat commented 4 months ago

the other thing that I would like to try is to start an ipython session and try to import BatAnalysis within there. If you do that, does it import without any issues?

drsadaula commented 4 months ago

The same error popped up!

parsotat commented 4 months ago

in ipython, what does os.environ["CALDB"] print out?

drsadaula commented 4 months ago

Below is the printout.

'https://heasarc.gsfc.nasa.gov/FTP/caldb'

parsotat commented 4 months ago

Something strange is going on with the bash environment. can you run your heainit script in the terminal and then retry the ipython steps above, in that same terminal?

drsadaula commented 4 months ago

Again, the same error popped up!

parsotat commented 4 months ago

another thing to try is to download an observation and try to run HEASOFT's batsurvey on it. this will help us determine if this is an heasoft environment issue that is occurring elsewhere or something wrong with the code itself.

parsotat commented 4 months ago

the issue was related to a different package not being imported and throwing an error.