Skip to content

Commit

Permalink
finished quality map function
Browse files Browse the repository at this point in the history
  • Loading branch information
lsajkov committed Jul 22, 2024
1 parent 537379c commit 9e27666
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 1,078 deletions.
Binary file modified __pycache__/mpdg_som.cpython-312.pyc
Binary file not shown.
1,114 changes: 46 additions & 1,068 deletions mpdg_run_som_KiDS_GAMA.ipynb

Large diffs are not rendered by default.

24 changes: 14 additions & 10 deletions mpdg_som.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,26 +444,30 @@ def produce_quality_map(self,

quality_map = np.full([*self.mapsize, self.labeling_data_dim - self.data_dim], np.nan)

for cell, _ in np.ndenumerate(quality_map):
for cell, _ in np.ndenumerate(quality_map[..., 0]):
for i in range(self.labeling_data_dim - self.data_dim):
try:
param_phot = np.mean(self.data[self.indexed_map[*[5, 10]], self.data_dim - 1 + i])
param_phot = np.mean(self.data[self.indexed_map[*cell], self.data_dim - 1 + i])
param_spec = np.mean(self.labeled_map_values[*cell, i, 0])

quality_map[*cell, i] = np.abs(param_spec - param_phot)
except:
continue

# if show_map:
if show_map:

# fig = plt.figure(figsize = (9.6, 8), constrained_layout = True)
# ax = fig.add_subplot()
# qual_mp = ax.imshow(quality_map,
# origin = 'lower', cmap = cmap)
# ax.axis('off')
fig = plt.figure(figsize = (10, 5 * (self.labeling_data_dim - self.data_dim)),
constrained_layout = True)

for i in range(self.labeling_data_dim - self.data_dim):
ax = fig.add_subplot(1, self.labeling_data_dim - self.data_dim, i + 1)

qual_mp = ax.imshow(quality_map[..., i],
origin = 'lower', cmap = cmap)
ax.axis('off')

# fig.colorbar(mappable = qual_mp, location = 'bottom', fraction = 1, shrink = 0.66, pad = 0.005,
# label = f'')
fig.colorbar(mappable = qual_mp, location = 'bottom', fraction = 1, shrink = 0.66, pad = 0.005,
label = self.parameter_names[i])

# if save_fig:
# fig.savefig(f'{save_path}/SOM_quality_map')
Expand Down

0 comments on commit 9e27666

Please # to comment.