Skip to content

bump plot does not work #155

@emilleishida

Description

@emilleishida
Contributor

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

Activity

emilleishida

emilleishida commented on Jul 29, 2023

@emilleishida
ContributorAuthor

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

emilleishida commented on Jul 29, 2023

@emilleishida
ContributorAuthor

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.

linked a pull request that will close this issue155/bump plot #157on Jul 29, 2023
utthishtastro

utthishtastro commented on Jul 30, 2023

@utthishtastro
Collaborator

Maybe this PR helps: #119

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @emilleishida@utthishtastro

      Issue actions

        bump plot does not work · Issue #155 · COINtoolbox/RESSPECT