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

bump plot does not work #155

Open
emilleishida opened this issue Jul 29, 2023 · 3 comments · May be fixed by #157
Open

bump plot does not work #155

emilleishida opened this issue Jul 29, 2023 · 3 comments · May be fixed by #157

Comments

@emilleishida
Copy link
Contributor

I am opening a new issue and a new branch because I was forced to merge before solving this one

@emilleishida
Copy link
Contributor Author

just transfering the issue here


`from resspect.feature_extractors.bump import BumpFeatureExtractor

path_to_feature_file = '/media/RESSPECT/data/SNPCC/raw/SIMGEN_PUBLIC_DES/DES_SN729076.DAT'

bump_lc = BumpFeatureExtractor()
bump_lc.load_snpcc_lc(path_to_feature_file)
bump_lc.fit_all()
bump_lc.plot_fit()`

returns

`File /media/emille/git/COIN/RESSPECT_work/test_env/2023/resspect2023/lib/python3.8/site-packages/resspect/feature_extractors/bump.py:157, in BumpFeatureExtractor.plot_fit(self, save, show, output_file, figscale, extrapolate, time_flux_pred, unit)
155 if plot_fit:
156 xaxis = np.linspace(min(time), max(time), 500)[:, np.newaxis]
--> 157 fitted_flux = np.array(self.evaluate(xaxis)[self.filters[i]]) * self.features[i * 5 + 4]
158 if unit == 'flux':
159 plt.plot(xaxis, fitted_flux, color='red',
160 lw=1.5, label='Bump fit')

File /media/emille/git/COIN/RESSPECT_work/test_env/2023/resspect2023/lib/python3.8/site-packages/resspect/feature_extractors/bump.py:42, in BumpFeatureExtractor.evaluate(self, time)
39 if 'None' not in self.features[k * 5 : (k + 1) * 5]:
40 for item in time:
41 flux[self.filters[k]].append(
---> 42 bump(item, self.features[0 + k * 5],
43 self.features[1 + k * 5],
44 self.features[2 + k * 5]))
45 else:
46 flux[self.filters[k]].append(None)

TypeError: 'module' object is not callable`

@emilleishida
Copy link
Contributor Author

emilleishida commented Jul 29, 2023

This is a direct consequence of the fact that there is one file which has the same name as a function.
change the import inside the feature extractor to from resspect.bump import bump solved the problem.

@emilleishida emilleishida linked a pull request Jul 29, 2023 that will close this issue
@utthishtastro
Copy link
Collaborator

Maybe this PR helps: #119

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

Successfully merging a pull request may close this issue.

2 participants