How to start measure halfway? - lilypond

In my hymn, I need to start the first measure halfway through. It has a time of 3/4, but I have to insert two empty, non-showing eighth notes. How do I do that?
I've used o4 o4 c8[ d] below for the first measure, but lilypond does not like this. What's the right way?
Here's the line:
o4 o4 c8[ d] e4 e4 e8[ f] g4 g4 f8[ e] d4 d4 g8[ f] e2

For upbeats, there's a special command \partial available. In your case, you should notate a quarter partial:
\relative c' {
\time 3/4
\partial 4
c8 d | e4 e4 e8 f | g4 g4 f8 e | d4 d4 g8 f | e2
}
This results in:

Related

Finding postive and negative anchors for RPN (in faster RCNN)

I have been going through Faster RCNN Paper and I am facing a trouble understanding how to find out the positive and negative anchors at the time of training RPN's
As per the paper (Section 3.1.2), for each anchor, authors assign a positive label for
The anchor/anchors with the highest IoU overlap with a ground-truth box
An anchor that has IoU overlap higher than 0.7 with any ground-truth-box
for finding the negative proposal (background proposal), go through the remaining anchors and assign a negative label if
IoU is less than 0.3 for all ground-truth box
The remaining anchors even after this step are ignored while training.
EXAMPLE
G/A
A1
A2
A3
A4
A5
A6
A7
A8
A9
A10
G1
0.54
0.44
0.02
0.03
0
0.25
0.78
0.71
0.29
0.01
G2
0.63
0.28
0.68
0.62
0.9
0.21
0.73
0.26
0.27
0.14
G3
0.66
0.26
0.03
0.64
0.54
0.53
0.47
0.46
0.15
0.02
After applying rule 1 (for each ground truth, find the maximum IoU with anchor and assign it as positive), So
For G1, the highest value is for A7, so A7 is matched to G1
For G2, the highest value is for A5, so A5 is matched to G2
For G3, the highest value is for A1, so A1 is matched to G3
A1
A2
A3
A4
A5
A6
A7
A8
A9
A10
G1
G2
G1
After applying rule 2 we will get (for each anchor box, if IOU is greater than 0.7, then assign to the ground-truth)
For A8, the maximum value occurs with G1, so A8 is matched with G1
A1
A2
A3
A4
A5
A6
A7
A8
A9
A10
G1
G2
G1
G1
After applying rule 3 we will get
A1
A2
A3
A4
A5
A6
A7
A8
A9
A10
G1
G2
G1
G1
N
N
Now all the remaining one are marked as ignored.
A1
A2
A3
A4
A5
A6
A7
A8
A9
A10
G1
I
I
I
G2
I
G1
G1
N
N
My questions :
I wanted to know if my understanding is right or wrong ?
Also, if the rules are applied in different order then will it change the final output ?
In the above example, for rule 1 if suppose G2 maximum is also A7, then A7, then how should one decide G1 or G2 (I suppose choose the one which has the maximum, but I am not sure though)
Thanks.

LilyPond missing repeat bar end line

New to LilyPond and trying to use it to transcribe some bagpipe music. In this score there are two sets of repeats, however it is not adding the repeat bar end to the first, only the second. Even if I try to force it with \bar ":|." it is just ignored.
\score {
\header {
}
{
\clef "treble"
\time 3/4
\hideKeySignature
\repeat volta 2 {
\bar ".|:"
\grg a8. b16 \dblc c4 \grg e
\grg a8. b16 \dblc c4~ c4
\dblb b8 \grG a \dblb b4~ b4
\grg c16. b32 \grg a16. b32 \dblc c4~ c4
\break
\grg a8. b16 \dblc c4 \grg e
\grg a8. b16 \dblc c4~ c4
\dblb b8 \grG a \dblb b4 \thrwd d4
\dblc c8. b16 \grg a4~ a4
%% No bar end repeat line here?
}
\break
\repeat volta 2 {
\bar ".|:"
\thrwd d8. e16 \grg f4 A
\grf g8 f \dble e4~ e4
\thrwd d8 c \dblb b4~ b4
\grg c16. b32 \grg a16. b32 \dblc c4~ c4
\break
\thrwd d8. e16 \grg f4 A
\grf g8 f \dble e4~ e4
\thrwd d8 c \dblb b4 \thrwd d4
\dblc c8. b16 \grg a4~ a4
}
}
}
This code produces .
Where I would like repeat bar end marking to go after the second line.
The reason that you aren't getting the repeat barline at the end of the first section, is that you are forcing the barline to be: \bar ".|:".
LilyPond is using this as the barline definition for not only the start of the second section, but also for the end of the first section; LilyPond considers this to be a single barline event (as you'd expect if there wasn't at a line break here).
If you really want to force the repeat barline definition in the middle of the piece (between the repeated sections), you should use the compound barline: \bar ":|.|:".
However, in this case it much easier if you don't force the barline at all; remove this line and the \repeat volta commands will get the barlines right without it.
This seems to work. It has something to do with forcing the bar lines.
\version "2.20.0"
\include "bagpipe.ly"
\score {
\header {
}
{
\clef "treble"
\time 3/4
\hideKeySignature
\repeat volta 2 {
\bar ".|:"
\grg a8. b16 \dblc c4 \grg e
\grg a8. b16 \dblc c4~ c4
\dblb b8 \grG a \dblb b4~ b4
\grg c16. b32 \grg a16. b32 \dblc c4~ c4
\break
\grg a8. b16 \dblc c4 \grg e
\grg a8. b16 \dblc c4~ c4
\dblb b8 \grG a \dblb b4 \thrwd d4
\dblc c8. b16 \grg a4~ a4
%% No bar end repeat line here?
}
\break
\repeat volta 2 {
%\bar ".|:"
\thrwd d8. e16 \grg f4 A
\grf g8 f \dble e4~ e4
\thrwd d8 c \dblb b4~ b4
\grg c16. b32 \grg a16. b32 \dblc c4~ c4
\break
\thrwd d8. e16 \grg f4 A
\grf g8 f \dble e4~ e4
\thrwd d8 c \dblb b4 \thrwd d4
\dblc c8. b16 \grg a4~ a4
}
}
}
Notice that I included the "bagpipe.ly" file and I have a version number. Be sure to post complete working examples in the future.

Sum Over unique identifier in Spotfire

I am trying to create a bar chart that sums up values in a field, but only for each unique identifier. For instance, for my data:
Condition CT_ID Enrollment Company
I 5127 24 H
J 5127 24 H
P 5127 24 H
I 5127 24 O
J 5127 24 O
P 5127 24 O
L 27668 387 C
R 27668 387 C
D 38190 650 D
Q 38190 650 D
F 38785 30 A
E 39682 30 B
M 41818 17 I
O 44093 188 G
A 54850 18 K
G 59183 F
C 59891 266 J
G 61142 48 F
H 61425 28 L
K 61449 N
A 61793 12 E
N 61793 12 E
B 61910 120 M
B 61917 120 M
B 61961 130 M
Or, since I really want to eventually summarize these data by Condition, let me just show the above data resorted by Condition instead of [CT_ID].
Condition CT_ID Enrollment Company
A 54850 18 K
A 61793 12 E
B 61910 120 M
B 61917 120 M
B 61961 130 M
C 59891 266 J
D 38190 650 D
E 39682 30 B
F 38785 30 A
G 59183 F
G 61142 48 F
H 61425 28 L
I 5127 24 H
I 5127 24 O
J 5127 24 H
J 5127 24 O
K 61449 N
L 27668 387 C
M 41818 17 I
N 61793 12 E
O 44093 188 G
P 5127 24 H
P 5127 24 O
Q 38190 650 D
R 27668 387 C
The rows are duplicated by different values in Condition and Company. CT_ID is the identifier for the record.
I want to sum up my Enrollment column, but I will be overcounting. So I thought I could create a custom expression like :
Sum(Avg([Enrollment]) OVER ([CT_ID]))
But this is somehow not a valid expression. Where am I going wrong?
For my bar chart, I'd like to have the Condition as the category axis and the Enrollment as the value axis. The below table shows how the Enrollment value should be calculated. Focus on Conditions P, I, and J.
Condition Enrollment
A 30
B 370
C 266
D 650
E 30
F 30
G 48
H 28
I 24
J 24
K
L 387
M 17
N 12
O 188
P 24
Q 650
R 387
My current solution uses a rank function and only puts the enrollment info in the first row for each unique CT_ID, but that is just plain wrong when I start filtering data. For instance, imagine in my dataset above I only had an Enrollment value for the first row of CT_ID 5127. If I filter out Condition "I" (the one in the first row), now the Enrollment value is zero!
Any help you can provide would be greatly appreciated! I'm no expert on OVER expressions, so hopefully there is an easy solution!
This is too long to comment...
Can you provide some expected results? It looks as though each CT_ID can only have one value, so SUM of them distinctively would just be any one of the values... right? If not, what determines a duplicate?
Here is how you can accomplish what you were attempting in your code above--but from your test data isn't just going to give you the value of Enrollment since there each CT_ID seemingly only has one value (duplicated).
Sum([Enrollment]) over ([CT_ID]) / Count() OVER ([CT_ID])
You could also just use First()
First([Enrollment]) OVER ([CT_ID])
EDIT
Since you have some duplicates and some not... let's just split out the duplicates into the average of the number of duplicates there are. Insert this calculated column:
Max([Enrollment]) over (Intersect([CT_ID],[Condition])) / Count([Enrollment]) over (Intersect([CT_ID],[Condition]))
Then use this column in place of Enrollment in what ever expression you want to ignore duplicates, where a duplicate is the same Condition, CT_ID, and Enrollment value.
For example... the rows for Condition = P and CT_ID = 5127 will have 12 instead of 24.

Circuit design that outputs square of binary input

So for my digital logic course, we were asked to design a combinational circuit with 3 inputs, and an output that generates the square of the binary input. I assume she means the inputs are 3 bit binary numbers 0-7. In describing the solution, she mentioned 3 general steps of 1. Finding truth table, 2. deriving the function and 3. Simplifying
I understand perfectly how to do this when the output is a single function (combine the instances of a true function, simplify etc.) In our only relevant example, we input BCD numbers 0-9 and output their excess-3 equivalent, then simplified a k-map for each of the 4 output variables (a map for W, the leftmost bit, X the second-to-left bit, etc.). Not sure what to do from here tho. Thanks for the help
As you already mentioned, you need to fetch the inputs in binary, calculate the square in binary format (the binary length will increase from 3 to 6).
But, you don't need those BCD numbers and output their excess-3 equivalent. That would rather make the problem more complex. Simply do as directed below.
So, for the 3 different bit combinations, you need to generate a function in terms of combinational circuit that will yield a 6-bit square of the given number.
So, your input set = {b0,b1,b2} and your output set = {B1,B2,B3,B4,B5,B6}.
Then, you need to draw the truth table of 3-bit to 6-bit square converter as :-
Input B6 B5 B4 B3 B2 B1 B0
b0
b1
b2
Fill the entries, that's the homework for you.
And, then when you have output bits B6,B5,...,B0 in terms of b0,b1 and b2, just simplify all the functions.
If you still have any doubt, comment below. I will help you with your issue. Good luck.
I have used Logic Friday 1 to derive the following minimized expression for the six outputs of your multiplier:
ab5 = a2 a1 b2 b1 + a2 a1 a0 b2 b0 + a2 a0 b2 b1 b0;
ab4 = a2 a1' a0' b2 + a2 a1' b2 b1' + a2 a0' b2 b1'
+ a2 a1' b2 b0' + a2 b2 b1' b0' + a2' a1 a0 b2 b1
+ a2 a1 b2' b1 b0 + a1 a0 b2 b1 b0;
ab3 = a2' a1 a0' b2 + a2 a1' b2' b1 + a2' a1 b2 b1'
+ a2 b2' b1 b0' + a2' a1 a0 b2' b1 b0 + a2 a1' a0 b2 b1' b0
+ a1 a0' b2 b1' + a2 a1' b1 b0' + a2 a0' b2 b1 b0
+ a2 a1 a0 b2 b0';
ab2 = a2' a1 a0' b1 + a2 a1' a0' b0 + a2 a0' b1' b0
+ a1' a0 b2 b0' + a1 a0' b1 b0' + a1 b2' b1 b0'
+ a0 b2 b1' b0' + a2' a0 b2 b0 + a2 a0 b2' b0;
ab1 = a1' a0 b1 + a1 a0' b0 + a1 b1' b0 + a0 b1 b0';
ab0 = a0 b0;
As a truth table:
The original truth table has 64 rows.
The largest output number is 49 = 7 * 7 = 32 + 16 + 1.
Therefore, six (= 3 + 3) output bits are sufficient.

Get Hierarchial Data using LINQ

ID Name Designation PID
1 E1 D1 0
2 E2 D2 0
3 E3 D3 1
4 E4 D3 1
5 E5 D4 3
6 E6 D4 3
7 E7 D4 2
8 E8 D4 2
How can we get all the child employees based on the parent employee using LINQ ?
For eg., if we want child records for employee E1 we should get E3,E4,E5,E6
Thanks in advance...
You can't do it using one single LINQ query. But you can do it using a recursive function smth like:
IList<Employee> GetAllChildren(IList<Employee> employees, int pid)
{
var children = employees.Where (e => e.PID == pid).ToList();
children.AddRange (children.SelectMany (e => GetAllChildren (employees, e.ID)).ToList());
return children;
}