JuPedSim / jpsreport

Analysis tool
https://www.jupedsim.org/jpsreport_introduction.html
Other
3 stars 9 forks source link

Calling negative frameIDs leads to problems in extracting frameIDs #56

Closed chraibi closed 5 years ago

chraibi commented 5 years ago

In Gitlab by @PaulGeoerg on Oct 1, 2018, 09:31 [origin]

Hi everyone,

I am challenged by negative numbers of frames (frameID) at the beginning of an experimental run. This is caused by a frameshift between two connected (married) camera perspectives. Because it is a result of the combination process, I talked to @JuleAdrian about this and she will change the this for future of linking of cameras.

But in general: The frameID of "_Plot_cell_v.py" and "_Plot_cell_rho.py" is generated in different ways. Isn't it? If I change line 57 in "_Plot_cell_v.py" and use RegEx to split the namefile to:

frameNr = int(float(re.split("_|-", namefile)[-1])) #use regex fo split by multiple delimiters ('_' and '-')

I get the expected polygons inlcuding the negative frameIDs (e.g. "polygon0501_converted.txt_id_2_000-4.dat"). But no v-plots of the polygons corresponding to the negative frameIDs because an error in string conversion: "_000-4.png" is not convertible to an integer. Maybe I am wrong in that regard? And I get no rho-Plots of the polygons (neither positive nor negative frameIDs).

To sum up, I have two questions:

1.) Why is the frameID generated by different methods for _Plot_cell_rho and _Plot_cell_v?

2.) Do you have any suggestions to convert the negative frameID into and Int / float? (as a workaround I will change the frameIDs in pre-processing to positive numbers ...)

Example

Log-File

Thanks in advance for your support!

chraibi commented 5 years ago

In Gitlab by @JuleAdrian on Oct 1, 2018, 17:24

To question 1: Are you sure that the frameNr is different in _Plot_cell_rho.py and _Plot_cell_v.py? In the plot scripts of the current versions, you find the same line:

frameNr = int(namefile.split("_")[-1])

This is line 56 in _Plot_cell_v.py and line 162 in _Plot_cell_rho.py.

Are the scripts different in the version you are currently using?

chraibi commented 5 years ago

In Gitlab by @PaulGeoerg on Oct 4, 2018, 19:03

Sorry guys, I didn't checked it by now. Apologies for delay on this . I will do this at the weekend / beginning the next week!

chraibi commented 5 years ago

In Gitlab by @chraibi on Oct 4, 2018, 19:11

Paul, No stress. (you mean ladies) :grin:

chraibi commented 5 years ago

In Gitlab by @PaulGeoerg on Oct 22, 2018, 12:52

Argh... I am so sorry, I forgot about this issue.

Using the Scripts from the current version leads to the same problem: any plotout of rho/v of frame_ids smaller than zero leads to an error:

Traceback (most recent call last): File "././scripts//_Plot_cellv.py", line 56, in frameNr = int(namefile.split("")[-1]) ValueError: invalid literal for int() with base 10: '000-1'

Saving of the polygon-files with filenames corresponding to the negative frame_ids works.

@JuleAdrian : I was wondering why try and except ist used in _plot_cell_rho and not in Plot_cell_v. But it doesn't tpuch the issue. Sorry for inaccuracy of formulation.

(updated version (scripts in current version included) of the mwe is attached)

chraibi commented 5 years ago

In Gitlab by @chraibi on Oct 22, 2018, 13:05

I think I understand your problem:

jpscore produces files with names as follows *%4d.dat, which yields by negative frames to names like e.g. *000-1.png.

Is this correct?

Screenshot_2018-10-22_at_13.08.15

chraibi commented 5 years ago

In Gitlab by @PaulGeoerg on Oct 22, 2018, 13:11

@chraibi : You're absolutly right. I do not understand what is different in split the filename for the savetxt (e.g.polygon0501_converted.txt_id_2_000-3 ) and the split for the filename of the pngs?

chraibi commented 5 years ago

In Gitlab by @chraibi on Oct 22, 2018, 13:22

I think the error comes from this line

Screenshot_2018-10-22_at_13.20.43

We did not expect frame ids to be negative. If this line makes out of -1 a -00001 then I guess everything is going to be splitet as usual! ;-)

chraibi commented 5 years ago

In Gitlab by @chraibi on Oct 22, 2018, 13:31

mentioned in commit 5304efb89e046f356f77ca5e87c75e9a140ce157

chraibi commented 5 years ago

In Gitlab by @PaulGeoerg on Oct 23, 2018, 07:07

Absolutely. I know, that you did not expect negative frame ids. This is just happened because of the combination of different camera perspectives. But maybe it is useful for further projects...

Yes, it would be fine, if the highlighted line makes out of -1 a -00001 it would be fine. But why is the split for the polygon.txt working and the split for the names of the *.pngs not?

Anyway, this is just for understanding and not part of the issue. The issue may be closed.

chraibi commented 5 years ago

In Gitlab by @chraibi on Oct 25, 2018, 20:08

closed