Open Sibghat46 opened 2 weeks ago
Dear @Sibghat46, thanks for reaching out to us regarding irfu-matlab, I will refer this issue to @cecilianorgren who wrote much of the PDist.m code used by this example.
Hi,
The line
c_eval('ePDist? = PDist(desDist?.time,desDist?.data,''skymap'',energy,ephi?.data,etheta?.data);',ic)
assumes you have a PDist distribution loaded with the name desDist3 (3 if ic = 3). If you run the code from the beginning, maybe this is not the case (because the first example loads the PDist in as ePDist3 and iPDist3). The error thus likely comes from the fact that you try to access a field of a non-existent variable. By adding
c_eval('desDist? = ePDist?',ic)
before you execute the part of the code that gives you the error, the error might go away.
However, this example is just to show that there are several ways to construct your PDist. I.e. this example uses an already existing PDist to make a copy of it. The same is the case for
c_eval('ePDist? = irf.ts_skymap(desDist?.time,desDist?.data,[],ephi?.data,etheta?.data,''energy0'',eenergy0?.data,''energy1'',eenergy1?.data,''esteptable'',estepTable?.data);',ic)
It is thus not meaningful to run the example from the start to the end.
The example is also slightly outdated, and I will try to update it in the near future. And then I will also provide better comments, and properly make the needed variables.
Let me know if this helps for now. Please also feel free to ask any other questions!
Best wishes, Cecilia
hi, My Matlab version is R2023a. irfu-matlab version: v1.16.3 Operating system 64-bit operating system, x64-based processor Windows 11 pro.
Many irfu-matlab codes run nicely on my system but I have never been able to run this code for particle distributions {Example_MMS_PDist.m}. It loads the file but the error occurs in the desDist.time function. Here I have pasted the errors that I am getting.
db_info =
struct with fields:
Time: 2020-02-19T00:39:00.000000000Z Directory: C:\Users\sibgh\pydata\mms2\fpi\brst\l2\des-dist\2020\02\19\ File: mms2_fpi_brst_l2_des-dist_20200219003833_v3.4.0.cdf (156532063 bytes) [warning: make_pdist(86)] Times shifted to center of dt-+. dt-+ are recalculated [warning: make_pdist(86)] Times shifted to center of dt-+. dt-+ are recalculated Unable to resolve the name 'desDist2.time'.
Error in c_eval (line 48) for cl_id=sc_list_1, evalin('caller', irf_ssub(ev_str, cl_id)), end
Error in Particle_Distributions_MMS (line 23) c_eval('ePDist? = PDist(desDist?.time,desDist?.data,''skymap'',energy,ephi?.data,etheta?.data);',ic)
db_info =
struct with fields:
Time: 2015-10-30T05:15:45.000000000Z Directory: C:\Users\sibgh\pydata\mms3\fpi\brst\l2\des-dist\2015\10\30\ File: mms3_fpi_brst_l2_des-dist_20151030051444_v3.3.0.cdf (335671916 bytes) [warning: make_pdist(86)] Times shifted to center of dt-+. dt-+ are recalculated [warning: make_pdist(86)] Times shifted to center of dt-+. dt-+ are recalculated Unable to resolve the name 'desDist3.time'.
Error in c_eval (line 48) for cl_id=sc_list_1, evalin('caller', irf_ssub(ev_str, cl_id)), end
Error in Particle_Distributions_MMS (line 23) c_eval('ePDist? = PDist(desDist?.time,desDist?.data,''skymap'',energy,ephi?.data,etheta?.data);',ic)
db_info =
struct with fields:
Time: 2015-10-30T05:15:45.000000000Z Directory: C:\Users\sibgh\pydata\mms4\fpi\brst\l2\des-dist\2015\10\30\ File: mms4_fpi_brst_l2_des-dist_20151030051444_v3.3.0.cdf (334346646 bytes) [warning: make_pdist(86)] Times shifted to center of dt-+. dt-+ are recalculated [warning: make_pdist(86)] Times shifted to center of dt-+. dt-+ are recalculated Unable to resolve the name 'desDist4.time'.
Error in c_eval (line 48) for cl_id=sc_list_1, evalin('caller', irf_ssub(ev_str, cl_id)), end
Error in Particle_Distributions_MMS (line 23) c_eval('ePDist? = PDist(desDist?.time,desDist?.data,''skymap'',energy,ephi?.data,etheta?.data);',ic)