File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -568,6 +568,37 @@ def test_multivariate_observations(self):
568
568
assert "direction" not in idata .log_likelihood .dims
569
569
assert "direction" in idata .observed_data .dims
570
570
571
+ @pytest .mark .xfail (reason = "Critical bug in dataset conversion." )
572
+ def test_constant_data_coords_issue_5046 (self ):
573
+ # For some reason only the first entry of the `dims` ends up in the dataset.
574
+ dims = {
575
+ "alpha" : ["backwards" ],
576
+ "bravo" : ["letters" , "yesno" ],
577
+ }
578
+ coords = {
579
+ "backwards" : np .arange (17 )[::- 1 ],
580
+ "letters" : list ("ABCDEFGHIJK" ),
581
+ "yesno" : ["yes" , "no" ],
582
+ }
583
+ data = {
584
+ name : np .random .uniform (size = [len (coords [dn ]) for dn in dnames ])
585
+ for name , dnames in dims .items ()
586
+ }
587
+
588
+ for k in data :
589
+ assert len (data [k ].shape ) == len (dims [k ])
590
+
591
+ ds = pm .backends .arviz .dict_to_dataset (
592
+ data = data ,
593
+ library = pm ,
594
+ coords = coords ,
595
+ dims = dims ,
596
+ default_dims = [],
597
+ index_origin = 0 ,
598
+ )
599
+ for dname , cvals in coords .items ():
600
+ np .testing .assert_array_equal (ds [dname ].values , cvals )
601
+
571
602
572
603
class TestPyMCWarmupHandling :
573
604
@pytest .mark .parametrize ("save_warmup" , [False , True ])
You can’t perform that action at this time.
0 commit comments