@@ -67,23 +67,28 @@ def flat(test_data):
6767 flat ["equilibrium.time_slice.profiles_2d.psi" ][:] = test_data ["equilibrium" ]["psi_2d" ][None , ...]
6868
6969 # Thomson scattering test data (ragged)
70+ N = test_data ["thomson_scattering" ]["N_ch" ][0 ] + test_data ["thomson_scattering" ]["N_ch" ][1 ]
7071 flat ["thomson_scattering.ids_properties.homogeneous_time" ] = 0
7172 flat ["thomson_scattering.channel.t_e.time" ] = ak .concatenate ([np .tile (test_data ["thomson_scattering" ]["time" ][0 ],
72- (test_data ["thomson_scattering" ]["N_ch" ][0 ],1 )),
73+ (test_data ["thomson_scattering" ]["N_ch" ][0 ],
74+ 1 )),
7375 np .tile (test_data ["thomson_scattering" ]["time" ][1 ],
74- (test_data ["thomson_scattering" ]["N_ch" ][1 ],1 ))])
75- flat ["thomson_scattering.channel.t_e.data" ] = ak .concatenate ([np .tile (test_data ["thomson_scattering" ]["t_e" ][0 ],
76- (test_data ["thomson_scattering" ]["N_ch" ][0 ],1 )),
77- np .tile (test_data ["thomson_scattering" ]["t_e" ][1 ],
78- (test_data ["thomson_scattering" ]["N_ch" ][1 ],1 ))])
76+ (test_data ["thomson_scattering" ]["N_ch" ][1 ],
77+ 1 ))])
78+ flat ["thomson_scattering.channel.t_e.data" ] = ak .concatenate ([np .repeat (test_data ["thomson_scattering" ]["t_e" ][:test_data ["thomson_scattering" ]["N_ch" ][0 ],None ],
79+ test_data ["thomson_scattering" ]["N_time" ][0 ], axis = 1 ),
80+ np .repeat (test_data ["thomson_scattering" ]["t_e" ][test_data ["thomson_scattering" ]["N_ch" ][0 ]:,None ],
81+ test_data ["thomson_scattering" ]["N_time" ][1 ], axis = 1 )])
7982 flat ["thomson_scattering.channel.n_e.time" ] = ak .concatenate ([np .tile (test_data ["thomson_scattering" ]["time" ][0 ],
80- (test_data ["thomson_scattering" ]["N_ch" ][0 ],1 )),
83+ (test_data ["thomson_scattering" ]["N_ch" ][0 ],
84+ 1 )),
8185 np .tile (test_data ["thomson_scattering" ]["time" ][1 ],
82- (test_data ["thomson_scattering" ]["N_ch" ][1 ],1 ))])
83- flat ["thomson_scattering.channel.n_e.data" ] = ak .concatenate ([np .tile (test_data ["thomson_scattering" ]["n_e" ][0 ],
84- (test_data ["thomson_scattering" ]["N_ch" ][0 ],1 )),
85- np .tile (test_data ["thomson_scattering" ]["n_e" ][1 ],
86- (test_data ["thomson_scattering" ]["N_ch" ][1 ],1 ))])
86+ (test_data ["thomson_scattering" ]["N_ch" ][1 ],
87+ 1 ))])
88+ flat ["thomson_scattering.channel.n_e.data" ] = ak .concatenate ([np .repeat (test_data ["thomson_scattering" ]["n_e" ][:test_data ["thomson_scattering" ]["N_ch" ][0 ],None ],
89+ test_data ["thomson_scattering" ]["N_time" ][0 ], axis = 1 ),
90+ np .repeat (test_data ["thomson_scattering" ]["n_e" ][test_data ["thomson_scattering" ]["N_ch" ][0 ]:,None ],
91+ test_data ["thomson_scattering" ]["N_time" ][1 ], axis = 1 )])
8792 flat ["thomson_scattering.channel.position.r" ] = test_data ["thomson_scattering" ]["r" ]
8893 flat ["thomson_scattering.channel.position.z" ] = test_data ["thomson_scattering" ]["z" ]
8994 return flat
@@ -115,7 +120,7 @@ def test_ids_dict(test_data):
115120 thomson_scattering .channel [i ].t_e .data = np .tile (test_data ["thomson_scattering" ]["t_e" ][i ],
116121 test_data ["thomson_scattering" ]["N_time" ][index ])
117122 thomson_scattering .channel [i ].n_e .time = test_data ["thomson_scattering" ]["time" ][index ]
118- thomson_scattering .channel [i ].n_e .data = np .tile (test_data ["thomson_scattering" ]["t_e " ][i ],
123+ thomson_scattering .channel [i ].n_e .data = np .tile (test_data ["thomson_scattering" ]["n_e " ][i ],
119124 test_data ["thomson_scattering" ]["N_time" ][index ])
120125 thomson_scattering .channel [i ].position .r = test_data ["thomson_scattering" ]["r" ][i ]
121126 thomson_scattering .channel [i ].position .z = test_data ["thomson_scattering" ]["z" ][i ]
@@ -132,4 +137,4 @@ def test_wrangle(test_ids_dict, flat):
132137def test_unwrangle (test_ids_dict , flat ):
133138 result = unwrangle (list (flat .keys ()), test_ids_dict )
134139 for key in flat .keys ():
135- np . testing . assert_allclose (result [key ], flat [key ])
140+ assert ak . almost_equal (result [key ], flat [key ])
0 commit comments