From 2fe043984d34234cf755c60e376e8b76a15f4539 Mon Sep 17 00:00:00 2001 From: Sherelyn Alejandro <80668767+SherelynA@users.noreply.github.com> Date: Thu, 19 Sep 2024 23:03:55 -0400 Subject: [PATCH 1/2] Changed .loc usage to concat in order to add the new data onto the empty pandas dataframe and change the test assert to match these changes. --- sedkit/modelgrid.py | 6 +++--- sedkit/tests/test_modelgrid.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sedkit/modelgrid.py b/sedkit/modelgrid.py index c8b2fb4..0b5a3e1 100644 --- a/sedkit/modelgrid.py +++ b/sedkit/modelgrid.py @@ -216,10 +216,10 @@ def add_model(self, spectrum, label=None, filepath=None, **kwargs): # Make the dictionary of new data kwargs.update({'spectrum': spectrum, 'filepath': filepath, 'label': label}) new_rec = pd.DataFrame({k: [v] for k, v in kwargs.items()}) + # Concatenate the new data with the empty dataframe + + self.index = pd.concat([new_rec, self.index], ignore_index=True) - # Add it to the index - print(self.index.columns, new_rec.keys()) - self.index.loc[len(self.index)] = new_rec @staticmethod def closest_value(input_value, possible_values, n_vals=1): diff --git a/sedkit/tests/test_modelgrid.py b/sedkit/tests/test_modelgrid.py index a32e63e..f25f67b 100644 --- a/sedkit/tests/test_modelgrid.py +++ b/sedkit/tests/test_modelgrid.py @@ -55,7 +55,7 @@ def test_filter(self): def test_photometry(self): """Test the photometry method""" phot_mg = self.bt.photometry(['2MASS.J', '2MASS.H', '2MASS.Ks']) - self.assertEqual(phot_mg.index.iloc[0]['spectrum'][0].size, 3) + self.assertEqual(phot_mg.index['spectrum'][0][0].size, 3) def test_plot(self): """Test that the plot method works""" From 7d3f45e562f16856cc030d2e8b024f88ef4118d0 Mon Sep 17 00:00:00 2001 From: Sherelyn Alejandro <80668767+SherelynA@users.noreply.github.com> Date: Thu, 19 Sep 2024 23:31:29 -0400 Subject: [PATCH 2/2] Changed Vizier query to now use the catalog keyword when calling tables from Fili 2015 paper. --- sedkit/relations.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sedkit/relations.py b/sedkit/relations.py index 1881f1b..aff1c98 100644 --- a/sedkit/relations.py +++ b/sedkit/relations.py @@ -502,10 +502,10 @@ def generate(self, orders): # ==================================================================== # Get the data - cat1 = V.query_constraints('J/ApJ/810/158/table1')[0] - cat2 = V.query_constraints('J/ApJ/810/158/table9')[0] + cat1 = V.query_constraints(catalog='J/ApJ/810/158/table1')[0] + cat2 = V.query_constraints(catalog='J/ApJ/810/158/table9')[0] - # Join the tables to getthe spectral types and radii in one table + # Join the tables to get the spectral types and radii in one table mlty_data = at.join(cat1, cat2, keys='ID', join_type='outer') # Only keep field age