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

incompatibility with recent astropy.table #62

Open
taichiuyama opened this issue Sep 27, 2024 · 0 comments
Open

incompatibility with recent astropy.table #62

taichiuyama opened this issue Sep 27, 2024 · 0 comments

Comments

@taichiuyama
Copy link

  • pyNRC version: 1.3.1
  • Python version: 3.10.14
  • Operating System: Mac OS Sonoma 14.4.1

Description

Describe what you were trying to get done.
Tell us what happened, what went wrong, and what you expected to happen.

I'm generating pynrc.source_spectrum from atropy.table to deal with a young star with an IR excess, and the recent astropy versions (5.3+, required by jwst ver. 1.16) have incompatibility with spectra.py
at l1067 - tbl.add_column(col)
needs to be replaced with Table.replace_column()

What I Did

Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.

Cell In[7], line 11
7 sp_sci.name = name_sci
9 # And the refernece source
10 #sp_ref = pynrc.stellar_spectrum(spt_ref, mag_ref, 'vegamag', bp_ref,Teff=Teff_ref, metallicity=feh_ref, log_g=logg_ref)
---> 11 sp_ref = pynrc.source_spectrum(name_ref, spt_ref, mag_ref, bp_ref, table_phot)
12 sp_ref.name = name_ref

File /opt/anaconda3/envs/pynrc/lib/python3.10/site-packages/webbpsf_ext/spectra.py:1026, in source_spectrum.init(self, name, sptype, mag_val, bp, votable_input, Teff, metallicity, log_g, Av, **kwargs)
1024 # Read in photometry
1025 self._check_file(**kwargs)
-> 1026 self._gen_table()
1027 self._combine_fluxes()

File /opt/anaconda3/envs/pynrc/lib/python3.10/site-packages/webbpsf_ext/spectra.py:1067, in source_spectrum._gen_table(self)
1065 # Add wavelength column
1066 col = tbl.Column(wave_A, 'sed_wave')
-> 1067 tbl.add_column(col)
1069 # Sort flux monotomically with wavelength
1070 tbl.sort(['sed_wave', 'sed_flux'])

File /opt/anaconda3/envs/pynrc/lib/python3.10/site-packages/astropy/table/table.py:2428, in Table.add_column(self, col, index, name, rename_duplicate, copy, default_name)
2425 self._set_col_parent_table_and_mask(col)
2427 # Add new column as last column
-> 2428 self.columns[name] = col
2430 if index is not None:
2431 # Move the other cols to the right of the new one
2432 move_names = self.colnames[index:-1]

File /opt/anaconda3/envs/pynrc/lib/python3.10/site-packages/astropy/table/table.py:292, in TableColumns.setitem(self, item, value, validated)
281 """
282 Set item in this dict instance, but do not allow directly replacing an
283 existing column unless it is already validated (and thus is certain to
(...)
289
290 """
291 if item in self and not validated:
--> 292 raise ValueError(
293 f"Cannot replace column '{item}'. Use Table.replace_column() instead."
294 )
295 super().setitem(item, value)

ValueError: Cannot replace column 'sed_wave'. Use Table.replace_column() instead.

@taichiuyama taichiuyama changed the title incompatibility with the latest astropy incompatibility with recent astropy.table Sep 27, 2024
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

1 participant