Closed i-saksham closed 3 years ago
I was able to solve errors and now the example files (main1.py, main2.py ,main3.py) work properly.
But the same error persists (No numeric types to aggregate) with a codes that I wrote myself. Am I missing any files that are required for the code to work, other than the logging.ini file and the python file?
Any help would be much appreciated. I'm very glad for finding this software, it very nice!
Hello, I think the problem comes from this function: results = self.average_loop_response(time_loops). This function analyses the results of the simulator. Maybe, there is a problem with the traces... Could you send me the traces, the output CSV-files from the simulator to try to generate the error?
In general, the analysis of the results depends on your modelling. Thus, for example, if you want to measure the availability in failure cases you need to do this specific measurement with both files. Originally, I implemented a basic analysis from the traces, but these functions are no longer maintained in the new version YAFS3 since it's better than any designer implements this specific analysis. But, in any case, I would like to help you to discover the bug/problem! :)
Best!
and I forget to mention, What version of Pandas and numpy library are you using? Thx
Thanks for the advice, there turned out to be a problem with my population statements, it's fixed now! But I would like to know how to use to ffmpeg to generate a video output, is it as simple as copying the two statements mentioned in the install guide?
I am using numpy 1.19.3 and pandas 0.25.3
To generate videos, first, you need to generate snapshots along with the simulation. Generally, these snapshots represent the allocation of the services and users in the topology. Here you can find a complex representation of the scenario: https://github.com/acsicuib/MARIO/tree/MarioII (https://github.com/acsicuib/MARIO/tree/MarioII/videos). It is not easy since we use matplotlib and networkx and it depends on your scenario modelling. The images files are generated by this script (https://github.com/acsicuib/MARIO/blob/MarioII/multi-agent-policies/environment/app_operator.py in function render()).
When you have all the files, you can call ffmpeg command, from python or (from console)
os.system("ffmpeg -r 1 -i %simages/network_%%05d.png -c:v libx264 -vf fps=1 -pixfmt yuv420p %svideo%s.mp4"%(temporal_folder,temporal_folder,code))
and, you can convert the video into a gif file: ffmpeg -t 20 -i video.mp4 -vf "fps=10,scale=520:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 output.gif
In YAFS3, by default, this generation is implemented when you deal with maps.
I was trying to run the tutorial programs but none of them were working for me right off the bat. So I had to fix some references here and there and right it executes somewhat but the results show this error. This is the output for main1.py What could I do to fix it?
2021-03-30 18:36:09,144 - yafs.core - DEBUG - Creating PIPE: SimpleCaseServiceA0 DES | TOPO | Src.Mod | Modules 0 | 0 | -- | ServiceA
2021-03-30 18:36:09,144 - yafs.core - DEBUG - Added_Process - Module Consumer: ServiceA #DES:0 2021-03-30 18:36:09,144 - yafs.core - DEBUG - Added_Process - Internal Monitor: Stop_Control_Monitor #DES:1
--- 0.008085250854492188 seconds --- Simulation Time: 1000.00 Application loops delays: Traceback (most recent call last): File "D:/Project Work/YAFS/src/examples/Tutorial/main1.py", line 162, in
m.showResults2(1000, time_loops=time_loops)
File "D:\Project Work\YAFS\src\yafs\stats.py", line 138, in showResults2
results = self.average_loop_response(time_loops)
File "D:\Project Work\YAFS\src\yafs\stats.py", line 45, in average_loop_response
{"time_total_response": ["mean", "count"]}) # Its not necessary to have "count"
File "D:\Project Work\YAFS\venv\lib\site-packages\pandas\core\groupby\generic.py", line 1455, in aggregate
return super().aggregate(arg, *args, kwargs)
File "D:\Project Work\YAFS\venv\lib\site-packages\pandas\core\groupby\generic.py", line 229, in aggregate
result, how = self._aggregate(func, _level=_level, *args, *kwargs)
File "D:\Project Work\YAFS\venv\lib\site-packages\pandas\core\base.py", line 506, in _aggregate
result = _agg(arg, _agg_1dim)
File "D:\Project Work\YAFS\venv\lib\site-packages\pandas\core\base.py", line 456, in _agg
result[fname] = func(fname, agg_how)
File "D:\Project Work\YAFS\venv\lib\site-packages\pandas\core\base.py", line 440, in _agg_1dim
return colg.aggregate(how, _level=(_level or 0) + 1)
File "D:\Project Work\YAFS\venv\lib\site-packages\pandas\core\groupby\generic.py", line 851, in aggregate
ret = self._aggregate_multiple_funcs(func_or_funcs, (_level or 0) + 1)
File "D:\Project Work\YAFS\venv\lib\site-packages\pandas\core\groupby\generic.py", line 930, in _aggregate_multiple_funcs
results[name] = obj.aggregate(func)
File "D:\Project Work\YAFS\venv\lib\site-packages\pandas\core\groupby\generic.py", line 845, in aggregate
return getattr(self, func_or_funcs)(args, kwargs)
File "D:\Project Work\YAFS\venv\lib\site-packages\pandas\core\groupby\groupby.py", line 1205, in mean
"mean", alt=lambda x, axis: Series(x).mean(kwargs), kwargs
File "D:\Project Work\YAFS\venv\lib\site-packages\pandas\core\groupby\groupby.py", line 888, in _cython_agg_general
raise DataError("No numeric types to aggregate")
pandas.core.base.DataError: No numeric types to aggregate