Maps
mlpoppyns.generator.maps.axes_scaling
Adjusting bin edges for a specific scaling of the axes.
Authors:
Alberto Garcia Garcia (garciagarcia@ice.csic.es)
Michele Ronchi (ronchi@ice.csic.es)
Vanessa Graber (graber@ice.csic.es)
check_range_above_zero(r_range)
Check that a range larger than zero is provided.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r_range
|
Tuple[float, float]
|
Range of values for the r coordinate to be checked. |
required |
Source code in mlpoppyns/generator/maps/axes_scaling.py
16 17 18 19 20 21 22 23 24 25 | |
log_scale_vs_linear_scale(x_range, y_range, x_log_scale, y_log_scale, n_x_bins, n_y_bins)
Determine the edge positions of the bins in x and y direction according to the choice of scale, i.e., log scale vs linear scale, for a given number of bins in both directions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_range
|
Tuple[float, float]
|
Horizontal range of values for the points. |
required |
y_range
|
Tuple[float, float]
|
Vertical range of values for the points. |
required |
x_log_scale
|
bool
|
If True set the x-axis scale to log scale. |
required |
y_log_scale
|
bool
|
If True set the y-axis scale to log scale. |
required |
n_x_bins
|
int
|
Number of horizontal bins for the density map. |
required |
n_y_bins
|
int
|
Number of vertical bins for the density map. |
required |
Returns:
| Type | Description |
|---|---|
Tuple[float, float]
|
Edges of the bins in x and y direction according to the chosen scale. |
Source code in mlpoppyns/generator/maps/axes_scaling.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | |
mlpoppyns.generator.maps.maps2d_generator
Dataset generator functions for 2D maps.
Authors:
Alberto Garcia Garcia (garciagarcia@ice.csic.es)
Michele Ronchi (ronchi@ice.csic.es)
Vanessa Graber (graber@ice.csic.es)
Celsa Pardo Araujo (pardo@ice.csic.es)
generate_avg_fluxes_map(x, x_range, y, y_range, w, filename, x_log_scale=False, y_log_scale=False, n_x_bins=32, n_y_bins=32, colormap='Greys')
Average fluxes map generator.
Creates a map of the average weight w of a distribution of points given their X/Y coordinates in a 2D space where w is the log10 of the radio flux. The resulting map shows the average value of the weights in each bin.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
ndarray
|
Horizontal coordinate values for the points. |
required |
x_range
|
Tuple[float, float]
|
Horizontal range of values for the points. |
required |
y
|
ndarray
|
Vertical coordinate values for the points. |
required |
y_range
|
Tuple[float, float]
|
Vertical range of values for the points. |
required |
w
|
ndarray
|
Weight values for the points, i.e., the log10 of the radio flux value. |
required |
filename
|
str
|
File path to generate the heat map image. |
required |
x_log_scale
|
bool
|
If True set the x-axis scale to log scale. Default False. |
False
|
y_log_scale
|
bool
|
If True set the y-axis scale to log scale. Default False. |
False
|
n_x_bins
|
int
|
Number of horizontal bins for the weight map. Default 32 bins. |
32
|
n_y_bins
|
int
|
Number of vertical bins for the weight map. Default 32 bins. |
32
|
colormap
|
str
|
Colormap to use for the image. Default Greys. |
'Greys'
|
Source code in mlpoppyns/generator/maps/maps2d_generator.py
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 | |
generate_avg_fluxes_matrix(x, x_range, y, y_range, w, filename, x_log_scale=False, y_log_scale=False, n_x_bins=32, n_y_bins=32)
Average log10 fluxes matrix generator.
Creates a matrix of the average weight w of a distribution of points given their X/Y coordinates in a 2D space, where w is the log10 of the radio flux. The resulting matrix shows the average value of the weights in each bin.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
ndarray
|
Horizontal coordinate values for the points. |
required |
x_range
|
Tuple[float, float]
|
Horizontal range of values for the points. |
required |
y
|
ndarray
|
Vertical coordinate values for the points. |
required |
y_range
|
Tuple[float, float]
|
Vertical range of values for the points. |
required |
w
|
ndarray
|
Weight values for the points, i.e., the log10 of the radio flux value. |
required |
filename
|
str
|
File path to generate the density matrix. |
required |
x_log_scale
|
bool
|
If True set the x-axis scale to log scale. Default False. |
False
|
y_log_scale
|
bool
|
If True set the y-axis scale to log scale. Default False. |
False
|
n_x_bins
|
int
|
Number of horizontal bins for the density matrix. Default 32 bins. |
32
|
n_y_bins
|
int
|
Number of vertical bins for the density matrix. Default 32 bins. |
32
|
Source code in mlpoppyns/generator/maps/maps2d_generator.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 | |
generate_avg_weight_map(x, x_range, y, y_range, w, filename, x_log_scale=False, y_log_scale=False, n_x_bins=128, n_y_bins=128, colormap='Greys')
Average weighted map generator.
Creates a map of the average weight w of a distribution of points given their X/Y coordinates in a 2D space. The resulting map shows the average value of the weights in each bin.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
ndarray
|
Horizontal coordinate values for the points. |
required |
x_range
|
Tuple[float, float]
|
Horizontal range of values for the points. |
required |
y
|
ndarray
|
Vertical coordinate values for the points. |
required |
y_range
|
Tuple[float, float]
|
Vertical range of values for the points. |
required |
w
|
ndarray
|
Weight values for the points. |
required |
filename
|
str
|
File path to generate the heat map image. |
required |
x_log_scale
|
bool
|
If True set the x-axis scale to log scale. |
False
|
y_log_scale
|
bool
|
If True set the y-axis scale to log scale. |
False
|
n_x_bins
|
int
|
Number of horizontal bins for the weight map. |
128
|
n_y_bins
|
int
|
Number of vertical bins for the weight map. |
128
|
colormap
|
str
|
Colormap to use for the image. |
'Greys'
|
Source code in mlpoppyns/generator/maps/maps2d_generator.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | |
generate_avg_weight_matrix(x, x_range, y, y_range, w, filename, x_log_scale=False, y_log_scale=False, n_x_bins=32, n_y_bins=32)
Average weighted matrix generator.
Creates a matrix of the average weight w of a distribution of points given their X/Y coordinates in a 2D space. The resulting matrix shows the average value of the weights in each bin.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
ndarray
|
Horizontal coordinate values for the points. |
required |
x_range
|
Tuple[float, float]
|
Horizontal range of values for the points. |
required |
y
|
ndarray
|
Vertical coordinate values for the points. |
required |
y_range
|
Tuple[float, float]
|
Vertical range of values for the points. |
required |
w
|
ndarray
|
Weight values for the points. |
required |
filename
|
str
|
File path to generate the density matrix. |
required |
x_log_scale
|
bool
|
If True set the x-axis scale to log scale. |
False
|
y_log_scale
|
bool
|
If True set the y-axis scale to log scale. |
False
|
n_x_bins
|
int
|
Number of horizontal bins for the density matrix. |
32
|
n_y_bins
|
int
|
Number of vertical bins for the density matrix. |
32
|
Source code in mlpoppyns/generator/maps/maps2d_generator.py
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | |
generate_density_map(x, x_range, y, y_range, filename, x_log_scale=False, y_log_scale=False, n_x_bins=128, n_y_bins=128, colormap='Greys')
Density map generator.
Creates a density or heat map of a distribution of points given their X/Y coordinates in a 2D space. The resulting image is generated in the specified file path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
ndarray
|
Horizontal coordinate values for the points. |
required |
x_range
|
Tuple[float, float]
|
Horizontal range of values for the points. |
required |
y
|
ndarray
|
Vertical coordinate values for the points. |
required |
y_range
|
Tuple[float, float]
|
Vertical range of values for the points. |
required |
filename
|
str
|
File path to generate the density map image. |
required |
x_log_scale
|
bool
|
If True set the x-axis scale to log scale. |
False
|
y_log_scale
|
bool
|
If True set the y-axis scale to log scale. |
False
|
n_x_bins
|
int
|
Number of horizontal bins for the density map. |
128
|
n_y_bins
|
int
|
Number of vertical bins for the density map. |
128
|
colormap
|
str
|
Colormap to use for the image. |
'Greys'
|
Source code in mlpoppyns/generator/maps/maps2d_generator.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | |
generate_density_matrix(x, x_range, y, y_range, filename, x_log_scale=False, y_log_scale=False, n_x_bins=128, n_y_bins=128)
Density matrix generator.
Creates a density matrix of a distribution of points given their X/Y coordinates in a 2D space. The resulting matrix is saved as .npy file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
ndarray
|
Horizontal coordinate values for the points. |
required |
x_range
|
Tuple[float, float]
|
Horizontal range of values for the points. |
required |
y
|
ndarray
|
Vertical coordinate values for the points. |
required |
y_range
|
Tuple[float, float]
|
Vertical range of values for the points. |
required |
filename
|
str
|
File path to generate the density matrix. |
required |
x_log_scale
|
bool
|
If True set the x-axis scale to log scale. |
False
|
y_log_scale
|
bool
|
If True set the y-axis scale to log scale. |
False
|
n_x_bins
|
int
|
Number of horizontal bins for the density matrix. |
128
|
n_y_bins
|
int
|
Number of vertical bins for the density matrix. |
128
|
Source code in mlpoppyns/generator/maps/maps2d_generator.py
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
mlpoppyns.generator.maps.position_maps
Position maps generation routines.
Authors:
Alberto Garcia Garcia (garciagarcia@ice.csic.es)
Michele Ronchi (ronchi@ice.csic.es)
Vanessa Graber (graber@ice.csic.es)
generate_position_map(dataset_path, map_name, sample_number, map_type, x_positions, y_positions, x_resolution, y_resolution, position_maps_dictionary, x_limits=(-20.0, 20.0), y_limits=(-20.0, 20.0))
This method generates a discrete position map with great flexibility, the dimensions of the map can be chosen, the type (image or array) can also be decided, and the limits and resolution for it can be specified. As a result, a map with the specified filename and an extension determined by the chosen type is created as output.
The dictionary of position maps for the dataset is also updated with the generated example.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset_path
|
str
|
Path to the folder where the map will be created. |
required |
map_name
|
str
|
Specific name for this map. |
required |
sample_number
|
int
|
Number to suffix this map in the dataset. |
required |
map_type
|
str
|
Type of map to generate (array or image). |
required |
x_positions
|
array
|
Positions in the first axis (horizontal). |
required |
y_positions
|
array
|
Positions in the second axis (vertical). |
required |
x_resolution
|
int
|
Resolution in the horizontal axis. |
required |
y_resolution
|
int
|
Resolution in the vertical axis. |
required |
position_maps_dictionary
|
dict
|
Partial dictionary of position maps. |
required |
x_limits
|
Tuple[float, float]
|
Limits of the horizontal axis. |
(-20.0, 20.0)
|
y_limits
|
Tuple[float, float]
|
Limits of the vertical axis. |
(-20.0, 20.0)
|
Source code in mlpoppyns/generator/maps/position_maps.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | |
mlpoppyns.generator.maps.ppdot_maps
P-Pdot maps generation routines.
Authors:
Alberto Garcia Garcia (garciagarcia@ice.csic.es)
Michele Ronchi (ronchi@ice.csic.es)
Vanessa Graber (graber@ice.csic.es)
generate_ppdot_map(dataset_path, map_name, sample_number, map_type, periods, period_derivatives, p_resolution, pdot_resolution, ppdot_maps_dictionary, p_limits=(0.001, 100.0), pdot_limits=(1e-21, 1e-09))
This method generates a discrete P-Pdot diagram map with great flexibility, the dimensions of the map can be chosen, the type (image or array) can also be decided, and the limits and resolution for it can be specified. As a result, a map with the specified filename and an extension determined by the chosen type is created as output.
The dictionary of P-Pdot maps for the dataset is also updated with the generated example.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset_path
|
str
|
Path to the folder where the map will be created. |
required |
map_name
|
str
|
Specific name for this map. |
required |
sample_number
|
int
|
Number to suffix this map in the dataset. |
required |
map_type
|
str
|
Type of map to generate (array or image). |
required |
periods
|
array
|
Spin periods of the neutron stars (horizontal axis). |
required |
period_derivatives
|
array
|
Spin period derivatives of the neutron stars (vertical axis). |
required |
p_resolution
|
int
|
Resolution in the horizontal axis. |
required |
pdot_resolution
|
int
|
Resolution in the vertical axis. |
required |
ppdot_maps_dictionary
|
dict
|
Partial dictionary of P-Pdot maps. |
required |
p_limits
|
Tuple[float, float]
|
Limits of the horizontal axis. |
(0.001, 100.0)
|
pdot_limits
|
Tuple[float, float]
|
Limits of the vertical axis. |
(1e-21, 1e-09)
|
Source code in mlpoppyns/generator/maps/ppdot_maps.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | |
mlpoppyns.generator.maps.velocity_maps
Velocity maps generation routines.
Authors:
Alberto Garcia Garcia (garciagarcia@ice.csic.es)
Michele Ronchi (ronchi@ice.csic.es)
Vanessa Graber (graber@ice.csic.es)
generate_velocity_map(dataset_path, map_name, sample_number, map_type, x_positions, y_positions, velocities, x_resolution, y_resolution, velocity_maps_dictionary, x_limits=(-20.0, 20.0), y_limits=(-20.0, 20.0))
This method generates a discrete velocity map with great flexibility, the dimensions of the map can be chosen, the type (image or array) can also be decided, and the limits and resolution for it can be specified. As a result, a map with the specified filename and an extension determined by the chosen type is created as output.
The dictionary of velocity maps for the dataset is also updated with the generated example.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset_path
|
str
|
Path to the folder where the map will be created. |
required |
map_name
|
str
|
Specific name for this map. |
required |
sample_number
|
int
|
Number to suffix this map in the dataset. |
required |
map_type
|
str
|
Type of map to generate (array or image). |
required |
x_positions
|
array
|
Positions in the first axis (horizontal). |
required |
y_positions
|
array
|
Positions in the second axis (vertical). |
required |
velocities
|
array
|
Array of velocities to put in the map. |
required |
x_resolution
|
int
|
Resolution in the horizontal axis. |
required |
y_resolution
|
int
|
Resolution in the vertical axis. |
required |
velocity_maps_dictionary
|
dict
|
Dictionary of velocity maps. |
required |
x_limits
|
Tuple[float, float]
|
Limits of the horizontal axis. |
(-20.0, 20.0)
|
y_limits
|
Tuple[float, float]
|
Limits of the vertical axis. |
(-20.0, 20.0)
|
Source code in mlpoppyns/generator/maps/velocity_maps.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | |