catmap
catmap copied to clipboard
Blank squares in output plots
Hi, I tried running the codes provided in the tutorial, but instead of getting the same volcano plots as demonstrated in the tutorial, there are some blank squares in my output plots (attached). Anyone understand what the problem might be?
I'm using: Python: 3.8 matplotlib: 3.3.4 numpy: 1.20.1 scipy: 1.6.0 mpmath: 1.2.1 ase: 3.21.1
I had the same issue with much larger blank squares. Have you fixed the problem?
I had the same issue with much larger blank squares. Have you fixed the problem?
Hi Steven,
I did find a way to temporarily solve this problem, but I don't know if it is the actual correct solution we should be using. Anyway, you can try modifying the following code in mkm_job.py:
from catmap import analyze vm = analyze.VectorMap(model) vm.plot_variable = 'rate' #tell the model which output to plot vm.log_scale = True #rates should be plotted on a log-scale vm.min = 1e-25 #minimum rate to plot vm.max = 1e2 #maximum rate to plot vm.plot(save='rate.pdf') #draw the plot and save it as "rate.pdf"
increase the vm.min value to 1e-20 or something larger, and the blank squares would disappear. Hope this works for you, and if you find another solution please let me know.
Hi Siqi, I just read the history commits and find the solution to the colormap issue, simply add:
from catmap import analyze
vm = analyze.VectorMap(model)
vm.plot_variable = 'rate' #tell the model which output to plot
vm.log_scale = True #rates should be plotted on a log-scale
vm.min = 1e-25 #minimum rate to plot
vm.max = 1e2 #maximum rate to plot
+ vm.colormap = "jet"
vm.plot(save='rate.pdf') #draw the plot and save it as "rate.pdf"
and the colormap will use the older version "jet" pattern, which in my sense is more beautiful.
Perfect, I'll try this out, thanks for letting me know! And here's my email address [email protected] I'd be happy to have any further discussion regarding CatMap with you.
I've found that this issue is caused by a data-structure transferring error in the function ReactionModel.map_to_array(), and some of the values are lower than your set vm.min (e.g. 1e-25) would be wrongly transferred to -1e-25, so the following np.log10() function would return a NaN, which leads to the blank in the output plot.
This numerical error can be fixed by adding the following code in row 272 of https://github.com/SUNCAT-Center/catmap/blob/master/catmap/analyze/analysis_base.py and reinstalling the package:
if self.log_scale and dim == 2:
for i in range(0,len(maparray)):
for j in range(0,len(maparray[0])):
for k in range(0,len(maparray[0][0])):
if maparray[i][j][k] < 0:
maparray[i][j][k]=-1*maparray[i][j][k]
maparray = np.log10(maparray)