Modifying the indices table

In this tutorial we will modify the indices table to include an array of indices with different bandpasses.

We will include in the table a modified version of the H\(\alpha\) index using central bandpasses between 1.6 and 2.0 angtroms but the same reference lines as the original.

[1]:
import numpy as np

from actin2 import ACTIN
actin = ACTIN()

The pandas DataFrame table with the activity indices line parameters is in the method table inside the class actin.Indtable:

[2]:
indtable = actin.IndTable()
table = indtable.table

table
[2]:
ind_id ind_var ln_id ln_c ln_ctr ln_win bandtype
0 I_CaII L1 CaIIK 1.0 3933.664 1.09 tri
1 I_CaII L2 CaIIH 1.0 3968.470 1.09 tri
2 I_CaII R1 CaIIR1 1.0 3901.070 20.00 sq
3 I_CaII R2 CaIIR2 1.0 4001.070 20.00 sq
4 I_NaI L1 NaID1 1.0 5895.920 0.50 sq
5 I_NaI L2 NaID2 1.0 5889.950 0.50 sq
6 I_NaI R1 NaIR1 1.0 5805.000 10.00 sq
7 I_NaI R2 NaIR2 1.0 6097.000 20.00 sq
8 I_Ha16 L1 Ha16 1.0 6562.808 1.60 sq
9 I_Ha16 R1 HaR1 1.0 6550.870 10.75 sq
10 I_Ha16 R2 HaR2 1.0 6580.310 8.75 sq
11 I_Ha06 L1 Ha06 1.0 6562.808 0.60 sq
12 I_Ha06 R1 HaR1 1.0 6550.870 10.75 sq
13 I_Ha06 R2 HaR2 1.0 6580.310 8.75 sq
14 I_HeI L1 HeI 1.0 5875.620 0.40 sq
15 I_HeI R1 HeIR1 1.0 5869.000 5.00 sq
16 I_HeI R2 HeIR2 1.0 5881.000 5.00 sq
17 I_CaI L1 CaI 1.0 6572.795 0.34 tri
18 I_CaI R1 HaR1 1.0 6550.870 10.75 sq
19 I_CaI R2 HaR2 1.0 6580.310 8.75 sq

The columns of the table are as follows: - ind_id: The index identification. For the spectral lines to be assigned to an index, their ind_id entries must have the same index ID. - ind_var: The identification of the line in the index equation: L1, L2, etc, for activity lines (numerator); R1, R2, etc, for reference lines (denominator) - ln_id: The spectral line identification. - ln_c: Constant to be multiplied to the flux in each line. - ln_ctr: Line centre (in angstroms). - ln_win: Bandwidth (in angstroms). - bandtype: Function used to integrate the flux in the bandpass: ‘sq’ for square; ‘tri’ for triangular. If using the triangular bandpass, ‘ln_win’ will be full-width-half-maximum of the bandpass.

So, we will need to give a new index ID to the modified version of the central H\(\alpha\) line and add the H\(\alpha\) reference lines to that index ID.

We will add new lines using the IndTable function add_line which have as arguments the keys in the IndTable.table, i.e., ind_id, ind_var, ln_id, etc.

We can get the reference bands parameters using

[3]:

mask = (table.ln_id=='HaR1') & (table.ind_id=='I_Ha16') r1_params = table[mask].to_dict('records')[0] del r1_params['ind_id'] mask = (table.ln_id=='HaR2') & (table.ind_id=='I_Ha16') r2_params = table[mask].to_dict('records')[0] del r2_params['ind_id']

We deleted the entries with the ind_id because we will give them a new name.

The H\(\alpha\) line centre is:

[4]:
ln_ctr = table[table.ln_id=='Ha16'].ln_ctr.values[0]

Now, we create grid of values for the central bandpass

[5]:
pass_grid = np.arange(1.6, 2.1, 0.1)

And finally loop over the values to create the index IDs and lines

[6]:
for i, ln_win in enumerate(pass_grid[:]):

    ind_id = f"I_HaMod{ln_win:.1f}"
    indtable.add_line(ind_id, "L1", f"Ha{ln_win:.1f}", 1.0, ln_ctr, ln_win, "sq")
    indtable.add_line(ind_id, **r1_params)
    indtable.add_line(ind_id, **r2_params)

The table now includes the new I_HaMod indices with the different bandpasses:

[7]:
indtable.table
[7]:
ind_id ind_var ln_id ln_c ln_ctr ln_win bandtype
0 I_CaII L1 CaIIK 1.0 3933.664 1.09 tri
1 I_CaII L2 CaIIH 1.0 3968.470 1.09 tri
2 I_CaII R1 CaIIR1 1.0 3901.070 20.00 sq
3 I_CaII R2 CaIIR2 1.0 4001.070 20.00 sq
4 I_NaI L1 NaID1 1.0 5895.920 0.50 sq
5 I_NaI L2 NaID2 1.0 5889.950 0.50 sq
6 I_NaI R1 NaIR1 1.0 5805.000 10.00 sq
7 I_NaI R2 NaIR2 1.0 6097.000 20.00 sq
8 I_Ha16 L1 Ha16 1.0 6562.808 1.60 sq
9 I_Ha16 R1 HaR1 1.0 6550.870 10.75 sq
10 I_Ha16 R2 HaR2 1.0 6580.310 8.75 sq
11 I_Ha06 L1 Ha06 1.0 6562.808 0.60 sq
12 I_Ha06 R1 HaR1 1.0 6550.870 10.75 sq
13 I_Ha06 R2 HaR2 1.0 6580.310 8.75 sq
14 I_HeI L1 HeI 1.0 5875.620 0.40 sq
15 I_HeI R1 HeIR1 1.0 5869.000 5.00 sq
16 I_HeI R2 HeIR2 1.0 5881.000 5.00 sq
17 I_CaI L1 CaI 1.0 6572.795 0.34 tri
18 I_CaI R1 HaR1 1.0 6550.870 10.75 sq
19 I_CaI R2 HaR2 1.0 6580.310 8.75 sq
20 I_HaMod1.6 L1 Ha1.6 1.0 6562.808 1.60 sq
21 I_HaMod1.6 R1 HaR1 1.0 6550.870 10.75 sq
22 I_HaMod1.6 R2 HaR2 1.0 6580.310 8.75 sq
23 I_HaMod1.7 L1 Ha1.7 1.0 6562.808 1.70 sq
24 I_HaMod1.7 R1 HaR1 1.0 6550.870 10.75 sq
25 I_HaMod1.7 R2 HaR2 1.0 6580.310 8.75 sq
26 I_HaMod1.8 L1 Ha1.8 1.0 6562.808 1.80 sq
27 I_HaMod1.8 R1 HaR1 1.0 6550.870 10.75 sq
28 I_HaMod1.8 R2 HaR2 1.0 6580.310 8.75 sq
29 I_HaMod1.9 L1 Ha1.9 1.0 6562.808 1.90 sq
30 I_HaMod1.9 R1 HaR1 1.0 6550.870 10.75 sq
31 I_HaMod1.9 R2 HaR2 1.0 6580.310 8.75 sq
32 I_HaMod2.0 L1 Ha2.0 1.0 6562.808 2.00 sq
33 I_HaMod2.0 R1 HaR1 1.0 6550.870 10.75 sq
34 I_HaMod2.0 R2 HaR2 1.0 6580.310 8.75 sq

This table can be used as input in ACTIN using the option table_df.

To save the new table as .csv file to the same folder as this file uncomment the lines below:

[8]:
#file_path = os.path.join(os.path.dirname(__file__), "new_indtable.csv")
#indtable.save_table(file_path)