Fix plotting X/Y range bug
This commit is contained in:
+7
-7
@@ -8,9 +8,9 @@ from matplotlib import pyplot as plt
|
||||
import numpy as np
|
||||
import h5py
|
||||
|
||||
torch.manual_seed(42)
|
||||
torch.cuda.manual_seed(42)
|
||||
np.random.seed(42)
|
||||
torch.manual_seed(0)
|
||||
torch.cuda.manual_seed(0)
|
||||
np.random.seed(0)
|
||||
torch.backends.cudnn.deterministic = True
|
||||
torch.backends.cudnn.benchmark = False
|
||||
|
||||
@@ -19,7 +19,7 @@ NX, NY = 400, 400
|
||||
configs = {}
|
||||
configs['SiemenStarLowerLeft'] = {
|
||||
# 'dataFiles': [f'/mnt/sls_det_storage/moench_data/MLXID/Samples/Measurement/2504_SOLEIL_SiemenStarClusters_MOENCH040_150V/SiemenStarLowerLeft/clusters_chunk{i}.h5' for i in range(1)], # 200 files, no zeroing pixels outside the cluster
|
||||
'dataFiles': [f'/home/xie_x1/MLXID/DataProcess/Samples/SiemenStarLowerLeft/1Photon_CS3_chunk{i}.h5' for i in range(1)], # 160 files, no zeroing pixels outside the cluster
|
||||
'dataFiles': [f'/home/xie_x1/MLXID/DataProcess/Samples/SiemenStarLowerLeft/1Photon_CS3_chunk{i}.h5' for i in range(160)], # 160 files, no zeroing pixels outside the cluster
|
||||
'modelVersion': '251022',
|
||||
'energy': 15, # keV
|
||||
'roi': [140, 230, 120, 210], # x_min, x_max, y_min, y_max,
|
||||
@@ -76,7 +76,7 @@ def apply_inverse_transforms(predictions: torch.Tensor, numberOfAugOps: int) ->
|
||||
|
||||
if __name__ == "__main__":
|
||||
model = models.get_model_class(config['modelVersion'])().cuda()
|
||||
modelName = f'singlePhoton{config["modelVersion"]}_{config["energy"]}keV_Noise{config["noise"]}keV_E500_aug1'
|
||||
modelName = f'singlePhoton{config["modelVersion"]}_{config["energy"]}keV_Noise{config["noise"]}keV_E150_aug1'
|
||||
if flag_normalize:
|
||||
modelName += '_normalized'
|
||||
model.load_state_dict(torch.load(f'/home/xie_x1/MLXID/DeepLearning/Models/{modelName}.pth', weights_only=True))
|
||||
@@ -143,14 +143,14 @@ if __name__ == "__main__":
|
||||
plt.clf()
|
||||
mlSuperFrame = mlSuperFrame[config['roi'][2]*BinningFactor : config['roi'][3]*BinningFactor, config['roi'][0]*BinningFactor : config['roi'][1]*BinningFactor]
|
||||
average = np.mean(mlSuperFrame)
|
||||
plt.imshow(mlSuperFrame, origin='lower', extent=[Y_st, Y_ed, X_st, X_ed])
|
||||
plt.imshow(mlSuperFrame, origin='lower', extent=[X_st, X_ed, Y_st, Y_ed])
|
||||
plt.colorbar()
|
||||
plt.savefig(f'{outputDir}/1Photon_ML_superFrame.png', dpi=300)
|
||||
np.save(f'{outputDir}/1Photon_ML_superFrame.npy', mlSuperFrame)
|
||||
|
||||
plt.clf()
|
||||
countFrame = countFrame[config['roi'][2] : config['roi'][3], config['roi'][0] : config['roi'][1]]
|
||||
plt.imshow(countFrame, origin='lower', extent=[Y_st, Y_ed, X_st, X_ed])
|
||||
plt.imshow(countFrame, origin='lower', extent=[X_st, X_ed, Y_st, Y_ed])
|
||||
plt.colorbar()
|
||||
plt.savefig(f'{outputDir}/1Photon_count_Frame.png', dpi=300)
|
||||
np.save(f'{outputDir}/1Photon_count_Frame.npy', countFrame)
|
||||
|
||||
Reference in New Issue
Block a user