wallento / wavedrompy

WaveDrom compatible python command line
Other
93 stars 21 forks source link

wavedrompy fails to work on files generated by wavedrom #37

Open Araneidae opened 2 years ago

Araneidae commented 2 years ago

I'm not sure if this is a duplicate issue (certainly issue #34 seems to cover the same ground, but doesn't actually state the issue).

If I run wavedrompy -i test-file.json -s test-file.svg on a file generated using the wavedrom editor I get the following error message:

json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)

I understand that the underlying issue is that the wavedrom file format (an example is shown below):

{signal: [
  {name: 'e', wave: '0.30.30..', data: ['τ', 'τ+1']},
  {name: 'x', wave: 'x.=x.=x..', data: ['x₀', 'x₁']},
  {name: 'δₑx', wave: 'x..=..=..', data: ['x₀', 'x₁']},
  {name: 'δe', wave: '0..30.30.', data: ['τ', 'τ+1']},
]}

is in what is referred to as "relaxed JSON", or really Javascript, which is a dialect the Python JSON decoder doesn't appear to understand.

wallento commented 2 years ago

I think this is fixed with https://pypi.org/project/wavedrom/2.0.3.post3/ can you confirm that?

angelopereira commented 1 year ago

Hello, I have installed 2.0.3.post3. The relaxed JSON works fine for digital signals. However I am unable to make the piecewise linear analog signal syntax work in this package. I am able to successfully render analog signals in the native wavedrom editor. Please see exact example below consisting of 2 analog signals and 3 digital signals. When I use the wave: ['pw', {d: 'm,0,0 h,0.5,0 l,1,5 h,12.5'}] syntax directly I get the error of "TypeError: unhashable type: 'dict'". If I place the contents within {d: 'm,0,0 h,0.5,0 l,1,5 h,12.5'} in a dict and name it say "dict1", and then use dict1 in the wave description I do not get this error but the waveform does not get rendered either. Any suggestions on how I might overcome this syntactical issue?

{signal: [ {name: '', wave: '1.............'}, {}, ['VIN', {name:'12V'}, {name:'10V'}, {name:'5V'}, {name: '0V', wave: ['pw', {d: 'm,0,0 h,0.5,0 l,1,5 h,12.5'}]} ], {}, {name:'5V'}, {name:'4.3V'}, {name:'VOUT 3.6V'}, {name:'1.8V'}, {name: '0V', wave: ['pw', {d: 'm,0,0 q,0.5,4,3,4 h,3 L,7,5 h,4 L,12,6 h,2'}]}, {name: 'dig1', wave: "x.......0..1.."}, {name: 'dig2', wave: "01......0....."}, {name: 'dig3', wave: "x.......3..4..",data:["00","11"]} ]}

gipi commented 1 year ago

I don't know what changes happened what suddenly my wavedrom JSON stopped working, an example here, it seems that tabs are now allowed anymore.