Skip to content

Commit

Permalink
improve comments and code style, see #93
Browse files Browse the repository at this point in the history
  • Loading branch information
jbphet committed Feb 13, 2025
1 parent 709e3fd commit b179f22
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions js/bloch-sphere/view/BlochSphereMeasurementArea.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright 2025, University of Colorado Boulder

/**
* BlochSphereMeasurementArea is the node that contains the measurement area for the Bloch Sphere screen. It contains
* the UI elements for controlling various aspects of the measurement that is to be performed.
* BlochSphereMeasurementArea is the Scenery Node that contains the measurement area for the Bloch Sphere screen. It
* contains the UI elements for controlling various aspects of the measurement that is to be performed.
*
* @author Agustín Vallejo
* @author John Blanco (PhET Interactive Simulations)
Expand Down Expand Up @@ -46,7 +46,7 @@ type BlochSphereMeasurementAreaOptions = SelfOptions & WithRequired<NodeOptions,
// constants
const TIMES = MathSymbols.TIMES;

// Nominal max width of texts, empirically determined
// nominal max width of text elements, empirically determined
const MAX_WIDTH = 200;

export default class BlochSphereMeasurementArea extends Node {
Expand Down
10 changes: 5 additions & 5 deletions js/bloch-sphere/view/BlochSphereNumericalEquationNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,13 @@ export default class BlochSphereNumericalEquationNode extends HBox {
}
}

// If showGlobalPhaseProperty is true and basis is X or Y,
// Show the factored out global phase e^{i phiPlus pi} over the entire state.
// If showGlobalPhaseProperty is true and basis is X or Y, show the factored out global phase e^{i phiPlus pi}
// over the entire state.
let globalPhasePart = '';
let finalEquation = `|${PSI}⟩ = ${upComponent}${plus}${downComponent}`;
if ( showGlobalPhase && ( basis === StateDirection.X_PLUS || basis === StateDirection.Y_PLUS ) ) {

// Format the global phase as e^{i phiPlus pi} (factored out in front)
// Format the global phase as e^{i phiPlus pi} (factored out in front).
phiPlus < 0 ? phiPlus += 2 : phiPlus;
const globalPhaseString = Utils.toFixed( phiPlus, 2 );
globalPhasePart = `e<sup>i${globalPhaseString}${PI}</sup> `;
Expand All @@ -176,10 +176,10 @@ export default class BlochSphereNumericalEquationNode extends HBox {

super( options );

// Add the RichText equation node to this container
// Add the RichText equation node to this container.
this.addChild( equationNode );

// This prevents the equation from resizing vertically on simplification
// This prevents the equation from resizing vertically on simplification.
this.minContentHeight = this.height;
}
}
Expand Down
10 changes: 6 additions & 4 deletions js/bloch-sphere/view/BlochSpherePreparationArea.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright 2024-2025, University of Colorado Boulder

/**
* Zone where the Bloch Sphere direction is set by the user,
* it includdes sliders for the polar and azimuthal angles and a ComboBox to select the direction.
* Zone where the Bloch Sphere direction is set by the user. It includes sliders for the polar and azimuthal angles and
* a ComboBox to select the direction.
*
* @author Agustín Vallejo
*/
Expand Down Expand Up @@ -50,7 +50,8 @@ export default class BlochSpherePreparationArea extends VBox {
majorTickLength: 10,
constrainValue: value => Utils.roundToInterval( value, 5 / 180 * Math.PI ), // 5 degree intervals
shiftKeyboardStep: 5 / 180 * Math.PI
} );
}
);
const azimuthSlider = new Slider(
model.preparationBlochSphere.azimuthalAngleProperty,
model.preparationBlochSphere.azimuthalAngleProperty.range,
Expand All @@ -62,7 +63,8 @@ export default class BlochSpherePreparationArea extends VBox {
majorTickLength: 10,
constrainValue: value => Utils.roundToInterval( value, 5 / 360 * Math.PI * 2 ), // 5 degree intervals
shiftKeyboardStep: 5 / 360 * Math.PI * 2
} );
}
);

polarSlider.addMajorTick( 0, new Text( '0', { font: new PhetFont( 15 ) } ) );
polarSlider.addMajorTick( Math.PI, new Text( `${MathSymbols.PI}`, { font: new PhetFont( 15 ) } ) );
Expand Down
2 changes: 1 addition & 1 deletion js/bloch-sphere/view/MagneticFieldArrowNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default class MagneticFieldArrowNode extends ArrowNode {
stroke: 'black',
fill: QuantumMeasurementColors.magneticFieldColorProperty,

// empirically determined values
// empirically determined values that define the shape of the arrow
headHeight: 0.3 * maximumLength,
headWidth: 0.4 * maximumLength,
tailWidth: 0.15 * maximumLength
Expand Down
1 change: 0 additions & 1 deletion js/bloch-sphere/view/MagneticFieldControl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ export default class MagneticFieldControl extends Panel {
} ),
options
);

}
}

Expand Down
5 changes: 2 additions & 3 deletions js/bloch-sphere/view/MeasurementTimerControl.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright 2025, University of Colorado Boulder

/**
* MeasurementTimerControl is the node that contains the UI elements for controlling the time at which the
* Bloch Sphere is measured.
* MeasurementTimerControl is the node that contains the UI elements for controlling the time at which the Bloch Sphere
* is measured.
*
* @author Agustín Vallejo
* @author John Blanco (PhET Interactive Simulations)
Expand Down Expand Up @@ -135,7 +135,6 @@ export default class MeasurementTimerControl extends Node {
}, providedOptions );

super( options );

}
}

Expand Down

0 comments on commit b179f22

Please sign in to comment.