Skip to content

Commit

Permalink
Randomisations: More comments, improved feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
shawnlaffan committed Nov 12, 2024
1 parent 6ffec81 commit 04dcdb4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/Biodiverse/Randomise.pm
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,7 @@ sub get_randomised_basedata {
my $self = shift;
my %args = @_;

# no need to generate a separate set if no labels to hold constant
return $self->_get_randomised_basedata (%args)
if !$args{labels_not_to_randomise};

Expand All @@ -803,7 +804,9 @@ sub get_randomised_basedata {
}
}
}
say join ' ', @$constant_labels;
my $n = max (4, $#$constant_labels);
say "[Randomise] Constant labels, first 0..$n are "
. join ' ', @$constant_labels[0 .. $n];
}

my $csv_object = $bd->get_csv_object (
Expand Down Expand Up @@ -835,6 +838,7 @@ sub get_randomised_basedata {
$non_const_bd->rebuild_spatial_index; # sometimes the non_const basedata is "missing" groups
my $new_rand_bd = $self->_get_randomised_basedata (%args, basedata_ref => $non_const_bd);

# add the constant labels
$new_rand_bd->merge (from => $const_bd);

return $new_rand_bd;
Expand Down

0 comments on commit 04dcdb4

Please sign in to comment.