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

Bug in make_s7_df() when running on the full sample #19

Closed hzovaro closed 10 months ago

hzovaro commented 11 months ago

Error as below:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
[/home/u5708159/python/Modules/ppxftests/scripts/s7/Examples](https://vscode-remote+ssh-002dremote-002bmisfit-002eanu-002eedu-002eau.vscode-resource.vscode-cdn.net/home/u5708159/python/Modules/ppxftests/scripts/s7/Examples) - S7.ipynb Cell 5 line 1
----> [1](vscode-notebook-cell://ssh-remote%2Bmisfit.anu.edu.au/home/u5708159/python/Modules/ppxftests/scripts/s7/Examples%20-%20S7.ipynb#X12sdnNjb2RlLXJlbW90ZQ%3D%3D?line=0) make_s7_df(
      [2](vscode-notebook-cell://ssh-remote%2Bmisfit.anu.edu.au/home/u5708159/python/Modules/ppxftests/scripts/s7/Examples%20-%20S7.ipynb#X12sdnNjb2RlLXJlbW90ZQ%3D%3D?line=1)             eline_SNR_min=3,
      [3](vscode-notebook-cell://ssh-remote%2Bmisfit.anu.edu.au/home/u5708159/python/Modules/ppxftests/scripts/s7/Examples%20-%20S7.ipynb#X12sdnNjb2RlLXJlbW90ZQ%3D%3D?line=2)             eline_ANR_min=3,
      [4](vscode-notebook-cell://ssh-remote%2Bmisfit.anu.edu.au/home/u5708159/python/Modules/ppxftests/scripts/s7/Examples%20-%20S7.ipynb#X12sdnNjb2RlLXJlbW90ZQ%3D%3D?line=3)             correct_extinction=True,
      [5](vscode-notebook-cell://ssh-remote%2Bmisfit.anu.edu.au/home/u5708159/python/Modules/ppxftests/scripts/s7/Examples%20-%20S7.ipynb#X12sdnNjb2RlLXJlbW90ZQ%3D%3D?line=4)             metallicity_diagnostics=["N2Ha_PP04",],
      [6](vscode-notebook-cell://ssh-remote%2Bmisfit.anu.edu.au/home/u5708159/python/Modules/ppxftests/scripts/s7/Examples%20-%20S7.ipynb#X12sdnNjb2RlLXJlbW90ZQ%3D%3D?line=5)             nthreads=1)

File [~/python/Modules/spaxelsleuth/spaxelsleuth/loaddata/s7.py:681](https://vscode-remote+ssh-002dremote-002bmisfit-002eanu-002eedu-002eau.vscode-resource.vscode-cdn.net/home/u5708159/python/Modules/ppxftests/scripts/s7/~/python/Modules/spaxelsleuth/spaxelsleuth/loaddata/s7.py:681), in make_s7_df(eline_SNR_min, eline_ANR_min, correct_extinction, gals, sigma_gas_SNR_min, line_flux_SNR_cut, missing_fluxes_cut, line_amplitude_SNR_cut, flux_fraction_cut, sigma_gas_SNR_cut, vgrad_cut, metallicity_diagnostics, nthreads)
    679 colnames = res_list[0][1]
    680 eline_list = res_list[0][2]
--> 681 df_spaxels = pd.DataFrame(np.vstack(tuple(rows_list_all)),
    682                           columns=colnames)
    684 # Cast to float data types
    685 for col in [c for c in df_spaxels.columns if c != "ID"]:
    686     # Check if column values can be cast to float

File [~/.conda/envs/py310/lib/python3.10/site-packages/numpy/core/shape_base.py:289](https://vscode-remote+ssh-002dremote-002bmisfit-002eanu-002eedu-002eau.vscode-resource.vscode-cdn.net/home/u5708159/python/Modules/ppxftests/scripts/s7/~/.conda/envs/py310/lib/python3.10/site-packages/numpy/core/shape_base.py:289), in vstack(tup, dtype, casting)
    287 if not isinstance(arrs, list):
    288     arrs = [arrs]
--> 289 return _nx.concatenate(arrs, 0, dtype=dtype, casting=casting)

ValueError: all the input array dimensions except for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 85 and the array at index 1 has size 99
hzovaro commented 10 months ago

Accidentally closed the wrong issue...

hzovaro commented 10 months ago

The issue was because some galaxies are missing LZIFU outputs for certain emission lines and for other products (specifically for 3C278 and one of the PKS sources). This introduced a secondary bug where in some cases a truncated list of emission lines was being passed to add_columns(). It has been fixed by monitoring the number of columns returned by _process_s7().