Closed MichaelDAlbrow closed 1 week ago
Hi @MichaelDAlbrow
I've not been able to recreate your error, but looking at the code I'm not sure why. To have a better shot at recreating it, it would be helpful to have an idea of what python version and package versions you are using.
For completeness, this is my package listing for my version that could run with your config file:
python 3.9.0
astropy 6.0.1 pypi_0 pypi
astroquery 0.4.6 pypi_0 pypi
dustmaps 1.0.10 pypi_0 pypi
numpy 1.25.0 pypi_0 pypi
pandas 2.0.2 pypi_0 pypi
pydantic 1.10.9 pypi_0 pypi
requests 2.31.0 pypi_0 pypi
scipy 1.10.1 pypi_0 pypi
setuptools 63.4.3 pypi_0 pypi
tqdm 4.64.1 pypi_0 pypi
If you're using conda, you can get the listing efficiently using:
conda list | while read package version; do if [[ $(grep $package requirements.txt) == $package* ]]; then echo $package $version; fi; done
Hi @MichaelDAlbrow
Thanks for your feedback.
The issue is the pydantic package, we used pydantic 1.10.9.
With their lattes changes to version 2.x, does not support our method to add the columns information.
The easiest solution for you is to use pydantic 1.10.9
Best Jonas
Thanks for the fast response.. I downgraded pydantic and it is now running.
A separate issue: I had to downgrade tables to 3.8 as my default installed version (3.9) caused a kernel crash on my m2 macbook pro. This comes from a call to pandas.to_hdf.
Michael
Hi
I'm a new user of synthpop, trying to get it working on my Mac. I'm getting an error as shown in the log below:
model = synthpop.SynthPop('synthpop_config1.json') model.init_populations()
Execution Date: 22-04-2024 14:51:22
################################ Settings #################################
read default parameters from
default_config_file = '/Users/mda45/Packages/synthpop-main/data/config_files/_default.synthpop_conf'
read configuration from
config_file = 'synthpop_config1.json'
copy the following to a config file to redo this model generation -------
{ "l_set": [ 0, 2 ], "l_set_type": null, "b_set": [ -1 ], "b_set_type": null, "name_for_output": "synthpop_test1", "model_name": "besancon_Robin2003", "solid_angle": 5e-07, "solid_angle_unit": "deg^2", "random_seed": 1122534761, "sun": { "x": -8.178, "y": 0.0, "z": 0.017, "u": 12.9, "v": 245.6, "w": 7.78, "l_apex_deg": 53.0, "b_apex_deg": 25.0 }, "lsr": { "u_lsr": 1.8, "v_lsr": 233.4, "w_lsr": 0.53 }, "warp": { "r_warp": 7.72, "amp_warp": 0.06, "amp_warp_pos": null, "amp_warp_neg": null, "alpha_warp": 1.33, "phi_warp_deg": 17.5 }, "max_distance": 15, "distance_step_size": 0.1, "window_type": { "window_type": "cone" }, "mass_lims": { "min_mass": 0.08, "max_mass": 100 }, "N_mc_totmass": 10000, "lost_mass_option": 1, "N_av_mass": 20000, "kinematics_at_the_end": true, "scale_factor": 1, "skip_lowmass_stars": false, "chunk_size": 250000, "extinction_map_kwargs": { "name": "Marshall" }, "extinction_law_kwargs": { "name": "ODonnellCardelli" }, "R_V": 3.1, "evolution_class": { "name": "MIST", "interpolator": "CharonInterpolator" }, "maglim": [ "2MASS_Ks", 30, "keep" ], "chosen_bands": [ "Bessell_B", "Bessell_V", "Bessell_I", "Gaia_G_EDR3", "Gaia_BP_EDR3", "Gaia_RP_EDR3", "2MASS_J", "2MASS_H", "2MASS_Ks", "Z087", "W146" ], "eff_wavelengths": { "json_file": "AAA_effective_wavelengths.json", "CFHT_u": 0.382671, "CFHT_CaHK": 0.3951, "CFHT_g": 0.476008, "CFHT_r": 0.620744, "CFHT_i_new": 0.768102, "CFHT_i_old": 0.768088, "CFHT_z": 0.980398, "DECam_u": 0.385688, "DECam_g": 0.47699, "DECam_r": 0.637044, "DECam_i": 0.77743, "DECam_z": 0.915488, "DECam_Y": 0.988645, "GALEX_FUV": 0.154885, "GALEX_NUV": 0.230337, "ACS_HRC_F220W": 0.225484, "ACS_HRC_F250W": 0.273938, "ACS_HRC_F330W": 0.336823, "ACS_HRC_F344N": 0.343395, "ACS_HRC_F435W": 0.434136, "ACS_HRC_F475W": 0.470887, "ACS_HRC_F502N": 0.502292, "ACS_HRC_F550M": 0.557304, "ACS_HRC_F555W": 0.532696, "ACS_HRC_F606W": 0.577643, "ACS_HRC_F625W": 0.624939, "ACS_HRC_F658N": 0.658591, "ACS_HRC_F660N": 0.660001, "ACS_HRC_F775W": 0.762432, "ACS_HRC_F814W": 0.797339, "ACS_HRC_F850LP": 0.900499, "ACS_HRC_F892N": 0.891661, "ACS_WFC_F435W": 0.434136, "ACS_WFC_F475W": 0.470887, "ACS_WFC_F502N": 0.502292, "ACS_WFC_F550M": 0.557304, "ACS_WFC_F555W": 0.532696, "ACS_WFC_F606W": 0.577643, "ACS_WFC_F625W": 0.624939, "ACS_WFC_F658N": 0.658591, "ACS_WFC_F660N": 0.660001, "ACS_WFC_F775W": 0.762432, "ACS_WFC_F814W": 0.797339, "ACS_WFC_F850LP": 0.900499, "ACS_WFC_F892N": 0.891661, "WFC3_UVIS_F200LP": 0.506944, "WFC3_UVIS_F218W": 0.221883, "WFC3_UVIS_F225W": 0.23587, "WFC3_UVIS_F275W": 0.271386, "WFC3_UVIS_F280N": 0.279694, "WFC3_UVIS_F300X": 0.286433, "WFC3_UVIS_F336W": 0.335895, "WFC3_UVIS_F343N": 0.343648, "WFC3_UVIS_F350LP": 0.55311, "WFC3_UVIS_F373N": 0.373135, "WFC3_UVIS_F390M": 0.390488, "WFC3_UVIS_F390W": 0.401986, "WFC3_UVIS_F395N": 0.395264, "WFC3_UVIS_F410M": 0.410863, "WFC3_UVIS_F438W": 0.432226, "WFC3_UVIS_F467M": 0.468087, "WFC3_UVIS_F469N": 0.468815, "WFC3_UVIS_F475W": 0.473144, "WFC3_UVIS_F475X": 0.485288, "WFC3_UVIS_F487N": 0.487339, "WFC3_UVIS_F502N": 0.500968, "WFC3_UVIS_F547M": 0.543583, "WFC3_UVIS_F555W": 0.523533, "WFC3_UVIS_F600LP": 0.727955, "WFC3_UVIS_F606W": 0.578081, "WFC3_UVIS_F621M": 0.620881, "WFC3_UVIS_F625W": 0.618765, "WFC3_UVIS_F631N": 0.6304, "WFC3_UVIS_F645N": 0.645315, "WFC3_UVIS_F656N": 0.656133, "WFC3_UVIS_F657N": 0.656646, "WFC3_UVIS_F658N": 0.658618, "WFC3_UVIS_F665N": 0.665633, "WFC3_UVIS_F673N": 0.676565, "WFC3_UVIS_F680N": 0.68746, "WFC3_UVIS_F689M": 0.687195, "WFC3_UVIS_F763M": 0.760129, "WFC3_UVIS_F775W": 0.760997, "WFC3_UVIS_F814W": 0.795484, "WFC3_UVIS_F845M": 0.842843, "WFC3_UVIS_F850LP": 0.914857, "WFC3_UVIS_F953N": 0.952895, "WFC3_IR_F098M": 0.982681, "WFC3_IR_F105W": 1.043083, "WFC3_IR_F110W": 1.120052, "WFC3_IR_F125W": 1.236355, "WFC3_IR_F126N": 1.258505, "WFC3_IR_F127M": 1.273237, "WFC3_IR_F128N": 1.283723, "WFC3_IR_F130N": 1.301012, "WFC3_IR_F132N": 1.319312, "WFC3_IR_F139M": 1.383606, "WFC3_IR_F140W": 1.373466, "WFC3_IR_F153M": 1.532628, "WFC3_IR_F160W": 1.527847, "WFC3_IR_F164N": 1.645145, "WFC3_IR_F167N": 1.6674, "WFPC2_F218W": 0.220127, "WFPC2_F255W": 0.261017, "WFPC2_F300W": 0.302867, "WFPC2_F336W": 0.334948, "WFPC2_F439W": 0.430961, "WFPC2_F450W": 0.45454, "WFPC2_F555W": 0.537054, "WFPC2_F606W": 0.589888, "WFPC2_F622W": 0.614554, "WFPC2_F675W": 0.668714, "WFPC2_F791W": 0.78205, "WFPC2_F814W": 0.792454, "WFPC2_F850LP": 0.909794, "F070W": 0.698843, "F090W": 0.898498, "F115W": 1.143362, "F140M": 1.402362, "F150W2": 1.479371, "F150W": 1.487256, "F162M": 1.624333, "F164N": 1.644618, "F182M": 1.838883, "F187N": 1.873722, "F200W": 1.968041, "F210M": 2.090835, "F212N": 2.121193, "F250M": 2.50058, "F277W": 2.727858, "F300M": 2.981832, "F322W2": 3.073138, "F323N": 3.23673, "F335M": 3.353723, "F356W": 3.528704, "F360M": 3.614893, "F405N": 4.051576, "F410M": 4.072318, "F430M": 4.278479, "F444W": 4.350426, "F460M": 4.626986, "F466N": 4.654048, "F470N": 4.707784, "F480M": 4.813911, "LSST_u": 0.37512, "LSST_g": 0.474066, "LSST_r": 0.617234, "LSST_i": 0.750097, "LSST_z": 0.86789, "LSST_y": 0.971182, "PS_g": 0.481016, "PS_r": 0.615547, "PS_i": 0.750303, "PS_z": 0.866836, "PS_y": 0.96136, "PS_w": 0.59807, "PS_open": 0.643187, "SDSS_u": 0.360804, "SDSS_g": 0.467178, "SDSS_r": 0.614112, "SDSS_i": 0.745789, "SDSS_z": 0.892278, "SkyMapper_u": 0.350022, "SkyMapper_v": 0.387868, "SkyMapper_g": 0.501605, "SkyMapper_r": 0.607685, "SkyMapper_i": 0.773283, "SkyMapper_z": 0.912025, "IRAC_3.6": 3.507483, "IRAC_4.5": 4.436556, "IRAC_5.8": 5.628062, "IRAC_8.0": 7.589054, "SPLUS_uJAVA": 0.354207, "SPLUS_gSDSS": 0.471583, "SPLUS_rSDSS": 0.620257, "SPLUS_iSDSS": 0.762701, "SPLUS_zSDSS": 0.891347, "SPLUS_J0378": 0.377, "SPLUS_J0395": 0.394, "SPLUS_J0410": 0.4094, "SPLUS_J0515": 0.5133, "SPLUS_J0660": 0.6614, "SPLUS_J0861": 0.8611, "hsc_g": 0.475871, "hsc_r": 0.616633, "hsc_i": 0.768236, "hsc_z": 0.890654, "hsc_y": 0.975962, "hsc_nb816": 0.816771, "hsc_nb921": 0.920205, "INT_IPHAS_gR": 0.615345, "INT_IPHAS_Ha": 0.65682, "INT_IPHAS_gI": 0.766326, "Swift_UVW2": 0.207569, "Swift_UVM2": 0.224656, "Swift_UVW1": 0.271568, "Swift_U": 0.352378, "Swift_B": 0.434596, "Swift_V": 0.541238, "Bessell_U": 0.365988, "Bessell_B": 0.438074, "Bessell_V": 0.544543, "Bessell_R": 0.641147, "Bessell_I": 0.798209, "2MASS_Ks": 2.152164, "2MASS_J": 1.228538, "2MASS_H": 1.63861, "Kepler_Kp": 0.597814, "Hipparcos_Hp": 0.798209, "Tycho_B": 0.428, "Tycho_V": 0.534, "Gaia_G_DR2Rev": 0.583631, "Gaia_BP_DR2Rev": 0.502092, "Gaia_RP_DR2Rev": 0.758883, "Gaia_G_MAW": 0.58443, "Gaia_BP_MAWb": 0.5042, "Gaia_BP_MAWf": 0.498269, "Gaia_RP_MAW": 0.759811, "TESS": 0.745564, "Gaia_G_EDR3": 0.673, "Gaia_BP_EDR3": 0.532, "Gaia_RP_EDR3": 0.797, "UKIDSS_Z": 0.8817, "UKIDSS_Y": 1.0305, "UKIDSS_J": 1.2483, "UKIDSS_H": 1.6313, "UKIDSS_K": 22010.0, "UVIT_F148W": 0.1481, "UVIT_F154W": 0.1541, "UVIT_F169M": 0.1608, "UVIT_F172M": 0.1717, "UVIT_N219M": 0.2196, "UVIT_N242W": 0.2418, "UVIT_N245M": 0.2447, "UVIT_N263M": 0.2632, "UVIT_N279N": 0.2792, "VISTA_Z": 0.87886, "VISTA_Y": 1.019614, "VISTA_J": 1.255579, "VISTA_H": 1.649872, "VISTA_Ks": 2.15779, "Washington_C": 0.397351, "Washington_M": 0.509304, "Washington_T1": 0.6650281, "Washington_T2": 0.797884, "Stromgren_u": 0.348257, "Stromgren_v": 0.412435, "Stromgren_b": 0.466691, "Stromgren_y": 0.546474, "R062": 0.615778, "Z087": 0.86339, "Y106": 1.045809, "J129": 1.2747, "W146": 1.30138, "H158": 1.558247, "F184": 1.830067, "WISE_W1": 3.3526, "WISE_W2": 4.6028, "WISE_W3": 11.5608, "WISE_W4": 22.0883 }, "obsmag": true, "opt_iso_props": [ "log_L", "log_Teff", "log_g", "[Fe/H]", "log_R", "phase" ], "col_names": [ "logL", "Teff", "logg", "Fe/H_evolved", "log_radius", "phase" ], "post_processing_kwargs": null, "output_location": null, "output_filename_pattern": "{model_name}_l{l_deg:.3f}_b{b_deg:.3f}", "output_file_type": "csv", "overwrite": false }
########################## initialize population ########################## read Population files from besancon_Robin2003
Population 0; bulge ----------------------------------------------------
Initialize Population 0 (bulge) from
pop_file = '/Users/mda45/Packages/synthpop-main/data/models/besancon_Robin2003/bulge.popjson'
TypeError Traceback (most recent call last) Cell In[2], line 2 1 model = synthpop.SynthPop('synthpop_config1.json') ----> 2 model.init_populations()
File ~/Packages/synthpop-main/synthpop/synthpop_main.py:222, in SynthPop.init_populations(self, forced) 216 # initialize the populations 217 self.population_params = { 218 pop_id: sp_utils.PopParams.parse_jsonfile(population_file) 219 for pop_id, population_file in enumerate(self.population_files) 220 } --> 222 self.populations = [ 223 Population(pop_params, pop_id, self.parms) 224 for pop_id, pop_params in self.population_params.items() 225 ] 226 logger.info("# all population are initialized") 227 self.populations_are_initialized = True
File ~/Packages/synthpop-main/synthpop/synthpop_main.py:223, in(.0)
216 # initialize the populations
217 self.population_params = {
218 pop_id: sp_utils.PopParams.parse_jsonfile(population_file)
219 for pop_id, population_file in enumerate(self.population_files)
220 }
222 self.populations = [
--> 223 Population(pop_params, pop_id, self.parms)
224 for pop_id, pop_params in self.population_params.items()
225 ]
226 logger.info("# all population are initialized")
227 self.populations_are_initialized = True
File ~/Packages/synthpop-main/synthpop/population.py:192, in Population.init(self, pop_params, population_index, glbl_params, **positional_kwargs) 186 self.pop_params.metallicity_func_kwargs.sun = self.sun 188 # placeholder for profiles etc. initialized via the assign_subclasses 189 ( 190 self.population_density, self.imf, self.age, self.metallicity, 191 self.kinematics, self.evolution, self.extinction --> 192 ) = self.assign_subclasses() 194 # get magnitudes from evolution class 195 if isinstance(self.evolution, list):
File ~/Packages/synthpop-main/synthpop/population.py:288, in Population.assign_subclasses(self) 285 ev_kwargs.columns = columns 287 ev_init.append(ev_kwargs) --> 288 evolution_i = Evo(iso_kwargs=ev_kwargs.init_kwargs, int_kwargs=ev_kwargs.init_kwargs) 289 val = getattr(ev_kwargs, "min_mass", evolution_i.min_mass) 290 if val < evolution_i.min_mass:
File ~/Packages/synthpop-main/synthpop/modules/evolution/_evolution.py:258, in CombineEvolution..Evolution.init(self, int_kwargs, iso_kwargs)
256 if iso_kwargs is None:
257 iso_kwargs = {}
--> 258 Isochrones.init(self, **iso_kwargs)
260 # initialize Interpolator
261 if int_kwargs is None:
TypeError: init() missing 1 required positional argument: 'columns'
My config file is:
{ "model_base_name" : "my_generated_model", "name_for_output" : "synthpop_test1", "l_set" : [0, 2], "b_set" : [-1], "solid_angle" : 5e-7, "model_name" : "besancon_Robin2003", "evolution_class" : { "name" : "MIST", "interpolator" : "CharonInterpolator" }, "extinction_map_kwargs" : {"name":"Marshall"}, "extinction_law_kwargs" : {"name":"ODonnellCardelli"} }