diff --git a/CHANGES.rst b/CHANGES.rst index 49cc7ddf1a..6710e9e9cc 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -34,6 +34,7 @@ utils.tap - ``TapPlus.upload_table`` should not allow table names to contain a dot. ``ValueError`` is now raised for such cases. [#2971] +- Fix method read_http_response to retrieve json files. This fixes the previous PR #2947. [#2990] gaia ^^^^ diff --git a/astroquery/utils/tap/xmlparser/tests/data/test.json b/astroquery/utils/tap/xmlparser/tests/data/test.json new file mode 100644 index 0000000000..f6a40b8dff --- /dev/null +++ b/astroquery/utils/tap/xmlparser/tests/data/test.json @@ -0,0 +1,160 @@ +{"metadata": +[ +{"name": "solution_id", "datatype": "long", "xtype": null, "arraysize": null, "description": "Solution Identifier", "unit": null, "ucd": "meta.version", "utype": null}, +{"name": "designation", "datatype": "char", "xtype": null, "arraysize": "*", "description": "Unique source designation (unique across all Data Releases)", "unit": null, "ucd": "meta.id;meta.main", "utype": null}, +{"name": "source_id", "datatype": "long", "xtype": null, "arraysize": null, "description": "Unique source identifier (unique within a particular Data Release)", "unit": null, "ucd": "meta.id", "utype": null}, +{"name": "random_index", "datatype": "long", "xtype": null, "arraysize": null, "description": "Random index for use when selecting subsets", "unit": null, "ucd": "meta.code", "utype": null}, +{"name": "ref_epoch", "datatype": "double", "xtype": null, "arraysize": null, "description": "Reference epoch", "unit": "yr", "ucd": "meta.ref;time.epoch", "utype": "stc:AstroCoords.Time.TimeInstant"}, +{"name": "ra", "datatype": "double", "xtype": null, "arraysize": null, "description": "Right ascension", "unit": "deg", "ucd": "pos.eq.ra;meta.main", "utype": "stc:AstroCoords.Position3D.Value3.C1"}, +{"name": "ra_error", "datatype": "float", "xtype": null, "arraysize": null, "description": "Standard error of right ascension", "unit": "mas", "ucd": "stat.error;pos.eq.ra", "utype": "stc:AstroCoords.Position3D.Error3.C1"}, +{"name": "dec", "datatype": "double", "xtype": null, "arraysize": null, "description": "Declination", "unit": "deg", "ucd": "pos.eq.dec;meta.main", "utype": "stc:AstroCoords.Position3D.Value3.C2"}, +{"name": "dec_error", "datatype": "float", "xtype": null, "arraysize": null, "description": "Standard error of declination", "unit": "mas", "ucd": "stat.error;pos.eq.dec", "utype": "stc:AstroCoords.Position3D.Error3.C2"}, +{"name": "parallax", "datatype": "double", "xtype": null, "arraysize": null, "description": "Parallax", "unit": "mas", "ucd": "pos.parallax.trig", "utype": null}, +{"name": "parallax_error", "datatype": "float", "xtype": null, "arraysize": null, "description": "Standard error of parallax", "unit": "mas", "ucd": "stat.error;pos.parallax.trig", "utype": null}, +{"name": "parallax_over_error", "datatype": "float", "xtype": null, "arraysize": null, "description": "Parallax divided by its standard error", "unit": null, "ucd": "stat.snr;pos.parallax.trig", "utype": null}, +{"name": "pm", "datatype": "float", "xtype": null, "arraysize": null, "description": "Total proper motion", "unit": "mas.yr**-1", "ucd": "pos.pm;pos.eq", "utype": null}, +{"name": "pmra", "datatype": "double", "xtype": null, "arraysize": null, "description": "Proper motion in right ascension direction", "unit": "mas.yr**-1", "ucd": "pos.pm;pos.eq.ra", "utype": "stc:AstroCoords.Velocity3D.Value3.C1"}, +{"name": "pmra_error", "datatype": "float", "xtype": null, "arraysize": null, "description": "Standard error of proper motion in right ascension direction", "unit": "mas.yr**-1", "ucd": "stat.error;pos.pm;pos.eq.ra", "utype": "stc:AstroCoords.Velocity3D.Error3.C1"}, +{"name": "pmdec", "datatype": "double", "xtype": null, "arraysize": null, "description": "Proper motion in declination direction", "unit": "mas.yr**-1", "ucd": "pos.pm;pos.eq.dec", "utype": "stc:AstroCoords.Velocity3D.Value3.C2"}, +{"name": "pmdec_error", "datatype": "float", "xtype": null, "arraysize": null, "description": "Standard error of proper motion in declination direction", "unit": "mas.yr**-1", "ucd": "stat.error;pos.pm;pos.eq.dec", "utype": "stc:AstroCoords.Velocity3D.Error3.C2"}, +{"name": "ra_dec_corr", "datatype": "float", "xtype": null, "arraysize": null, "description": "Correlation between right ascension and declination", "unit": null, "ucd": "stat.correlation", "utype": null}, +{"name": "ra_parallax_corr", "datatype": "float", "xtype": null, "arraysize": null, "description": "Correlation between right ascension and parallax", "unit": null, "ucd": "stat.correlation", "utype": null}, +{"name": "ra_pmra_corr", "datatype": "float", "xtype": null, "arraysize": null, "description": "Correlation between right ascension and proper motion in right ascension", "unit": null, "ucd": "stat.correlation", "utype": null}, +{"name": "ra_pmdec_corr", "datatype": "float", "xtype": null, "arraysize": null, "description": "Correlation between right ascension and proper motion in declination", "unit": null, "ucd": "stat.correlation", "utype": null}, +{"name": "dec_parallax_corr", "datatype": "float", "xtype": null, "arraysize": null, "description": "Correlation between declination and parallax", "unit": null, "ucd": "stat.correlation", "utype": null}, +{"name": "dec_pmra_corr", "datatype": "float", "xtype": null, "arraysize": null, "description": "Correlation between declination and proper motion in right ascension", "unit": null, "ucd": "stat.correlation", "utype": null}, +{"name": "dec_pmdec_corr", "datatype": "float", "xtype": null, "arraysize": null, "description": "Correlation between declination and proper motion in declination", "unit": null, "ucd": "stat.correlation", "utype": null}, +{"name": "parallax_pmra_corr", "datatype": "float", "xtype": null, "arraysize": null, "description": "Correlation between parallax and proper motion in right ascension", "unit": null, "ucd": "stat.correlation", "utype": null}, +{"name": "parallax_pmdec_corr", "datatype": "float", "xtype": null, "arraysize": null, "description": "Correlation between parallax and proper motion in declination", "unit": null, "ucd": "stat.correlation", "utype": null}, +{"name": "pmra_pmdec_corr", "datatype": "float", "xtype": null, "arraysize": null, "description": "Correlation between proper motion in right ascension and proper motion in declination", "unit": null, "ucd": "stat.correlation", "utype": null}, +{"name": "astrometric_n_obs_al", "datatype": "short", "xtype": null, "arraysize": null, "description": "Total number of observations in the along-scan (AL) direction", "unit": null, "ucd": "meta.number", "utype": null}, +{"name": "astrometric_n_obs_ac", "datatype": "short", "xtype": null, "arraysize": null, "description": "Total number of observations in the across-scan (AC) direction", "unit": null, "ucd": "meta.number", "utype": null}, +{"name": "astrometric_n_good_obs_al", "datatype": "short", "xtype": null, "arraysize": null, "description": "Number of good observations in the along-scan (AL) direction", "unit": null, "ucd": "meta.number", "utype": null}, +{"name": "astrometric_n_bad_obs_al", "datatype": "short", "xtype": null, "arraysize": null, "description": "Number of bad observations in the along-scan (AL) direction", "unit": null, "ucd": "meta.number", "utype": null}, +{"name": "astrometric_gof_al", "datatype": "float", "xtype": null, "arraysize": null, "description": "Goodness of fit statistic of model wrt along-scan observations", "unit": null, "ucd": "stat.fit.goodness", "utype": null}, +{"name": "astrometric_chi2_al", "datatype": "float", "xtype": null, "arraysize": null, "description": "AL chi-square value", "unit": null, "ucd": "stat.fit.chi2", "utype": null}, +{"name": "astrometric_excess_noise", "datatype": "float", "xtype": null, "arraysize": null, "description": "Excess noise of the source", "unit": "mas", "ucd": "stat.value", "utype": null}, +{"name": "astrometric_excess_noise_sig", "datatype": "float", "xtype": null, "arraysize": null, "description": "Significance of excess noise", "unit": null, "ucd": "stat.value", "utype": null}, +{"name": "astrometric_params_solved", "datatype": "short", "xtype": null, "arraysize": null, "description": "Which parameters have been solved for?", "unit": null, "ucd": "meta.number", "utype": null}, +{"name": "astrometric_primary_flag", "datatype": "boolean", "xtype": null, "arraysize": null, "description": "Primary or seconday", "unit": null, "ucd": "meta.code", "utype": null}, +{"name": "nu_eff_used_in_astrometry", "datatype": "float", "xtype": null, "arraysize": null, "description": "Effective wavenumber of the source used in the astrometric solution", "unit": "um**-1", "ucd": "em.wavenumber", "utype": null}, +{"name": "pseudocolour", "datatype": "float", "xtype": null, "arraysize": null, "description": "Astrometrically estimated pseudocolour of the source", "unit": "um**-1", "ucd": "em.wavenumber", "utype": null}, +{"name": "pseudocolour_error", "datatype": "float", "xtype": null, "arraysize": null, "description": "Standard error of the pseudocolour of the source", "unit": "um**-1", "ucd": "stat.error;em.wavenumber", "utype": null}, +{"name": "ra_pseudocolour_corr", "datatype": "float", "xtype": null, "arraysize": null, "description": "Correlation between right ascension and pseudocolour", "unit": null, "ucd": "stat.correlation;em.wavenumber;pos.eq.ra", "utype": null}, +{"name": "dec_pseudocolour_corr", "datatype": "float", "xtype": null, "arraysize": null, "description": "Correlation between declination and pseudocolour", "unit": null, "ucd": "stat.correlation;em.wavenumber;pos.eq.dec", "utype": null}, +{"name": "parallax_pseudocolour_corr", "datatype": "float", "xtype": null, "arraysize": null, "description": "Correlation between parallax and pseudocolour", "unit": null, "ucd": "stat.correlation;em.wavenumber;pos.parallax", "utype": null}, +{"name": "pmra_pseudocolour_corr", "datatype": "float", "xtype": null, "arraysize": null, "description": "Correlation between proper motion in right asension and pseudocolour", "unit": null, "ucd": "stat.correlation;em.wavenumber;pos.pm;pos.eq.ra", "utype": null}, +{"name": "pmdec_pseudocolour_corr", "datatype": "float", "xtype": null, "arraysize": null, "description": "Correlation between proper motion in declination and pseudocolour", "unit": null, "ucd": "stat.correlation;em.wavenumber;pos.pm;pos.eq.dec", "utype": null}, +{"name": "astrometric_matched_transits", "datatype": "short", "xtype": null, "arraysize": null, "description": "Matched FOV transits used in the AGIS solution", "unit": null, "ucd": "meta.number", "utype": null}, +{"name": "visibility_periods_used", "datatype": "short", "xtype": null, "arraysize": null, "description": "Number of visibility periods used in Astrometric solution", "unit": null, "ucd": "meta.number", "utype": null}, +{"name": "astrometric_sigma5d_max", "datatype": "float", "xtype": null, "arraysize": null, "description": "The longest semi-major axis of the 5-d error ellipsoid", "unit": "mas", "ucd": "stat;pos.errorEllipse", "utype": null}, +{"name": "matched_transits", "datatype": "short", "xtype": null, "arraysize": null, "description": "The number of transits matched to this source", "unit": null, "ucd": "meta.number", "utype": null}, +{"name": "new_matched_transits", "datatype": "short", "xtype": null, "arraysize": null, "description": "The number of transits newly incorporated into an existing source in the current cycle", "unit": null, "ucd": "meta.number", "utype": null}, +{"name": "matched_transits_removed", "datatype": "short", "xtype": null, "arraysize": null, "description": "The number of transits removed from an existing source in the current cycle", "unit": null, "ucd": "meta.number", "utype": null}, +{"name": "ipd_gof_harmonic_amplitude", "datatype": "float", "xtype": null, "arraysize": null, "description": "Amplitude of the IPD GoF versus position angle of scan", "unit": null, "ucd": "stat.value", "utype": null}, +{"name": "ipd_gof_harmonic_phase", "datatype": "float", "xtype": null, "arraysize": null, "description": "Phase of the IPD GoF versus position angle of scan", "unit": "deg", "ucd": "pos.posAng;stat.value", "utype": null}, +{"name": "ipd_frac_multi_peak", "datatype": "short", "xtype": null, "arraysize": null, "description": "Percent of successful-IPD windows with more than one peak", "unit": null, "ucd": "stat.value", "utype": null}, +{"name": "ipd_frac_odd_win", "datatype": "short", "xtype": null, "arraysize": null, "description": "Percent of transits with truncated windows or multiple gate", "unit": null, "ucd": "stat.value", "utype": null}, +{"name": "ruwe", "datatype": "float", "xtype": null, "arraysize": null, "description": "Renormalised unit weight error", "unit": null, "ucd": "stat.error", "utype": null}, +{"name": "scan_direction_strength_k1", "datatype": "float", "xtype": null, "arraysize": null, "description": "Degree of concentration of scan directions across the source", "unit": null, "ucd": "stat.value", "utype": null}, +{"name": "scan_direction_strength_k2", "datatype": "float", "xtype": null, "arraysize": null, "description": "Degree of concentration of scan directions across the source", "unit": null, "ucd": "stat.value", "utype": null}, +{"name": "scan_direction_strength_k3", "datatype": "float", "xtype": null, "arraysize": null, "description": "Degree of concentration of scan directions across the source", "unit": null, "ucd": "stat.value", "utype": null}, +{"name": "scan_direction_strength_k4", "datatype": "float", "xtype": null, "arraysize": null, "description": "Degree of concentration of scan directions across the source", "unit": null, "ucd": "stat.value", "utype": null}, +{"name": "scan_direction_mean_k1", "datatype": "float", "xtype": null, "arraysize": null, "description": "Mean position angle of scan directions across the source", "unit": "deg", "ucd": "pos.posAng;stat.mean", "utype": null}, +{"name": "scan_direction_mean_k2", "datatype": "float", "xtype": null, "arraysize": null, "description": "Mean position angle of scan directions across the source", "unit": "deg", "ucd": "pos.posAng;stat.mean", "utype": null}, +{"name": "scan_direction_mean_k3", "datatype": "float", "xtype": null, "arraysize": null, "description": "Mean position angle of scan directions across the source", "unit": "deg", "ucd": "pos.posAng;stat.mean", "utype": null}, +{"name": "scan_direction_mean_k4", "datatype": "float", "xtype": null, "arraysize": null, "description": "Mean position angle of scan directions across the source", "unit": "deg", "ucd": "pos.posAng;stat.mean", "utype": null}, +{"name": "duplicated_source", "datatype": "boolean", "xtype": null, "arraysize": null, "description": "Source with multiple source identifiers", "unit": null, "ucd": "meta.code.status", "utype": null}, +{"name": "phot_g_n_obs", "datatype": "short", "xtype": null, "arraysize": null, "description": "Number of observations contributing to G photometry", "unit": null, "ucd": "meta.number", "utype": null}, +{"name": "phot_g_mean_flux", "datatype": "double", "xtype": null, "arraysize": null, "description": "G-band mean flux", "unit": "'electron'.s**-1", "ucd": "phot.flux;em.opt", "utype": null}, +{"name": "phot_g_mean_flux_error", "datatype": "float", "xtype": null, "arraysize": null, "description": "Error on G-band mean flux", "unit": "'electron'.s**-1", "ucd": "stat.error;phot.flux;em.opt", "utype": null}, +{"name": "phot_g_mean_flux_over_error", "datatype": "float", "xtype": null, "arraysize": null, "description": "G-band mean flux divided by its error", "unit": null, "ucd": "stat.snr;phot.flux;em.opt", "utype": null}, +{"name": "phot_g_mean_mag", "datatype": "float", "xtype": null, "arraysize": null, "description": "G-band mean magnitude", "unit": "mag", "ucd": "phot.mag;em.opt", "utype": null}, +{"name": "phot_bp_n_obs", "datatype": "short", "xtype": null, "arraysize": null, "description": "Number of observations contributing to BP photometry", "unit": null, "ucd": "meta.number", "utype": null}, +{"name": "phot_bp_mean_flux", "datatype": "double", "xtype": null, "arraysize": null, "description": "Integrated BP mean flux", "unit": "'electron'.s**-1", "ucd": "phot.flux;em.opt.B", "utype": null}, +{"name": "phot_bp_mean_flux_error", "datatype": "float", "xtype": null, "arraysize": null, "description": "Error on the integrated BP mean flux", "unit": "'electron'.s**-1", "ucd": "stat.error;phot.flux;em.opt.B", "utype": null}, +{"name": "phot_bp_mean_flux_over_error", "datatype": "float", "xtype": null, "arraysize": null, "description": "Integrated BP mean flux divided by its error", "unit": null, "ucd": "stat.snr;phot.flux;em.opt.B", "utype": null}, +{"name": "phot_bp_mean_mag", "datatype": "float", "xtype": null, "arraysize": null, "description": "Integrated BP mean magnitude", "unit": "mag", "ucd": "phot.mag;em.opt.B", "utype": null}, +{"name": "phot_rp_n_obs", "datatype": "short", "xtype": null, "arraysize": null, "description": "Number of observations contributing to RP photometry", "unit": null, "ucd": "meta.number", "utype": null}, +{"name": "phot_rp_mean_flux", "datatype": "double", "xtype": null, "arraysize": null, "description": "Integrated RP mean flux", "unit": "'electron'.s**-1", "ucd": "phot.flux;em.opt.R", "utype": null}, +{"name": "phot_rp_mean_flux_error", "datatype": "float", "xtype": null, "arraysize": null, "description": "Error on the integrated RP mean flux", "unit": "'electron'.s**-1", "ucd": "stat.error;phot.flux;em.opt.R", "utype": null}, +{"name": "phot_rp_mean_flux_over_error", "datatype": "float", "xtype": null, "arraysize": null, "description": "Integrated RP mean flux divided by its error", "unit": null, "ucd": "stat.snr;phot.flux;em.opt.R", "utype": null}, +{"name": "phot_rp_mean_mag", "datatype": "float", "xtype": null, "arraysize": null, "description": "Integrated RP mean magnitude", "unit": "mag", "ucd": "phot.mag;em.opt.R", "utype": null}, +{"name": "phot_bp_rp_excess_factor", "datatype": "float", "xtype": null, "arraysize": null, "description": "BP\/RP excess factor", "unit": null, "ucd": "arith.factor;phot.flux;em.opt", "utype": null}, +{"name": "phot_bp_n_contaminated_transits", "datatype": "short", "xtype": null, "arraysize": null, "description": "Number of BP contaminated transits", "unit": null, "ucd": "meta.number", "utype": null}, +{"name": "phot_bp_n_blended_transits", "datatype": "short", "xtype": null, "arraysize": null, "description": "Number of BP blended transits", "unit": null, "ucd": "meta.number", "utype": null}, +{"name": "phot_rp_n_contaminated_transits", "datatype": "short", "xtype": null, "arraysize": null, "description": "Number of RP contaminated transits", "unit": null, "ucd": "meta.number", "utype": null}, +{"name": "phot_rp_n_blended_transits", "datatype": "short", "xtype": null, "arraysize": null, "description": "Number of RP blended transits", "unit": null, "ucd": "meta.number", "utype": null}, +{"name": "phot_proc_mode", "datatype": "short", "xtype": null, "arraysize": null, "description": "Photometry processing mode", "unit": null, "ucd": "meta.code", "utype": null}, +{"name": "bp_rp", "datatype": "float", "xtype": null, "arraysize": null, "description": "BP - RP colour", "unit": "mag", "ucd": "phot.color;em.opt.B;em.opt.R", "utype": null}, +{"name": "bp_g", "datatype": "float", "xtype": null, "arraysize": null, "description": "BP - G colour", "unit": "mag", "ucd": "phot.color;em.opt.B;em.opt", "utype": null}, +{"name": "g_rp", "datatype": "float", "xtype": null, "arraysize": null, "description": "G - RP colour", "unit": "mag", "ucd": "phot.color;em.opt;em.opt.R", "utype": null}, +{"name": "radial_velocity", "datatype": "float", "xtype": null, "arraysize": null, "description": "Radial velocity", "unit": "km.s**-1", "ucd": "spect.dopplerVeloc.opt;em.opt.I", "utype": "stc:AstroCoords.Velocity3D.Value3.C3"}, +{"name": "radial_velocity_error", "datatype": "float", "xtype": null, "arraysize": null, "description": "Radial velocity error", "unit": "km.s**-1", "ucd": "stat.error;spect.dopplerVeloc.opt;em.opt.I", "utype": "stc:AstroCoords.Velocity3D.Error3.C3"}, +{"name": "rv_method_used", "datatype": "short", "xtype": null, "arraysize": null, "description": "Method used to obtain the radial velocity", "unit": null, "ucd": "meta.code.class", "utype": null}, +{"name": "rv_nb_transits", "datatype": "short", "xtype": null, "arraysize": null, "description": "Number of transits used to compute the radial velocity", "unit": null, "ucd": "meta.number", "utype": null}, +{"name": "rv_nb_deblended_transits", "datatype": "short", "xtype": null, "arraysize": null, "description": "Number of valid transits that have undergone deblending", "unit": null, "ucd": "meta.number", "utype": null}, +{"name": "rv_visibility_periods_used", "datatype": "short", "xtype": null, "arraysize": null, "description": "Number of visibility periods used to estimate the radial velocity", "unit": null, "ucd": "meta.number", "utype": null}, +{"name": "rv_expected_sig_to_noise", "datatype": "float", "xtype": null, "arraysize": null, "description": "Expected signal to noise ratio in the combination of the spectra used to obtain the radial velocity", "unit": null, "ucd": "stat.snr", "utype": null}, +{"name": "rv_renormalised_gof", "datatype": "float", "xtype": null, "arraysize": null, "description": "Radial velocity renormalised goodness of fit", "unit": null, "ucd": "stat.fit.goodness", "utype": null}, +{"name": "rv_chisq_pvalue", "datatype": "float", "xtype": null, "arraysize": null, "description": "P-value for constancy based on a chi-squared criterion", "unit": null, "ucd": "stat.fit.param", "utype": null}, +{"name": "rv_time_duration", "datatype": "float", "xtype": null, "arraysize": null, "description": "Time coverage of the radial velocity time series", "unit": "d", "ucd": "time.duration", "utype": null}, +{"name": "rv_amplitude_robust", "datatype": "float", "xtype": null, "arraysize": null, "description": "Total amplitude in the radial velocity time series after outlier removal", "unit": "km.s**-1", "ucd": "stat.error;spect.dopplerVeloc.opt;em.opt.I", "utype": null}, +{"name": "rv_template_teff", "datatype": "float", "xtype": null, "arraysize": null, "description": "Teff of the template used to compute the radial velocity", "unit": "K", "ucd": "stat.fit.param", "utype": null}, +{"name": "rv_template_logg", "datatype": "float", "xtype": null, "arraysize": null, "description": "Logg of the template used to compute the radial velocity", "unit": "log(cm.s**-2)", "ucd": "stat.fit.param", "utype": null}, +{"name": "rv_template_fe_h", "datatype": "float", "xtype": null, "arraysize": null, "description": "[Fe\/H] of the template used to compute the radial velocityy", "unit": "'dex'", "ucd": "stat.fit.param", "utype": null}, +{"name": "rv_atm_param_origin", "datatype": "short", "xtype": null, "arraysize": null, "description": "Origin of the atmospheric parameters associated to the template", "unit": null, "ucd": "meta.code.class", "utype": null}, +{"name": "vbroad", "datatype": "float", "xtype": null, "arraysize": null, "description": "Spectral line broadening parameter", "unit": "km.s**-1", "ucd": "spect.dopplerVeloc.opt;em.opt.I", "utype": "stc:AstroCoords.Velocity3D.Value3.C3"}, +{"name": "vbroad_error", "datatype": "float", "xtype": null, "arraysize": null, "description": "Uncertainty on the spectral line broadening", "unit": "km.s**-1", "ucd": "stat.error;spect.dopplerVeloc.opt;em.opt.I", "utype": "stc:AstroCoords.Velocity3D.Error3.C3"}, +{"name": "vbroad_nb_transits", "datatype": "short", "xtype": null, "arraysize": null, "description": "Number of transits used to compute vbroad", "unit": null, "ucd": "meta.number", "utype": null}, +{"name": "grvs_mag", "datatype": "float", "xtype": null, "arraysize": null, "description": "Integrated Grvs magnitude", "unit": "mag", "ucd": "phot.mag;em.opt", "utype": "stc:AstroCoords.Velocity3D.Value3.C3"}, +{"name": "grvs_mag_error", "datatype": "float", "xtype": null, "arraysize": null, "description": "Grvs magnitude uncertainty", "unit": "mag", "ucd": "stat.error;phot.mag;em.opt", "utype": "stc:AstroCoords.Velocity3D.Error3.C3"}, +{"name": "grvs_mag_nb_transits", "datatype": "short", "xtype": null, "arraysize": null, "description": "Number of transits used to compute Grvs", "unit": null, "ucd": "meta.number", "utype": null}, +{"name": "rvs_spec_sig_to_noise", "datatype": "float", "xtype": null, "arraysize": null, "description": "Signal to noise ratio in the mean RVS spectrum", "unit": null, "ucd": "stat.snr", "utype": null}, +{"name": "phot_variable_flag", "datatype": "char", "xtype": null, "arraysize": "*", "description": "Photometric variability flag", "unit": null, "ucd": "meta.code;src.var", "utype": null}, +{"name": "l", "datatype": "double", "xtype": null, "arraysize": null, "description": "Galactic longitude", "unit": "deg", "ucd": "pos.galactic.lon", "utype": "stc:AstroCoords.Position2D.Value2.C1"}, +{"name": "b", "datatype": "double", "xtype": null, "arraysize": null, "description": "Galactic latitude", "unit": "deg", "ucd": "pos.galactic.lat", "utype": "stc:AstroCoords.Position2D.Value2.C2"}, +{"name": "ecl_lon", "datatype": "double", "xtype": null, "arraysize": null, "description": "Ecliptic longitude", "unit": "deg", "ucd": "pos.ecliptic.lon", "utype": "stc:AstroCoords.Position2D.Value2.C1"}, +{"name": "ecl_lat", "datatype": "double", "xtype": null, "arraysize": null, "description": "Ecliptic latitude", "unit": "deg", "ucd": "pos.ecliptic.lat", "utype": "stc:AstroCoords.Position2D.Value2.C2"}, +{"name": "in_qso_candidates", "datatype": "boolean", "xtype": null, "arraysize": null, "description": "Flag indicating the availability of additional information in the QSO candidates table", "unit": null, "ucd": "meta.code.status", "utype": null}, +{"name": "in_galaxy_candidates", "datatype": "boolean", "xtype": null, "arraysize": null, "description": "Flag indicating the availability of additional information in the galaxy candidates table", "unit": null, "ucd": "meta.code.status", "utype": null}, +{"name": "non_single_star", "datatype": "short", "xtype": null, "arraysize": null, "description": "Flag indicating the availability of additional information in the various Non-Single Star tables", "unit": null, "ucd": "meta.code.status", "utype": null}, +{"name": "has_xp_continuous", "datatype": "boolean", "xtype": null, "arraysize": null, "description": "Flag indicating the availability of mean BP\/RP spectrum in continuous representation for this source", "unit": null, "ucd": "meta.code.status", "utype": null}, +{"name": "has_xp_sampled", "datatype": "boolean", "xtype": null, "arraysize": null, "description": "Flag indicating the availability of mean BP\/RP spectrum in sampled form for this source", "unit": null, "ucd": "meta.code.status", "utype": null}, +{"name": "has_rvs", "datatype": "boolean", "xtype": null, "arraysize": null, "description": "Flag indicating the availability of mean RVS spectrum for this source", "unit": null, "ucd": "meta.code.status", "utype": null}, +{"name": "has_epoch_photometry", "datatype": "boolean", "xtype": null, "arraysize": null, "description": "Flag indicating the availability of epoch photometry for this source", "unit": null, "ucd": "meta.code.status", "utype": null}, +{"name": "has_epoch_rv", "datatype": "boolean", "xtype": null, "arraysize": null, "description": "Flag indicating the availability of epoch radial velocity for this source", "unit": null, "ucd": "meta.code.status", "utype": null}, +{"name": "has_mcmc_gspphot", "datatype": "boolean", "xtype": null, "arraysize": null, "description": "Flag indicating the availability of GSP-Phot MCMC samples for this source", "unit": null, "ucd": "meta.code.status", "utype": null}, +{"name": "has_mcmc_msc", "datatype": "boolean", "xtype": null, "arraysize": null, "description": "Flag indicating the availability of MSC MCMC samples for this source", "unit": null, "ucd": "meta.code.status", "utype": null}, +{"name": "in_andromeda_survey", "datatype": "boolean", "xtype": null, "arraysize": null, "description": "Flag indicating that the source is present in the Gaia Andromeda Photometric Survey (GAPS)", "unit": null, "ucd": "meta.code.status", "utype": null}, +{"name": "classprob_dsc_combmod_quasar", "datatype": "float", "xtype": null, "arraysize": null, "description": "Probability from DSC-Combmod of being a quasar (data used: BP\/RP spectrum, photometry, astrometry)", "unit": null, "ucd": "stat.probability", "utype": null}, +{"name": "classprob_dsc_combmod_galaxy", "datatype": "float", "xtype": null, "arraysize": null, "description": "Probability from DSC-Combmod of being a galaxy (data used: BP\/RP spectrum, photometry, astrometry)", "unit": null, "ucd": "stat.probability", "utype": null}, +{"name": "classprob_dsc_combmod_star", "datatype": "float", "xtype": null, "arraysize": null, "description": "Probability from DSC-Combmod of being a single star (but not a white dwarf) (data used: BP\/RP spectrum, photometry, astrometry)", "unit": null, "ucd": "stat.probability", "utype": null}, +{"name": "teff_gspphot", "datatype": "float", "xtype": null, "arraysize": null, "description": "Effective temperature from GSP-Phot Aeneas best library using BP\/RP spectra", "unit": "K", "ucd": "phys.temperature.effective", "utype": null}, +{"name": "teff_gspphot_lower", "datatype": "float", "xtype": null, "arraysize": null, "description": "Lower confidence level (16%) of effective temperature from GSP-Phot Aeneas best library using BP\/RP spectra", "unit": "K", "ucd": "phys.temperature.effective;stat.min", "utype": null}, +{"name": "teff_gspphot_upper", "datatype": "float", "xtype": null, "arraysize": null, "description": "Upper confidence level (84%) of effective temperature from GSP-Phot Aeneas best library using BP\/RP spectra", "unit": "K", "ucd": "phys.temperature.effective;stat.max", "utype": null}, +{"name": "logg_gspphot", "datatype": "float", "xtype": null, "arraysize": null, "description": "Surface gravity from GSP-Phot Aeneas best library using BP\/RP spectra", "unit": "log(cm.s**-2)", "ucd": "phys.gravity", "utype": null}, +{"name": "logg_gspphot_lower", "datatype": "float", "xtype": null, "arraysize": null, "description": "Lower confidence level (16%) of surface gravity from GSP-Phot Aeneas best library using BP\/RP spectra", "unit": "log(cm.s**-2)", "ucd": "phys.gravity;stat.min", "utype": null}, +{"name": "logg_gspphot_upper", "datatype": "float", "xtype": null, "arraysize": null, "description": "Upper confidence level (84%) of surface gravity from GSP-Phot Aeneas best library using BP\/RP spectra", "unit": "log(cm.s**-2)", "ucd": "phys.gravity;stat.max", "utype": null}, +{"name": "mh_gspphot", "datatype": "float", "xtype": null, "arraysize": null, "description": "Iron abundance from GSP-Phot Aeneas best library using BP\/RP spectra", "unit": "'dex'", "ucd": "phys.abund.Z", "utype": null}, +{"name": "mh_gspphot_lower", "datatype": "float", "xtype": null, "arraysize": null, "description": "Lower confidence level (16%) of iron abundance from GSP-Phot Aeneas best library using BP\/RP spectra", "unit": "'dex'", "ucd": "phys.abund.Z;stat.min", "utype": null}, +{"name": "mh_gspphot_upper", "datatype": "float", "xtype": null, "arraysize": null, "description": "Upper confidence level (84%) of iron abundance from GSP-Phot Aeneas best library using BP\/RP spectra", "unit": "'dex'", "ucd": "phys.abund.Z;stat.max", "utype": null}, +{"name": "distance_gspphot", "datatype": "float", "xtype": null, "arraysize": null, "description": "Distance from GSP-Phot Aeneas best library using BP\/RP spectra", "unit": "pc", "ucd": "pos.distance;pos.eq", "utype": null}, +{"name": "distance_gspphot_lower", "datatype": "float", "xtype": null, "arraysize": null, "description": "Lower confidence level (16%) of distance from GSP-Phot Aeneas best library using BP\/RP spectra", "unit": "pc", "ucd": "pos.distance;pos.eq", "utype": null}, +{"name": "distance_gspphot_upper", "datatype": "float", "xtype": null, "arraysize": null, "description": "Upper confidence level (84%) of distance from GSP-Phot Aeneas best library using BP\/RP spectra", "unit": "pc", "ucd": "pos.distance;pos.eq", "utype": null}, +{"name": "azero_gspphot", "datatype": "float", "xtype": null, "arraysize": null, "description": "Monochromatic extinction $A_0$ at 547.7nm from GSP-Phot Aeneas best library using BP\/RP spectra", "unit": "mag", "ucd": "phys.absorption;em.opt", "utype": null}, +{"name": "azero_gspphot_lower", "datatype": "float", "xtype": null, "arraysize": null, "description": "Lower confidence level (16%) of monochromatic extinction $A_0$ at 547.7nm from GSP-Phot Aeneas best library using BP\/RP spectra", "unit": "mag", "ucd": "phys.absorption;em.opt", "utype": null}, +{"name": "azero_gspphot_upper", "datatype": "float", "xtype": null, "arraysize": null, "description": "Upper confidence level (84%) of monochromatic extinction $A_0$ at 547.7nm from GSP-Phot Aeneas best library using BP\/RP spectra", "unit": "mag", "ucd": "phys.absorption;em.opt", "utype": null}, +{"name": "ag_gspphot", "datatype": "float", "xtype": null, "arraysize": null, "description": "Extinction in G band from GSP-Phot Aeneas best library using BP\/RP spectra", "unit": "mag", "ucd": "phys.absorption;em.opt", "utype": null}, +{"name": "ag_gspphot_lower", "datatype": "float", "xtype": null, "arraysize": null, "description": "Lower confidence level (16%) of extinction in G band from GSP-Phot Aeneas best library using BP\/RP spectra", "unit": "mag", "ucd": "phys.absorption;em.opt", "utype": null}, +{"name": "ag_gspphot_upper", "datatype": "float", "xtype": null, "arraysize": null, "description": "Upper confidence level (84%) of extinction in G band from GSP-Phot Aeneas best library using BP\/RP spectra", "unit": "mag", "ucd": "phys.absorption;em.opt", "utype": null}, +{"name": "ebpminrp_gspphot", "datatype": "float", "xtype": null, "arraysize": null, "description": "Reddening $E(G_{\\rm BP} - G_{\\rm RP})$ from GSP-Phot Aeneas best library using BP\/RP spectra", "unit": "mag", "ucd": "phot.color.excess", "utype": null}, +{"name": "ebpminrp_gspphot_lower", "datatype": "float", "xtype": null, "arraysize": null, "description": "Lower confidence level (16%) of reddening $E(G_{\\rm BP} - G_{\\rm RP})$ from GSP-Phot Aeneas best library using BP\/RP spectra", "unit": "mag", "ucd": "phot.color.excess;stat.min", "utype": null}, +{"name": "ebpminrp_gspphot_upper", "datatype": "float", "xtype": null, "arraysize": null, "description": "Upper confidence level (84%) of reddening $E(G_{\\rm BP} - G_{\\rm RP})$ from GSP-Phot Aeneas best library using BP\/RP spectra", "unit": "mag", "ucd": "phot.color.excess;stat.max", "utype": null}, +{"name": "libname_gspphot", "datatype": "char", "xtype": null, "arraysize": "*", "description": "Name of library that achieves the highest mean log-posterior in MCMC samples and was used to derive GSP-Phot parameters in this table", "unit": null, "ucd": "meta.note", "utype": null} +], +"data": +[ +[1636148068921376768,"Gaia DR3 5929246508730155392",5929246508730155392,1621201193,2016.0,253.45840143189537,0.016976837,-55.54049891187545,0.012418179,0.14694054668014928,0.020311432,7.2343764,4.23483,-2.950498099557908,0.022529373,-3.037819310632311,0.018195566,0.26446658,-0.1919127,-0.19468933,-0.3215499,-0.084865615,-0.27791956,-0.21187119,-0.04049796,0.19136064,0.3101828,342,0,341,1,2.1266143,382.4272,0.0,0.0,31,false,1.3904984,null,null,null,null,null,null,null,40,21,0.033828225,46,17,0,0.013221252,17.125998,0,0,1.0821289,0.07740886,0.31923917,0.18337643,0.27187717,159.91667,-14.199432,14.3716955,-31.526016,false,372,40005.03640523487,8.380025,4773.8564,14.18208,42,13911.078991967077,12.551134,1108.3523,14.98014,43,37529.41519068164,17.90942,2095.5127,13.311966,1.2858504,0,1,0,1,0,1.6681738,0.79805946,0.8701143,-43.568333,2.2433178,2,17,6,12,8.463384,null,null,896.1351,null,4250.0,1.0,-0.5,111,null,null,null,12.915816,0.09217315,11,null,"NOT_AVAILABLE",332.73929140226574,-7.397649290210553,258.9591515063782,-32.73345232890977,false,false,0,true,true,false,false,false,true,true,false,1.0205575E-13,5.097633E-13,0.99999666,4492.4077,4485.291,4501.8584,2.4468,2.4211,2.4787,-3.0E-4,-0.0038,0.0039,3140.8464,3031.6826,3232.0999,0.9538,0.9446,0.9666,0.711,0.7039,0.7209,0.373,0.3692,0.3784,"MARCS"] +] +} diff --git a/astroquery/utils/tap/xmlparser/tests/setup_package.py b/astroquery/utils/tap/xmlparser/tests/setup_package.py index 0fcbb39668..3998f2c582 100644 --- a/astroquery/utils/tap/xmlparser/tests/setup_package.py +++ b/astroquery/utils/tap/xmlparser/tests/setup_package.py @@ -21,6 +21,7 @@ def get_package_data(): paths = [os.path.join('data', '*.data'), - os.path.join('data', '*.xml') + os.path.join('data', '*.xml'), + os.path.join('data', '*.json') ] return {'astroquery.utils.tap.xmlparser.tests': paths} diff --git a/astroquery/utils/tap/xmlparser/tests/test_xmlparser.py b/astroquery/utils/tap/xmlparser/tests/test_xmlparser.py index 97ef93a49b..e419943d37 100644 --- a/astroquery/utils/tap/xmlparser/tests/test_xmlparser.py +++ b/astroquery/utils/tap/xmlparser/tests/test_xmlparser.py @@ -104,6 +104,14 @@ def test_job_results_parser(): file.close() +def test_job_results_parser_json(): + file_name = data_path('test.json') + file = open(file_name, 'rb') + result_table = utils.read_http_response(file, 'json') + assert len(result_table.columns) == 152 + file.close() + + def __check_table(table, qualifiedName, numColumns, columnsData, size_bytes=None): assert str(table.get_qualified_name()) == str(qualifiedName) c = table.columns diff --git a/astroquery/utils/tap/xmlparser/utils.py b/astroquery/utils/tap/xmlparser/utils.py index 1f6807435f..e73556cfa8 100644 --- a/astroquery/utils/tap/xmlparser/utils.py +++ b/astroquery/utils/tap/xmlparser/utils.py @@ -40,17 +40,19 @@ def read_http_response(response, output_format, *, correct_units=True): if output_format == 'json': - data = json.load(response) + # Set the file’s current position + data.seek(0) + data_json = json.load(data) - if data.get('data') and data.get('metadata'): + if data_json.get('data') and data_json.get('metadata'): column_name = [] - for name in data['metadata']: + for name in data_json['metadata']: column_name.append(name['name']) - result = Table(rows=data['data'], names=column_name, masked=True) + result = Table(rows=data_json['data'], names=column_name, masked=True) - for v in data['metadata']: + for v in data_json['metadata']: col_name = v['name'] result[col_name].unit = v['unit'] result[col_name].description = v['description']