hzovaro / spaxelsleuth

A package for analysing data from large integral field unit surveys such as the SAMI and Hector Galaxy Surveys.
MIT License
1 stars 1 forks source link

KeyError for col_x in plot2dhistcontours when col_z is "BPT (total)" #21

Closed hzovaro closed 10 months ago

hzovaro commented 10 months ago

As per title. Code works fine if colz is "count" or another column, e.g. "sigma" or "Morphology" but not when it is "BPT (total)". Technically this should* throw an error because in this instance, we are plotting component-wise measurements which do not exist for BPT classifications, but a specific exception should be thrown to indicate that this is the case, as the present one isn't terribly helpful.

MWE:

df = load_sami_df(ncomponents="recom",
                  bin_type="default",
                  eline_SNR_min=5,
                  eline_ANR_min=3,
                  correct_extinction=True)

col_x = "log sigma_gas"
col_y = "log HALPHA EW"
col_z = "BPT (total)"
fig, axs = plt.subplots(nrows=2, ncols=3, figsize=(20, 10))
fig.subplots_adjust(wspace=0.4, hspace=0.3)
plot2dhistcontours(df, col_x=col_x, col_y=col_y, col_z=col_z, ax=axs[0][1])
hzovaro commented 10 months ago

Fixed. Issue was that the input DataFrame was being passed to _histhelper() rather than df_sub.